/
goddos.go
62 lines (55 loc) · 1.78 KB
/
goddos.go
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
package goddos
import (
"fmt"
"net/http"
"strings"
"github.com/pilu/traffic"
)
var (
uriFragments map[string]bool
)
func init() {
uriFragments = make(map[string]bool)
uriFragments["manager/html"] = true
uriFragments["POST_ip_port.php"] = true
uriFragments["tmUnblock.cgi"] = true
uriFragments["HNAP1"] = true
uriFragments["phpMyAdmin/scripts/setup.php"] = true
uriFragments["pma/scripts/setup.php"] = true
uriFragments["myadmin/scripts/setup.php"] = true
uriFragments["MyAdmin/scripts/setup.php"] = true
uriFragments["vyvy/vyv/vy.php"] = true
uriFragments["cgi-sys/php5"] = true
uriFragments["cgi-bin/test-cgi"] = true
uriFragments["cgi-bin/printenv"] = true
uriFragments["cgi-bin/test.cgi"] = true
uriFragments["cgi-bin/test.pl"] = true
uriFragments["cgi-bin/test.sh"] = true
uriFragments["cgi-bin/teste.pl"] = true
uriFragments["cgi-bin/teste.cgi"] = true
uriFragments["cgi-bin/teste.sh"] = true
uriFragments["cgi-bin/print-env"] = true
uriFragments["cgi-bin/print.pl"] = true
uriFragments["cgi-bin/print.cgi"] = true
uriFragments["cgi-bin/printenv.sh"] = true
uriFragments["dpdp/dpd/dp.php"] = true
uriFragments["upup/upu/up.php"] = true
uriFragments["admin/fckeditor/editor/filemanager/browser/default/connectors/test.html"] = true
uriFragments["web-console/ServerInfo.jsp"] = true
uriFragments["vtigercrm"] = true
uriFragments["operator/basic.shtml"] = true
uriFragments["secure/ltx_conf.htm"] = true
uriFragments["syslog.htm"] = true
}
func main() {
}
func CheckForDdosString(w traffic.ResponseWriter, r *traffic.Request) {
for k, _ := range uriFragments {
fmt.Printf("Searching for %s in %s", k, r.RequestURI)
if strings.Contains(r.RequestURI, k) {
fmt.Printf("Found %s", k)
w.WriteHeader(http.StatusGatewayTimeout)
w.WriteText("connection timed out")
}
}
}