File size: 10,697 Bytes
d7f6772
 
 
 
 
 
68e4cd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65367e2
 
 
68e4cd5
768f946
68e4cd5
768f946
68e4cd5
768f946
68e4cd5
768f946
 
 
 
 
 
 
 
65367e2
 
 
768f946
68e4cd5
 
 
 
 
 
 
 
 
 
 
 
 
65367e2
 
68e4cd5
 
65367e2
68e4cd5
 
 
 
65367e2
68e4cd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65367e2
 
 
68e4cd5
 
 
 
 
 
 
 
 
65367e2
 
 
68e4cd5
 
 
 
 
 
 
 
 
65367e2
 
 
68e4cd5
 
 
 
 
 
 
 
 
65367e2
 
 
68e4cd5
 
65367e2
 
 
 
68e4cd5
65367e2
68e4cd5
 
65367e2
 
 
68e4cd5
 
 
 
65367e2
 
 
68e4cd5
 
 
 
65367e2
 
 
68e4cd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65367e2
 
 
 
 
 
 
 
 
 
 
68e4cd5
d7f6772
65367e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Saldırı Simülatörü</title>
    <style>
        body {
            background-color: rgb(12, 185, 228);
            color: rgb(89, 0, 233);
            font-family: 'Arial', sans-serif;
        }
        header {
            text-align: center;
            margin: 20px 0;
        }
        main {
            text-align: center;
        }
        section#attack-simulator {
            margin: 20px auto;
            width: 80%;
            max-width: 600px;
            text-align: left;
        }
        button {
            display: block;
            width: 100%;
            margin: 10px 0;
            padding: 10px;
            font-size: 16px;
            cursor: pointer;
        }
        #attack-result {
            margin-top: 20px;
        }
        /* Modal Pencere Stilleri */
        .modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgb(0,0,0);
            background-color: rgba(0,0,0,0.4);
            padding-top: 60px;
        }
        .modal-content {
            background-color: #fefefe;
            margin: 5% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
        }
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }
        .close:hover,
        .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }
        .speech-toggle {
            margin: 10px;
        }
    </style>
