diff --git a/config.json b/config.json new file mode 100644 index 0000000..2f06a9b --- /dev/null +++ b/config.json @@ -0,0 +1,9 @@ +{ + "github_token": "", + "repository": "asrar-mared/Zayed-Shield", + "logging_level": "INFO", + "modules": { + "vulnerability_scanner": true, + "github_monitor": true + } +} diff --git a/package.json b/package.json index dfc1105..a03eb29 100644 --- a/package.json +++ b/package.json @@ -2,73 +2,94 @@ "name": "zayed-shield", "version": "27.7.7", "codename": "Vulnerability Hunter", - "description": "Professional security toolkit with zero vulnerabilities - Cryptographic operations, threat detection, and advanced protection.", + "description": "Professional security toolkit with zero vulnerabilities — cryptographic operations, threat detection, advanced monitoring, and secure automation.", "main": "index.js", "type": "module", - "keywords": [ - "security", - "cryptography", - "secp256k1", - "vulnerability-hunter", - "penetration-testing", - "threat-detection", - "cybersecurity", - "zayed-shield" - ], - "author": "Zayed Security Research Team", + "author": { + "name": "Zayed CyberShield Team", + "email": "info@zayed-cybershield.ae", + "url": "https://zayed-cybershield.ae" + }, "license": "MIT", - "homepage": "https://github.com/zayed-shield/zayed-shield", + "homepage": "https://github.com/zayed-cybershield/protection#readme", "repository": { "type": "git", - "url": "https://github.com/zayed-shield/zayed-shield.git" + "url": "https://github.com/zayed-cybershield/protection.git" }, "bugs": { - "url": "https://github.com/zayed-shield/issues", - "email": "security@zayed-shield.com" + "url": "https://github.com/zayed-cybershield/protection/issues" }, + + "keywords": [ + "cybersecurity", + "cryptography", + "vulnerability-hunter", + "penetration-testing", + "threat-detection", + "security", + "uae", + "zayed", + "anti-tamper", + "درع-زايد", + "أمن-سيبراني", + "حماية", + "الإمارات" + ], + "engines": { - "node": ">=14.0.0", - "npm": ">=7.0.0" + "node": ">=18.0.0", + "npm": ">=9.0.0" }, + "dependencies": { "@noble/secp256k1": "^3.0.0", - "express": "^4.18.2", + "express": "^4.19.0", "lodash": "^4.17.21" }, + "devDependencies": { "ajv": "^8.18.0", "ajv-keywords": "^5.1.0", - "chai": "^6.2.2", - "eslint": "^10.0.0", + "chai": "^5.1.0", + "eslint": "^9.0.0", "eslint-plugin-security": "^3.0.1", - "nyc": "^17.1.0", "jest": "^30.0.0", - "webpack": "^6.0.0" - "html-webpack-plugin": "^5.6.6", - "jest": "^29.0.0", "nyc": "^17.1.0", - "terser-webpack-plugin": "^5.3.16", - "webpack": "^5.105.2", - "webpack-cli": "^5.1.4" + "webpack": "^6.0.0", + "webpack-cli": "^5.1.4", + "html-webpack-plugin": "^5.6.6", + "terser-webpack-plugin": "^5.3.16" }, + + "peerDependencies": { + "react": ">=18.0.0", + "vue": ">=3.0.0" + }, + "scripts": { "test": "jest", "test:coverage": "nyc npm test", "lint": "eslint .", "lint:fix": "eslint . --fix", + "security:check": "npm audit --omit=dev", "security:fix": "npm audit fix", "security:update": "npm update && npm audit", "security:full": "npm audit && npm outdated", + "prebuild": "npm run security:check", "build": "webpack --mode production", - "start": "node index.js", "dev": "webpack --mode development --watch", + + "start": "node index.js", + "clean": "rm -rf node_modules package-lock.json", "reinstall": "npm run clean && npm install", + "prepare": "npm run build", "prepublishOnly": "npm test && npm run lint" }, + "files": [ "dist/", "src/", @@ -79,76 +100,6 @@ "SECURITY.md", "CHANGELOG.md" ], + "types": "index.d.ts" - "keywords": [ - "cybersecurity", - "protection", - "uae", - "zayed", - "security", - "anti-tamper", - "درع-زايد", - "أمن-سيبراني", - "حماية", - "الإمارات" - ], - "author": { - "name": "Zayed CyberShield Team", - "email": "info@zayed-cybershield.ae", - "url": "https://zayed-cybershield.ae" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/zayed-cybershield/protection.git" - }, - "bugs": { - "url": "https://github.com/zayed-cybershield/protection/issues" - }, - "homepage": "https://github.com/zayed-cybershield/protection#readme", - "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" - }, - "peerDependencies": { - "react": ">=16.8.0", - "vue": ">=2.6.0" - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "build": "webpack", - "start": "webpack serve" - }, - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "build": "webpack", - "start": "webpack serve" - }, - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "build": "webpack", - "start": "webpack serve" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@walletconnect/modal": "^2.7.0", - "@walletconnect/sign-client": "^2.23.0", - "validator": "^13.15.23" - }, - "devDependencies": { - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-react": "^7.28.5", - "babel-loader": "^10.0.0", - "html-webpack-plugin": "^5.6.5", - "webpack": "^5.103.0", - "webpack-cli": "^6.0.1", - "webpack-dev-server": "^5.2.2" - } } diff --git a/src/core/engine.py b/src/core/engine.py index dd26e11..c4422a4 100644 --- a/src/core/engine.py +++ b/src/core/engine.py @@ -1,16 +1,22 @@ from modules.vulnerability_scanner import VulnerabilityScanner from modules.github_monitor import GitHubMonitor from utils.helpers import log +from utils.config_loader import load_config class Engine: def __init__(self): + self.config = load_config() log("Engine initialized.", "ENGINE") self.modules = [] def load_modules(self): log("Loading modules...", "ENGINE") - self.modules.append(VulnerabilityScanner()) - self.modules.append(GitHubMonitor()) + + if self.config["modules"]["vulnerability_scanner"]: + self.modules.append(VulnerabilityScanner()) + + if self.config["modules"]["github_monitor"]: + self.modules.append(GitHubMonitor()) def start(self): log("Starting core system...", "ENGINE") diff --git a/src/modules/github_monitor.py b/src/modules/github_monitor.py index 3a849c9..7371050 100644 --- a/src/modules/github_monitor.py +++ b/src/modules/github_monitor.py @@ -1,8 +1,46 @@ from utils.helpers import log +from utils.graphql_client import GitHubGraphQL +from utils.config_loader import load_config class GitHubMonitor: def __init__(self): log("GitHubMonitor loaded.", "MODULE") + self.client = GitHubGraphQL() + self.config = load_config() def run(self): log("Checking GitHub repository status...", "MODULE") + + repo = self.config["repository"] + + query = f""" + {{ + repository(name: "{repo.split('/')[1]}", owner: "{repo.split('/')[0]}") {{ + issues(states: OPEN) {{ + totalCount + }} + pullRequests(states: OPEN) {{ + totalCount + }} + }} + }} + """ + + result = self.client.query(query) + + # ------------------------- + # Error Handling + # ------------------------- + if "errors" in result: + log(f"GraphQL Error: {result['errors']}", "ERROR") + return + + if "data" not in result or result["data"]["repository"] is None: + log("No data returned from GitHub. Check token or repository name.", "ERROR") + return + + issues = result["data"]["repository"]["issues"]["totalCount"] + prs = result["data"]["repository"]["pullRequests"]["totalCount"] + + log(f"Open Issues: {issues}", "MODULE") + log(f"Open Pull Requests: {prs}", "MODULE") diff --git a/src/utils/config_loader.py b/src/utils/config_loader.py new file mode 100644 index 0000000..aed046a --- /dev/null +++ b/src/utils/config_loader.py @@ -0,0 +1,5 @@ +import json + +def load_config(): + with open("config.json", "r") as f: + return json.load(f) diff --git a/src/utils/graphql_client.py b/src/utils/graphql_client.py new file mode 100644 index 0000000..3404932 --- /dev/null +++ b/src/utils/graphql_client.py @@ -0,0 +1,21 @@ +import requests +from utils.config_loader import load_config + +class GitHubGraphQL: + def __init__(self): + config = load_config() + self.token = config["github_token"] + self.endpoint = "https://api.github.com/graphql" + + def query(self, query_string): + headers = { + "Authorization": f"Bearer {self.token}" + } + + response = requests.post( + self.endpoint, + json={"query": query_string}, + headers=headers + ) + + return response.json()