-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathmain.go
More file actions
54 lines (46 loc) · 1.03 KB
/
main.go
File metadata and controls
54 lines (46 loc) · 1.03 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
package main
import (
"flag"
"fmt"
"hostscan/core"
"hostscan/elog"
"hostscan/utils"
"hostscan/vars"
"os"
)
func main(){
utils.Banner()
flag.Parse()
if *vars.Version {
elog.Info(fmt.Sprintf("Current Hostscan Version: %s", vars.VersionInfo))
vars.ProcessBar.Clear()
return
}
elog.Info("Hostscan Start! Waiting for your good news...")
taskType := core.GetTaskType()
if taskType == "noip"{
elog.Error("No IP Found! Please use -i/-I to input single ip or ips in file")
vars.ProcessBar.Clear()
return
}else if taskType == "nohost"{
elog.Error("No Host Found! Please use -d/-D to input single host or hosts in file")
vars.ProcessBar.Clear()
return
}
if len(*vars.OutFile) > 0{
exist,_ := utils.PathExists(*vars.OutFile)
if exist{
_ = os.Remove(*vars.OutFile)
}
}
utils.SetUlimitMax()
err := core.Scan(taskType)
if err != nil {
elog.Error(fmt.Sprintf("Scan Failed: %v", err))
}
err = vars.ProcessBar.Finish()
if err != nil {
elog.Error(fmt.Sprintf("ProcessBar Close Failed: %v", err))
return
}
}