</head>
<body>
    <header>
        <h1>Saldırı Simülatörü</h1>
    </header>
    <main>
        <section id="attack-simulator">
            <h2>Simülasyon Senaryoları</h2>
            <button id="phishingAttack">Kimlik Avı Saldırısı</button>
            <button id="ransomwareAttack">Fidye Yazılımı Saldırısı</button>
            <button id="ddosAttack">DDoS Saldırısı</button>
            <button id="malwareAttack">Kötü Amaçlı Yazılım Saldırısı</button>
            <div id="attack-result"></div>
        </section>
        <div>
            <button id="toggleSpeech" class="speech-toggle">Sesli Açıklamayı Aç/Kapat</button>
        </div>
    </main>
    <div id="myModal" class="modal">
        <div class="modal-content">
            <span class="close">&times;</span>
            <p id="modal-text"></p>
        </div>
    </div>
    <script>
        // Web Speech API setup
        const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
        const recognition = new SpeechRecognition();
        recognition.lang = 'tr-TR';
        recognition.continuous = false;

        let speechEnabled = false; // Sesli açıklama varsayılan olarak etkin

        recognition.onresult = function(event) {
            const transcript = event.results[0][0].transcript.toLowerCase();
            console.log(`Voice command received: ${transcript}`); // Debugging
            handleVoiceCommand(transcript);
        };

        function handleVoiceCommand(command) {
            console.log(`Handling command: ${command}`); // Debugging
            if (command.includes('kimlik avı')) {
                handlePhishing();
            } else if (command.includes('fidye yazılımı')) {
                handleRansomware();
            } else if (command.includes('ddos saldırısı')) {
                handleDdos();
            } else if (command.includes('kötü amaçlı yazılım')) {
                handleMalware();
            } else {
                showModal('Geçersiz komut. Lütfen tekrar deneyin.');
            }
        }

        function startRecognition() {
            recognition.start();
        }

        document.getElementById('phishingAttack').addEventListener('click', handlePhishing);
        document.getElementById('ransomwareAttack').addEventListener('click', handleRansomware);
        document.getElementById('ddosAttack').addEventListener('click', handleDdos);
        document.getElementById('malwareAttack').addEventListener('click', handleMalware);

        function handlePhishing() {
            document.getElementById('attack-result').innerHTML = `
                <h3>Kimlik Avı Saldırısı!</h3>
                <p>Bir e-posta aldınız ve bu e-postadaki bağlantıya tıklamanız isteniyor. Ne yaparsınız?</p>
                <button onclick="handlePhishingResponse(true)">Bağlantıya Tıkla</button>
                <button onclick="handlePhishingResponse(false)">Bağlantıya Tıklama</button>
            `;
            if (speechEnabled) {
                speak('Kimlik avı saldırısı! Bir e-posta aldınız ve bu e-postadaki bağlantıya tıklamanız isteniyor. Bağlantıya tıkla veya bağlantıya tıklama seçeneklerinden birini seçin.');
            }
        }

        function handleRansomware() {
            document.getElementById('attack-result').innerHTML = `
                <h3>Fidye Yazılımı Saldırısı!</h3>
                <p>Bilgisayarınızda şüpheli bir dosya keşfettiniz ve bilgisayarınızda kilitli dosyalar var. Ne yaparsınız?</p>
                <button onclick="handleRansomwareResponse(true)">Fidyeyi Öde</button>
                <button onclick="handleRansomwareResponse(false)">Fidye Ödemeyin</button>
            `;
            if (speechEnabled) {
                speak('Fidye yazılımı saldırısı! Bilgisayarınızda şüpheli bir dosya keşfettiniz ve bilgisayarınızda kilitli dosyalar var. Fidyeyi öde veya fidye ödemeyin seçeneklerinden birini seçin.');
            }
        }

        function handleDdos() {
            document.getElementById('attack-result').innerHTML = `
                <h3>DDoS Saldırısı!</h3>
                <p>Web siteniz aşırı trafik nedeniyle yavaşlıyor. Nasıl bir tepki verirsiniz?</p>
                <button onclick="handleDdosResponse(true)">Yük Dengeleyici Kullanın</button>
                <button onclick="handleDdosResponse(false)">Sadece Bekleyin</button>
            `;
            if (speechEnabled) {
                speak('DDoS saldırısı! Web siteniz aşırı trafik nedeniyle yavaşlıyor. Yük dengeleyici kullanın veya sadece bekleyin seçeneklerinden birini seçin.');
            }
        }

        function handleMalware() {
            document.getElementById('attack-result').innerHTML = `
                <h3>Kötü Amaçlı Yazılım Saldırısı!</h3>
                <p>Bilgisayarınıza şüpheli bir yazılım yüklendi. Ne yaparsınız?</p>
                <button onclick="handleMalwareResponse(true)">Yazılımı Kaldır</button>
                <button onclick="handleMalwareResponse(false)">Yazılımı Kaldırmayın</button>
            `;
            if (speechEnabled) {
                speak('Kötü amaçlı yazılım saldırısı! Bilgisayarınıza şüpheli bir yazılım yüklendi. Yazılımı kaldır veya yazılımı kaldırmayın seçeneklerinden birini seçin.');
            }
        }

        function handlePhishingResponse(accepted) {           
            showModal(accepted            
                ? 'Bağlantıya tıkladınız ve kişisel bilgileriniz çalındı. Güvenlik önlemleri almanız gerekiyor!'
                : 'İyi bir seçim yaptınız. Bilgilerinizi korudunuz!');
            sendAnalysisData({phishing: accepted ? 1 : 0});
            
        }
        function handleRansomwareResponse(paid) {
            showModal(paid 
                ? 'Fidye ödediniz, ancak dosyalarınız hala kilitli olabilir. Yedekleme stratejilerinizi gözden geçirin.' 
                : 'Fidye ödemediğiniz için dosyalarınız kilitli kaldı. Gelecekte veri yedeklemeye özen gösterin.');
            sendAnalysisData({ransomware: paid ? 1 : 0});
        }

        function handleDdosResponse(usedLoadBalancer) {
            showModal(usedLoadBalancer 
                ? 'Yük dengeleyici kullanarak hizmetinizi korudunuz. İyi iş çıkardınız!' 
                : 'Bekleyerek sorun çözüldü, ancak bu tür saldırılara karşı önlem almanız önemlidir.');
            sendAnalysisData({ddos: usedLoadBalancer ? 1 : 0});
        }

        function handleMalwareResponse(removed) {
            showModal(removed 
                ? 'Yazılımı kaldırarak sisteminizi temiz tuttunuz. Harika!' 
                : 'Yazılımı kaldırmadığınız için sisteminiz tehlikede. Derhal yazılımı kaldırmalısınız.');
            sendAnalysisData({malware: removed ? 1 : 0});
        }

        function showModal(message) {
            const modal = document.getElementById('myModal');
            const modalText = document.getElementById('modal-text');
            const span = document.getElementsByClassName('close')[0];

            modalText.textContent = message;
            modal.style.display = 'block';

            span.onclick = function() {
                modal.style.display = 'none';
            }

            window.onclick = function(event) {
                if (event.target == modal) {
                    modal.style.display = 'none';
                }
            }
        }

        function sendAnalysisData(data) {
            fetch('/analyze', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify(data)
            })
            .then(response => response.json())
            .then(result => {
                console.log(result);
            });
        }

        function speak(message) {
            const speech = new SpeechSynthesisUtterance(message);
            speech.lang = 'tr-TR';
            window.speechSynthesis.speak(speech);
        }

        // // Ses tanıma başlatma düğmesi
        // const startRecognitionBtn = document.createElement('button');
        // startRecognitionBtn.textContent = 'Sesli Komut Başlat';
        // startRecognitionBtn.addEventListener('click', startRecognition);
        // document.body.appendChild(startRecognitionBtn);

        // Sesli açıklamayı aç/kapatma düğmesi
        document.getElementById('toggleSpeech').addEventListener('click', function() {
            speechEnabled = !speechEnabled;
            this.textContent = speechEnabled ? 'Sesli Açıklamayı Kapat' : 'Sesli Açıklamayı Aç';
        });
    </script>
</body>
</html>