-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
58 lines (56 loc) · 1.31 KB
/
Copy pathmain.go
File metadata and controls
58 lines (56 loc) · 1.31 KB
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
package main
import (
"fmt"
"os"
"strings"
"time"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("usage: penetration-testing-kit <mode> [args]")
fmt.Println("modes: wordlist <file> | brute <host> | recon <host>")
os.Exit(1)
}
mode := os.Args[1]
switch mode {
case "wordlist":
if len(os.Args) < 3 {
fmt.Fprintln(os.Stderr, "need wordlist file")
os.Exit(1)
}
data, _ := os.ReadFile(os.Args[2])
lines := strings.Split(string(data), "\n")
words := 0
unique := map[string]bool{}
for _, line := range lines {
t := strings.TrimSpace(line)
if t != "" && !unique[t] {
unique[t] = true
words++
}
}
fmt.Printf("wordlist: %d unique entries\n", words)
case "brute":
host := "127.0.0.1"
if len(os.Args) > 2 {
host = os.Args[2]
}
fmt.Printf("simulating brute-force on %s (demo mode)\n", host)
for i := 0; i < 3; i++ {
fmt.Printf(" attempt %d...\n", i+1)
time.Sleep(100 * time.Millisecond)
}
fmt.Println("demo complete - no actual brute force performed")
case "recon":
host := "127.0.0.1"
if len(os.Args) > 2 {
host = os.Args[2]
}
fmt.Printf("recon target: %s\n", host)
fmt.Printf("standard ports: 22, 80, 443, 3306, 5432\n")
fmt.Println("use network-inspector for actual port scanning")
default:
fmt.Println("unknown mode:", mode)
os.Exit(1)
}
}