forked from cckuailong/hostscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
60 lines (49 loc) · 1.11 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
package main
import (
"hostscan/core"
"hostscan/elog"
"hostscan/utils"
"hostscan/vars"
"flag"
"fmt"
"os"
)
func main(){
utils.Banner()
utils.SetUlimitMax()
flag.Parse()
if *vars.Version {
elog.Info(fmt.Sprintf("Current hostscan version: %s", vars.VersionInfo))
return
}
if len(*vars.Ip) > 0 {
vars.Ips = append(vars.Ips, *vars.Ip)
}else if len(*vars.IpFile) > 0 {
tmp_ips := utils.Readlines(*vars.IpFile)
for _, tmp_ip := range tmp_ips{
vars.Ips = append(vars.Ips, tmp_ip)
}
}
if len(vars.Ips) == 0 {
elog.Error("No IP Found! Please use -i/-I to input single ip or ips in file")
return
}
if len(*vars.Host) > 0 {
vars.Hosts = append(vars.Hosts, *vars.Host)
}else if len(*vars.HostFile) > 0 {
tmp_hosts := utils.Readlines(*vars.HostFile)
for _, tmp_host := range tmp_hosts{
vars.Hosts = append(vars.Hosts, tmp_host)
}
}
if len(vars.Hosts) == 0 {
elog.Error("No Host Found! Please use -d/-D to input single host or hosts in file")
return
}
exist,_ := utils.PathExists(*vars.OutFile)
if exist{
_ = os.Remove(*vars.OutFile)
}
core.Scan()
vars.ProcessBar.Finish()
}