-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrsdl.go
128 lines (99 loc) · 2.79 KB
/
rsdl.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"os"
"strconv"
"time"
"github.com/briandowns/spinner"
"github.com/sparrc/go-ping"
)
func getPing(host string) bool {
pinger, err := ping.NewPinger(host)
if err != nil {
return false
}
pinger.OnRecv = func(pkt *ping.Packet) {
}
return true
}
func check(e error) {
if e != nil {
panic(e)
}
}
func httpCheck(domain string) string {
client := http.Client{
Timeout: 4 * time.Second,
}
check, err := client.Get("http://" + domain + "/")
if err != nil {
return "N/A"
}
return strconv.Itoa(check.StatusCode)
}
func httpsCheck(domain string) string {
client := http.Client{
Timeout: 4 * time.Second,
}
check, err := client.Get("https://" + domain + "/")
if err != nil {
return "N/A"
}
return strconv.Itoa(check.StatusCode)
}
func main() {
hostname := flag.String("hostname", "", "Please input hostname")
list := flag.String("list", "lists/mini.txt", "Subdomain List")
output := flag.Bool("output", false, "Output Result")
flag.Parse()
file, err := os.Open(*list)
if err != nil {
log.Fatal(err)
}
defer file.Close()
var outputText = ""
scanner := bufio.NewScanner(file)
fmt.Println(`
██████╗ ███████╗ ██████╗ ██╗
██╔══██╗ ██╔════╝ ██╔══██╗ ██║
██████╔╝ ███████╗ ██║ ██║ ██║
██╔══██╗ ╚════██║ ██║ ██║ ██║
██║ ██║██╗███████║██╗██████╔╝██╗███████╗
╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═════╝ ╚═╝╚══════╝
R.S.D.L V2
List : ` + *list + `
Victim Host : ` + *hostname + `
`)
s := spinner.New(spinner.CharSets[31], 100*time.Millisecond)
s.Start()
s.Color("red", "bold")
for scanner.Scan() {
domain := scanner.Text() + "." + *hostname
rev := getPing(domain)
s.Restart()
s.Prefix = "Creating Requests " + domain
if rev == true {
s.Restart()
ip, _ := net.LookupIP(domain)
fmt.Printf("\n\033[1;36m%s\033[0m", "Up Domain "+domain+"\nHTTP Response Code: "+httpCheck(domain)+" \nHTTPS Response Code: "+httpsCheck(domain)+" \n")
fmt.Printf("\033[1;36m%s\033[0m", "Founded IP Adresses\n")
fmt.Println(ip)
fmt.Printf("\033[1;36m%s\033[0m", "==========================================================\n")
outputText += domain + "\n"
}
}
if *output != false {
d1 := []byte(outputText)
err := ioutil.WriteFile(*hostname, d1, 0644)
check(err)
}
s.Restart()
s.Stop()
log.Fatal("\n\n\n\nScan Finished\n Happy Hunting....")
}