{"id":15066255,"url":"https://github.com/ebrasha/abdal-xss-ai-engine","last_synced_at":"2026-03-09T04:04:43.306Z","repository":{"id":256436748,"uuid":"855305882","full_name":"ebrasha/abdal-xss-ai-engine","owner":"ebrasha","description":"Abdal XSS AI Engine is an AI-powered tool designed to detect and prevent XSS attacks using deep learning and TF-IDF for feature extraction","archived":false,"fork":false,"pushed_at":"2025-05-08T08:08:53.000Z","size":67426,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T06:42:52.624Z","etag":null,"topics":["abdal","abdal-security-group","ai","artificial-intelligence","attack","ebrahim-shafiei","ebrasha","security","tensorflow","xss","xss-ai-engine"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ebrasha.png","metadata":{"files":{"readme":"README.fa.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-10T16:48:10.000Z","updated_at":"2025-05-08T08:08:57.000Z","dependencies_parsed_at":"2025-05-08T09:35:01.736Z","dependency_job_id":null,"html_url":"https://github.com/ebrasha/abdal-xss-ai-engine","commit_stats":null,"previous_names":["ebrasha/abdal-xss-ai-engine"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ebrasha/abdal-xss-ai-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrasha%2Fabdal-xss-ai-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrasha%2Fabdal-xss-ai-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrasha%2Fabdal-xss-ai-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrasha%2Fabdal-xss-ai-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ebrasha","download_url":"https://codeload.github.com/ebrasha/abdal-xss-ai-engine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ebrasha%2Fabdal-xss-ai-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30282581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abdal","abdal-security-group","ai","artificial-intelligence","attack","ebrahim-shafiei","ebrasha","security","tensorflow","xss","xss-ai-engine"],"created_at":"2024-09-25T01:04:25.717Z","updated_at":"2026-03-09T04:04:42.584Z","avatar_url":"https://github.com/ebrasha.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Abdal XSS AI Engine\n\n## 🎤 ترجمه اطلاعات نرم افزار\n- [English](README.md)\n- [فارسی](README.fa.md)\n\n \n\u003cp align=\"center\"\u003e\u003cimg src=\"scr.jpg?raw=true\"\u003e\u003c/p\u003e\n\n\n## 💎 هدف اصلی\nمدل هوش مصنوعی  Abdal XSS AI Engine با هدف ارائه یک راهکار پیشرفته و رایگان برای مقابله با حملات XSS در ایران توسعه داده شده است. با توجه به نبود ابزارهای مناسب سایبری داخلی، این مدل به عنوان یک نیاز ضروری برای افزایش امنیت در فضای سایبری ایران طراحی شده تا از حملات XSS جلوگیری کند و کاربران ایرانی بتوانند از حفاظت بهتری برخوردار شوند.\n\n\n## 🛠️ پیش نیاز برای برنامه نویسان\n- **Python 3.7 یا بالاتر**\n- **Flask** (برای ساخت RESTful API)\n- **TensorFlow** (مدل‌های یادگیری عمیق)\n- **Scikit-learn** (برای پیش‌پردازش داده‌های متنی و بردار سازی TF-IDF)\n- **Pandas** (برای مدیریت داده‌ها در مقیاس بزرگ)\n- **درک عمیق از امنیت وب و حملات XSS**\n- **Git** (کنترل نسخه و مدیریت مخازن)\n\n\n### 🔥 پیشنیازها\n\n- **Python 3.7 یا بالاتر**\n- **Flask**\n- **TensorFlow**\n- **Scikit-learn**\n- **Pandas**\n- **Pickle**\n\n\n## ✨ قابلیت ها\n\n- قابلیت پردازش صدها هزار الگوی XSS و شناسایی حملات جدید.\n- استفاده از مدل یادگیری عمیق با چند لایه Dense و Dropout.\n- آموزش مدل با استفاده از مجموعه داده ترکیبی از فایل‌های CSV.\n- استفاده از تکنیک TF-IDF برای استخراج ویژگی‌های متنی از حملات XSS.\n- قابلیت افزایش دقت مدل با داده‌های جدید و به‌روز رسانی مداوم.\n- پشتیبانی از بهینه‌سازی مدل با استفاده از روش Adam و معیار دقت (accuracy).\n- ذخیره مدل نهایی و وکتورایزر برای استفاده در آینده و استقرار در محیط‌های مختلف.\n\n\n## 📝️ چگونه کار می کند ؟\n\nبا استفاده از کد زیر می‌توانید از مدل به صورت یک API برای شناسایی حملات XSS استفاده کنید\n\n```python\nfrom flask import Flask, request, jsonify\nimport tensorflow as tf\nimport pickle\nimport numpy as np\n\napp = Flask(__name__)\n\n# Load the model and vectorizer\nmodel = tf.keras.models.load_model('Abdal_XSS_AI_Engine.h5')\nwith open('vectorizer.pkl', 'rb') as f:\n    vectorizer = pickle.load(f)\n\n\n@app.route('/predict', methods=['POST'])\ndef predict():\n    data = request.json\n    sentences = data['sentences']\n\n    # Preprocess the input data using the vectorizer\n    X_new = vectorizer.transform(sentences).toarray()\n\n    # Make predictions\n    predictions = (model.predict(X_new) \u003e 0.5).astype(int)\n\n    # Prepare and return the response\n    response = {\n        'predictions': ['XSS Detected' if pred == 1 else 'No XSS Detected' for pred in predictions.flatten()]\n    }\n    return jsonify(response)\n\n\nif __name__ == '__main__':\n    app.run(debug=True)\n\n```\nعلاوه بر API، می‌توانید از مدل برای خواندن داده‌ها از یک فایل متنی و شناسایی حملات استفاده کنید. کد زیر نمونه‌ای از این استفاده است:\n\n```python\nimport os\nimport tensorflow as tf\nimport pickle\n\n# Disable oneDNN custom operations\nos.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'\n# Set TensorFlow logging level to 'ERROR' to suppress the info and warning messages\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'\n\n# Check if model and vectorizer files exist\nmodel_path = 'Abdal_XSS_AI_Engine.keras'\nvectorizer_path = 'vectorizer.pkl'\n\nif not os.path.exists(model_path):\n    raise FileNotFoundError(f\"Model file not found: {model_path}\")\nif not os.path.exists(vectorizer_path):\n    raise FileNotFoundError(f\"Vectorizer file not found: {vectorizer_path}\")\n\n# Load the model from the Keras format\nmodel_name = \"Abdal XSS AI Engine\"\nmodel = tf.keras.models.load_model(model_path)\n\n# Load the vectorizer\nwith open(vectorizer_path, 'rb') as f:\n    vectorizer = pickle.load(f)\n\n# Read new data (sentences) from a file (e.g., 'attack-xss-payload.txt')\ninput_file = 'attack-xss-payload.txt'\nif not os.path.exists(input_file):\n    raise FileNotFoundError(f\"Input file not found: {input_file}\")\n\nwith open(input_file, 'r', encoding='utf-8') as file:\n    new_sentences = [line.strip() for line in file if line.strip()]  # Reading each line from file\n\n# Check if any sentence exists for prediction\nif not new_sentences:\n    raise ValueError(\"No data available for prediction.\")\n\n# Preprocess the new data using the loaded TF-IDF vectorizer\nX_new = vectorizer.transform(new_sentences).toarray()\n\n# Predict using the loaded model\npredictions = (model.predict(X_new) \u003e 0.5).astype(int)\n\n# Print predictions\nfor i, sentence in enumerate(new_sentences):\n    print(f\"Sentence: {sentence}\")\n    print(f\"Prediction: {'XSS Detected' if predictions[i] == 1 else 'No XSS Detected'}\\n\")\n\n```\n## ❤️ کمک به پروژه\n\nhttps://alphajet.ir/abdal-donation\n\n## 🤵 برنامه نویس\nدست ساز با عشق توسط ابراهیم شفیعی (ابراشا)\n\nE-Mail = Prof.Shafiei@Gmail.com\n\nTelegram: https://t.me/ProfShafiei\n\n## ☠️ گزارش خطا\n\nاگر با مشکلی در پیکربندی مواجه هستید یا چیزی آنطور که انتظار دارید کار نمی‌کند، لطفا از Prof.Shafiei@Gmail.com استفاده کنید.طرح مشکلات بر روی  GitLab یا Github نیز پذیرفته می‌شوند.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febrasha%2Fabdal-xss-ai-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febrasha%2Fabdal-xss-ai-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febrasha%2Fabdal-xss-ai-engine/lists"}