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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "7d3cbbee",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stdout",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"Requirement already satisfied: flask in c:\\users\\hp\\anaconda3\\lib\\site-packages (2.2.5)\n",
|
| 14 |
+
"Collecting django\n",
|
| 15 |
+
" Downloading Django-5.0.7-py3-none-any.whl.metadata (4.1 kB)\n",
|
| 16 |
+
"Requirement already satisfied: pandas in c:\\users\\hp\\anaconda3\\lib\\site-packages (2.1.4)\n",
|
| 17 |
+
"Requirement already satisfied: numpy in c:\\users\\hp\\anaconda3\\lib\\site-packages (1.26.4)\n",
|
| 18 |
+
"Requirement already satisfied: scikit-learn in c:\\users\\hp\\anaconda3\\lib\\site-packages (1.2.2)\n",
|
| 19 |
+
"Requirement already satisfied: matplotlib in c:\\users\\hp\\anaconda3\\lib\\site-packages (3.8.0)\n",
|
| 20 |
+
"Requirement already satisfied: seaborn in c:\\users\\hp\\anaconda3\\lib\\site-packages (0.12.2)\n",
|
| 21 |
+
"Requirement already satisfied: Werkzeug>=2.2.2 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from flask) (2.2.3)\n",
|
| 22 |
+
"Requirement already satisfied: Jinja2>=3.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from flask) (3.1.3)\n",
|
| 23 |
+
"Requirement already satisfied: itsdangerous>=2.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from flask) (2.0.1)\n",
|
| 24 |
+
"Requirement already satisfied: click>=8.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from flask) (8.1.7)\n",
|
| 25 |
+
"Collecting asgiref<4,>=3.7.0 (from django)\n",
|
| 26 |
+
" Downloading asgiref-3.8.1-py3-none-any.whl.metadata (9.3 kB)\n",
|
| 27 |
+
"Collecting sqlparse>=0.3.1 (from django)\n",
|
| 28 |
+
" Downloading sqlparse-0.5.1-py3-none-any.whl.metadata (3.9 kB)\n",
|
| 29 |
+
"Requirement already satisfied: tzdata in c:\\users\\hp\\anaconda3\\lib\\site-packages (from django) (2023.3)\n",
|
| 30 |
+
"Requirement already satisfied: python-dateutil>=2.8.2 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from pandas) (2.8.2)\n",
|
| 31 |
+
"Requirement already satisfied: pytz>=2020.1 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from pandas) (2023.3.post1)\n",
|
| 32 |
+
"Requirement already satisfied: scipy>=1.3.2 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from scikit-learn) (1.11.4)\n",
|
| 33 |
+
"Requirement already satisfied: joblib>=1.1.1 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from scikit-learn) (1.2.0)\n",
|
| 34 |
+
"Requirement already satisfied: threadpoolctl>=2.0.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from scikit-learn) (2.2.0)\n",
|
| 35 |
+
"Requirement already satisfied: contourpy>=1.0.1 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (1.2.0)\n",
|
| 36 |
+
"Requirement already satisfied: cycler>=0.10 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (0.11.0)\n",
|
| 37 |
+
"Requirement already satisfied: fonttools>=4.22.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (4.25.0)\n",
|
| 38 |
+
"Requirement already satisfied: kiwisolver>=1.0.1 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (1.4.4)\n",
|
| 39 |
+
"Requirement already satisfied: packaging>=20.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (23.1)\n",
|
| 40 |
+
"Requirement already satisfied: pillow>=6.2.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (10.2.0)\n",
|
| 41 |
+
"Requirement already satisfied: pyparsing>=2.3.1 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from matplotlib) (3.0.9)\n",
|
| 42 |
+
"Requirement already satisfied: colorama in c:\\users\\hp\\anaconda3\\lib\\site-packages (from click>=8.0->flask) (0.4.6)\n",
|
| 43 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from Jinja2>=3.0->flask) (2.1.3)\n",
|
| 44 |
+
"Requirement already satisfied: six>=1.5 in c:\\users\\hp\\anaconda3\\lib\\site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n",
|
| 45 |
+
"Downloading Django-5.0.7-py3-none-any.whl (8.2 MB)\n",
|
| 46 |
+
" ---------------------------------------- 0.0/8.2 MB ? eta -:--:--\n",
|
| 47 |
+
" ---------------------------------------- 0.0/8.2 MB ? eta -:--:--\n",
|
| 48 |
+
" ---------------------------------------- 0.0/8.2 MB 667.8 kB/s eta 0:00:13\n",
|
| 49 |
+
" ---------------------------------------- 0.1/8.2 MB 880.9 kB/s eta 0:00:10\n",
|
| 50 |
+
" --------------------------------------- 0.2/8.2 MB 1.0 MB/s eta 0:00:08\n",
|
| 51 |
+
" - -------------------------------------- 0.2/8.2 MB 1.3 MB/s eta 0:00:07\n",
|
| 52 |
+
" - -------------------------------------- 0.3/8.2 MB 1.4 MB/s eta 0:00:06\n",
|
| 53 |
+
" -- ------------------------------------- 0.5/8.2 MB 1.6 MB/s eta 0:00:05\n",
|
| 54 |
+
" -- ------------------------------------- 0.6/8.2 MB 1.9 MB/s eta 0:00:05\n",
|
| 55 |
+
" --- ------------------------------------ 0.7/8.2 MB 2.0 MB/s eta 0:00:04\n",
|
| 56 |
+
" ---- ----------------------------------- 0.8/8.2 MB 2.2 MB/s eta 0:00:04\n",
|
| 57 |
+
" ----- ---------------------------------- 1.0/8.2 MB 2.3 MB/s eta 0:00:04\n",
|
| 58 |
+
" ----- ---------------------------------- 1.2/8.2 MB 2.3 MB/s eta 0:00:04\n",
|
| 59 |
+
" ------ --------------------------------- 1.3/8.2 MB 2.5 MB/s eta 0:00:03\n",
|
| 60 |
+
" ------ --------------------------------- 1.3/8.2 MB 2.4 MB/s eta 0:00:03\n",
|
| 61 |
+
" -------- ------------------------------- 1.7/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 62 |
+
" -------- ------------------------------- 1.8/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 63 |
+
" --------- ------------------------------ 1.8/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 64 |
+
" --------- ------------------------------ 2.0/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 65 |
+
" ---------- ----------------------------- 2.1/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 66 |
+
" ----------- ---------------------------- 2.3/8.2 MB 2.6 MB/s eta 0:00:03\n",
|
| 67 |
+
" ----------- ---------------------------- 2.4/8.2 MB 2.7 MB/s eta 0:00:03\n",
|
| 68 |
+
" ------------ --------------------------- 2.6/8.2 MB 2.7 MB/s eta 0:00:03\n",
|
| 69 |
+
" ------------- -------------------------- 2.7/8.2 MB 2.7 MB/s eta 0:00:02\n",
|
| 70 |
+
" -------------- ------------------------- 2.9/8.2 MB 2.8 MB/s eta 0:00:02\n",
|
| 71 |
+
" -------------- ------------------------- 3.0/8.2 MB 2.8 MB/s eta 0:00:02\n",
|
| 72 |
+
" --------------- ------------------------ 3.2/8.2 MB 2.8 MB/s eta 0:00:02\n",
|
| 73 |
+
" ---------------- ----------------------- 3.3/8.2 MB 2.8 MB/s eta 0:00:02\n",
|
| 74 |
+
" ---------------- ----------------------- 3.4/8.2 MB 2.8 MB/s eta 0:00:02\n",
|
| 75 |
+
" ----------------- ---------------------- 3.6/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 76 |
+
" ------------------ --------------------- 3.7/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 77 |
+
" ------------------ --------------------- 3.9/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 78 |
+
" ------------------- -------------------- 4.0/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 79 |
+
" -------------------- ------------------- 4.2/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 80 |
+
" -------------------- ------------------- 4.3/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 81 |
+
" --------------------- ------------------ 4.4/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 82 |
+
" ---------------------- ----------------- 4.6/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 83 |
+
" ----------------------- ---------------- 4.7/8.2 MB 2.9 MB/s eta 0:00:02\n",
|
| 84 |
+
" ----------------------- ---------------- 4.9/8.2 MB 3.0 MB/s eta 0:00:02\n",
|
| 85 |
+
" ------------------------ --------------- 5.1/8.2 MB 3.0 MB/s eta 0:00:02\n",
|
| 86 |
+
" ------------------------- -------------- 5.2/8.2 MB 3.0 MB/s eta 0:00:02\n",
|
| 87 |
+
" -------------------------- ------------- 5.4/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 88 |
+
" -------------------------- ------------- 5.5/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 89 |
+
" --------------------------- ------------ 5.7/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 90 |
+
" ---------------------------- ----------- 5.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 91 |
+
" ---------------------------- ----------- 5.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 92 |
+
" ---------------------------- ----------- 5.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 93 |
+
" ---------------------------- ----------- 5.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 94 |
+
" ---------------------------- ----------- 5.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 95 |
+
" ---------------------------- ----------- 5.8/8.2 MB 2.7 MB/s eta 0:00:01\n",
|
| 96 |
+
" -------------------------------- ------- 6.6/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 97 |
+
" --------------------------------- ------ 6.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 98 |
+
" --------------------------------- ------ 6.9/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 99 |
+
" ---------------------------------- ----- 7.1/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 100 |
+
" ----------------------------------- ---- 7.2/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 101 |
+
" ------------------------------------ --- 7.4/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 102 |
+
" ------------------------------------ --- 7.5/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 103 |
+
" ------------------------------------- -- 7.7/8.2 MB 3.1 MB/s eta 0:00:01\n",
|
| 104 |
+
" -------------------------------------- - 7.8/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 105 |
+
" -------------------------------------- - 8.0/8.2 MB 3.0 MB/s eta 0:00:01\n",
|
| 106 |
+
" --------------------------------------- 8.1/8.2 MB 3.1 MB/s eta 0:00:01\n",
|
| 107 |
+
" --------------------------------------- 8.2/8.2 MB 3.1 MB/s eta 0:00:01\n",
|
| 108 |
+
" ---------------------------------------- 8.2/8.2 MB 3.0 MB/s eta 0:00:00\n",
|
| 109 |
+
"Downloading asgiref-3.8.1-py3-none-any.whl (23 kB)\n",
|
| 110 |
+
"Downloading sqlparse-0.5.1-py3-none-any.whl (44 kB)\n",
|
| 111 |
+
" ---------------------------------------- 0.0/44.2 kB ? eta -:--:--\n",
|
| 112 |
+
" ---------------------------------------- 44.2/44.2 kB 2.3 MB/s eta 0:00:00\n",
|
| 113 |
+
"Installing collected packages: sqlparse, asgiref, django\n",
|
| 114 |
+
"Successfully installed asgiref-3.8.1 django-5.0.7 sqlparse-0.5.1\n",
|
| 115 |
+
"Note: you may need to restart the kernel to use updated packages.\n"
|
| 116 |
+
]
|
| 117 |
+
}
|
| 118 |
+
],
|
| 119 |
+
"source": [
|
| 120 |
+
"pip install flask django pandas numpy scikit-learn matplotlib seaborn"
|
| 121 |
+
]
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"cell_type": "code",
|
| 125 |
+
"execution_count": 4,
|
| 126 |
+
"id": "b10855d7",
|
| 127 |
+
"metadata": {},
|
| 128 |
+
"outputs": [],
|
| 129 |
+
"source": [
|
| 130 |
+
"!mkdir cyber_security_platform\n",
|
| 131 |
+
"!cd cyber_security_platform\n"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"cell_type": "code",
|
| 136 |
+
"execution_count": 5,
|
| 137 |
+
"id": "e5086d9d",
|
| 138 |
+
"metadata": {},
|
| 139 |
+
"outputs": [
|
| 140 |
+
{
|
| 141 |
+
"name": "stderr",
|
| 142 |
+
"output_type": "stream",
|
| 143 |
+
"text": [
|
| 144 |
+
"'touch' is not recognized as an internal or external command,\n",
|
| 145 |
+
"operable program or batch file.\n"
|
| 146 |
+
]
|
| 147 |
+
}
|
| 148 |
+
],
|
| 149 |
+
"source": [
|
| 150 |
+
"!mkdir app\n",
|
| 151 |
+
"!cd app\n",
|
| 152 |
+
"!touch app.py\n"
|
| 153 |
+
]
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"cell_type": "code",
|
| 157 |
+
"execution_count": 6,
|
| 158 |
+
"id": "d1e4f020",
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"outputs": [],
|
| 161 |
+
"source": [
|
| 162 |
+
"with open('app/app.py', 'w') as file:\n",
|
| 163 |
+
" pass\n"
|
| 164 |
+
]
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"cell_type": "code",
|
| 168 |
+
"execution_count": 7,
|
| 169 |
+
"id": "b20bd431",
|
| 170 |
+
"metadata": {},
|
| 171 |
+
"outputs": [
|
| 172 |
+
{
|
| 173 |
+
"name": "stdout",
|
| 174 |
+
"output_type": "stream",
|
| 175 |
+
"text": [
|
| 176 |
+
" * Serving Flask app '__main__'\n",
|
| 177 |
+
" * Debug mode: on\n"
|
| 178 |
+
]
|
| 179 |
+
},
|
| 180 |
+
{
|
| 181 |
+
"name": "stderr",
|
| 182 |
+
"output_type": "stream",
|
| 183 |
+
"text": [
|
| 184 |
+
"WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n",
|
| 185 |
+
" * Running on http://127.0.0.1:5000\n",
|
| 186 |
+
"Press CTRL+C to quit\n",
|
| 187 |
+
" * Restarting with watchdog (windowsapi)\n"
|
| 188 |
+
]
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"ename": "SystemExit",
|
| 192 |
+
"evalue": "1",
|
| 193 |
+
"output_type": "error",
|
| 194 |
+
"traceback": [
|
| 195 |
+
"An exception has occurred, use %tb to see the full traceback.\n",
|
| 196 |
+
"\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 1\n"
|
| 197 |
+
]
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"name": "stderr",
|
| 201 |
+
"output_type": "stream",
|
| 202 |
+
"text": [
|
| 203 |
+
"C:\\Users\\HP\\anaconda3\\Lib\\site-packages\\IPython\\core\\interactiveshell.py:3561: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
|
| 204 |
+
" warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
|
| 205 |
+
]
|
| 206 |
+
}
|
| 207 |
+
],
|
| 208 |
+
"source": [
|
| 209 |
+
"# app/app.py\n",
|
| 210 |
+
"from flask import Flask, render_template\n",
|
| 211 |
+
"import os\n",
|
| 212 |
+
"\n",
|
| 213 |
+
"app = Flask(__name__)\n",
|
| 214 |
+
"\n",
|
| 215 |
+
"@app.route('/')\n",
|
| 216 |
+
"def home():\n",
|
| 217 |
+
" return render_template('index.html')\n",
|
| 218 |
+
"\n",
|
| 219 |
+
"if __name__ == '__main__':\n",
|
| 220 |
+
" app.run(debug=True)\n"
|
| 221 |
+
]
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"cell_type": "code",
|
| 225 |
+
"execution_count": 9,
|
| 226 |
+
"id": "42b7cab8",
|
| 227 |
+
"metadata": {},
|
| 228 |
+
"outputs": [],
|
| 229 |
+
"source": [
|
| 230 |
+
"import os\n",
|
| 231 |
+
"\n",
|
| 232 |
+
"# Dizinlerin oluşturulması\n",
|
| 233 |
+
"os.makedirs('app/templates', exist_ok=True)\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"# HTML dosyasının oluşturulması ve içeriğin yazılması\n",
|
| 236 |
+
"html_content = '''<!DOCTYPE html>\n",
|
| 237 |
+
"<html lang=\"en\">\n",
|
| 238 |
+
"<head>\n",
|
| 239 |
+
" <meta charset=\"UTF-8\">\n",
|
| 240 |
+
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n",
|
| 241 |
+
" <title>Cyber Security Platform</title>\n",
|
| 242 |
+
"</head>\n",
|
| 243 |
+
"<body>\n",
|
| 244 |
+
" <h1>Welcome to the Cyber Security Platform</h1>\n",
|
| 245 |
+
"</body>\n",
|
| 246 |
+
"</html>'''\n",
|
| 247 |
+
"\n",
|
| 248 |
+
"with open('app/templates/index.html', 'w') as file:\n",
|
| 249 |
+
" file.write(html_content)\n"
|
| 250 |
+
]
|
| 251 |
+
},
|
| 252 |
+
{
|
| 253 |
+
"cell_type": "code",
|
| 254 |
+
"execution_count": 12,
|
| 255 |
+
"id": "55cdc427",
|
| 256 |
+
"metadata": {},
|
| 257 |
+
"outputs": [
|
| 258 |
+
{
|
| 259 |
+
"name": "stdout",
|
| 260 |
+
"output_type": "stream",
|
| 261 |
+
"text": [
|
| 262 |
+
" * Serving Flask app '__main__'\n",
|
| 263 |
+
" * Debug mode: on\n"
|
| 264 |
+
]
|
| 265 |
+
},
|
| 266 |
+
{
|
| 267 |
+
"name": "stderr",
|
| 268 |
+
"output_type": "stream",
|
| 269 |
+
"text": [
|
| 270 |
+
"WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n",
|
| 271 |
+
" * Running on all addresses (0.0.0.0)\n",
|
| 272 |
+
" * Running on http://127.0.0.1:5000\n",
|
| 273 |
+
" * Running on http://192.168.1.41:5000\n",
|
| 274 |
+
"Press CTRL+C to quit\n",
|
| 275 |
+
" * Restarting with watchdog (windowsapi)\n"
|
| 276 |
+
]
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
"ename": "SystemExit",
|
| 280 |
+
"evalue": "1",
|
| 281 |
+
"output_type": "error",
|
| 282 |
+
"traceback": [
|
| 283 |
+
"An exception has occurred, use %tb to see the full traceback.\n",
|
| 284 |
+
"\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 1\n"
|
| 285 |
+
]
|
| 286 |
+
}
|
| 287 |
+
],
|
| 288 |
+
"source": [
|
| 289 |
+
"# Flask uygulaması için gerekli kodlar\n",
|
| 290 |
+
"from flask import Flask, render_template\n",
|
| 291 |
+
"\n",
|
| 292 |
+
"app = Flask(__name__)\n",
|
| 293 |
+
"\n",
|
| 294 |
+
"@app.route('/')\n",
|
| 295 |
+
"def home():\n",
|
| 296 |
+
" return render_template('index.html')\n",
|
| 297 |
+
"\n",
|
| 298 |
+
"if __name__ == '__main__':\n",
|
| 299 |
+
" app.run(debug=True,host='0.0.0.0')\n"
|
| 300 |
+
]
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"cell_type": "code",
|
| 304 |
+
"execution_count": 13,
|
| 305 |
+
"id": "82916f51",
|
| 306 |
+
"metadata": {},
|
| 307 |
+
"outputs": [],
|
| 308 |
+
"source": [
|
| 309 |
+
"!python app/app.py\n"
|
| 310 |
+
]
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"cell_type": "code",
|
| 314 |
+
"execution_count": null,
|
| 315 |
+
"id": "b9c19efa",
|
| 316 |
+
"metadata": {},
|
| 317 |
+
"outputs": [],
|
| 318 |
+
"source": []
|
| 319 |
+
}
|
| 320 |
+
],
|
| 321 |
+
"metadata": {
|
| 322 |
+
"kernelspec": {
|
| 323 |
+
"display_name": "Python 3 (ipykernel)",
|
| 324 |
+
"language": "python",
|
| 325 |
+
"name": "python3"
|
| 326 |
+
},
|
| 327 |
+
"language_info": {
|
| 328 |
+
"codemirror_mode": {
|
| 329 |
+
"name": "ipython",
|
| 330 |
+
"version": 3
|
| 331 |
+
},
|
| 332 |
+
"file_extension": ".py",
|
| 333 |
+
"mimetype": "text/x-python",
|
| 334 |
+
"name": "python",
|
| 335 |
+
"nbconvert_exporter": "python",
|
| 336 |
+
"pygments_lexer": "ipython3",
|
| 337 |
+
"version": "3.11.7"
|
| 338 |
+
}
|
| 339 |
+
},
|
| 340 |
+
"nbformat": 4,
|
| 341 |
+
"nbformat_minor": 5
|
| 342 |
+
}
|
app.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# coding: utf-8
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
from flask import Flask, render_template, jsonify
|
| 6 |
+
import random
|
| 7 |
+
|
| 8 |
+
# Dizinlerin oluşturulması
|
| 9 |
+
os.makedirs('cyber_security_platform/app/templates', exist_ok=True)
|
| 10 |
+
|
| 11 |
+
# HTML dosyasının oluşturulması ve içeriğin yazılması
|
| 12 |
+
html_content = '''<!DOCTYPE html>
|
| 13 |
+
<html lang="en">
|
| 14 |
+
<head>
|
| 15 |
+
<meta charset="UTF-8">
|
| 16 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 17 |
+
<title>Cyber Security Platform</title>
|
| 18 |
+
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
|
| 19 |
+
</head>
|
| 20 |
+
<body>
|
| 21 |
+
<header>
|
| 22 |
+
<h1>Cyber Security AI Simulation</h1>
|
| 23 |
+
<nav>
|
| 24 |
+
<ul>
|
| 25 |
+
<li><a href="#about">About</a></li>
|
| 26 |
+
<li><a href="#features">Features</a></li>
|
| 27 |
+
<li><a href="#contact">Contact</a></li>
|
| 28 |
+
</ul>
|
| 29 |
+
</nav>
|
| 30 |
+
</header>
|
| 31 |
+
<main>
|
| 32 |
+
<section id="about">
|
| 33 |
+
<h2>About the Simulation</h2>
|
| 34 |
+
<p>Welcome to the Cyber Security AI Simulation. This platform is designed to help you learn and practice cyber security techniques using the power of artificial intelligence.</p>
|
| 35 |
+
</section>
|
| 36 |
+
<section id="features">
|
| 37 |
+
<h2>Features</h2>
|
| 38 |
+
<ul>
|
| 39 |
+
<li>Real-time threat detection</li>
|
| 40 |
+
<li>Interactive learning modules</li>
|
| 41 |
+
<li>AI-driven security analysis</li>
|
| 42 |
+
</ul>
|
| 43 |
+
</section>
|
| 44 |
+
<section id="start-simulation">
|
| 45 |
+
<h2>Start the Simulation</h2>
|
| 46 |
+
<button onclick="startSimulation()">Start Simulation</button>
|
| 47 |
+
<div id="simulation-result"></div>
|
| 48 |
+
</section>
|
| 49 |
+
</main>
|
| 50 |
+
<footer>
|
| 51 |
+
<p>© 2024 Cyber Security AI Simulation. All rights reserved.</p>
|
| 52 |
+
</footer>
|
| 53 |
+
<script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
|
| 54 |
+
</body>
|
| 55 |
+
</html>'''
|
| 56 |
+
|
| 57 |
+
with open('cyber_security_platform/app/templates/index.html', 'w') as file:
|
| 58 |
+
file.write(html_content)
|
| 59 |
+
|
| 60 |
+
# Flask uygulaması için gerekli kodlar
|
| 61 |
+
app = Flask(__name__)
|
| 62 |
+
|
| 63 |
+
# Tehdit türlerini belirleme işlevi
|
| 64 |
+
def generate_threat():
|
| 65 |
+
threats = [
|
| 66 |
+
"DDoS Attack",
|
| 67 |
+
"Data Breach",
|
| 68 |
+
"Malware Infection",
|
| 69 |
+
"Phishing Attempt",
|
| 70 |
+
"SQL Injection"
|
| 71 |
+
]
|
| 72 |
+
return random.choice(threats)
|
| 73 |
+
|
| 74 |
+
@app.route('/')
|
| 75 |
+
def home():
|
| 76 |
+
return render_template('index.html')
|
| 77 |
+
|
| 78 |
+
@app.route('/start_simulation')
|
| 79 |
+
def start_simulation():
|
| 80 |
+
detected_threat = generate_threat()
|
| 81 |
+
return jsonify(result=detected_threat)
|
| 82 |
+
|
| 83 |
+
if __name__ == '__main__':
|
| 84 |
+
app.run(debug=True, host='0.0.0.0')
|