-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
73 lines (64 loc) · 2.1 KB
/
main.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
package main
import (
"flag"
"fmt"
"ipmap/modules"
"ipmap/tools"
"strconv"
"strings"
)
var (
domain = flag.String("d", "", "domain parameter")
asn = flag.String("asn", "", "asn parameter")
ip = flag.String("ip", "", "ip parameter")
timeout = flag.Int("t", 0, "timeout parameter")
con = flag.Bool("c", false, "continue parameter")
export = flag.Bool("export", false, "export parameter")
DomainTitle string
)
func main() {
flag.Parse()
if (*asn != "" && *ip != "") || (*asn == "" && *ip == "") {
fmt.Println("======================================================\n" +
" ipmap v1.0 (github.com/sercanarga/ipmap)\n" +
"======================================================\n" +
"PARAMETERS:\n" +
"-asn AS13335\n" +
"-ip 103.21.244.0/22,103.22.200.0/22\n" +
"-d example.com\n" +
"-t 200 (timout default:auto)\n" +
"--c (work until finish scanning)\n" +
"--export (auto export results)\n\n" +
"USAGES:\n" +
"Finding sites by scanning all the IP blocks\nipmap -ip 103.21.244.0/22,103.22.200.0/22\n\n" +
"Finding real IP address of site by scanning given IP addresses\nipmap -ip 103.21.244.0/22,103.22.200.0/22 -d example.com\n\n" +
"Finding sites by scanning all the IP blocks in the ASN\nipmap -asn AS13335\n\n" +
"Finding real IP address of site by scanning all IP blocks in ASN\nipmap -asn AS13335 -d example.com")
return
}
if *timeout == 0 && *domain == "" {
fmt.Println("Timeout parameter( -t ) is not set. By entering the domain, you can have it calculated automatically.")
return
}
if *domain != "" {
getDomain := modules.GetDomainTitle(*domain)
if len(getDomain) == 0 {
fmt.Println("Domain not resolved.")
return
}
DomainTitle = getDomain[0]
if *timeout == 0 {
resolveTime, _ := strconv.Atoi(getDomain[1])
*timeout = ((resolveTime * 15) / 100) + resolveTime
}
}
if *ip != "" {
splitIP := strings.Split(*ip, ",")
tools.FindIP(splitIP, *domain, DomainTitle, *con, *export, *timeout)
return
}
if *asn != "" {
tools.FindASN(*asn, *domain, DomainTitle, *con, *export, *timeout)
return
}
}