mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-06-22 02:40:49 +00:00
refactor: ScanType部分重构
This commit is contained in:
parent
02dfcebcc5
commit
77d59c1e6b
@ -236,53 +236,42 @@ func ParseInput(Info *HostInfo) {
|
||||
}
|
||||
|
||||
func ParseScantype(Info *HostInfo) {
|
||||
_, ok := PORTList[Scantype]
|
||||
if !ok {
|
||||
if _, validType := PORTList[Scantype]; !validType {
|
||||
showmode()
|
||||
return
|
||||
}
|
||||
|
||||
if Scantype != "all" && Ports == DefaultPorts+","+Webport {
|
||||
switch Scantype {
|
||||
case "wmiexec":
|
||||
Ports = "135"
|
||||
case "wmiinfo":
|
||||
Ports = "135"
|
||||
case "smbinfo":
|
||||
Ports = "445"
|
||||
case "hostname":
|
||||
Ports = "135,137,139,445"
|
||||
case "smb2":
|
||||
Ports = "445"
|
||||
case "web":
|
||||
case "web", "webonly", "webpoc":
|
||||
Ports = Webport
|
||||
case "webonly":
|
||||
Ports = Webport
|
||||
case "ms17010":
|
||||
Ports = "445"
|
||||
case "cve20200796":
|
||||
Ports = "445"
|
||||
case "portscan":
|
||||
Ports = DefaultPorts + "," + Webport
|
||||
case "main":
|
||||
Ports = DefaultPorts
|
||||
default:
|
||||
port, _ := PORTList[Scantype]
|
||||
Ports = strconv.Itoa(port)
|
||||
if port := PORTList[Scantype]; port > 0 {
|
||||
Ports = strconv.Itoa(port)
|
||||
}
|
||||
}
|
||||
fmt.Println("-m ", Scantype, " start scan the port:", Ports)
|
||||
|
||||
fmt.Printf("[*] Scan type: %s, target ports: %s\n", Scantype, Ports)
|
||||
}
|
||||
}
|
||||
|
||||
func CheckErr(text string, err error, flag bool) {
|
||||
if err != nil {
|
||||
fmt.Println("Parse", text, "error: ", err.Error())
|
||||
if flag {
|
||||
if err != ParseIPErr {
|
||||
fmt.Println(ParseIPErr)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
//func CheckErr(text string, err error, flag bool) {
|
||||
// if err != nil {
|
||||
// fmt.Println("Parse", text, "error: ", err.Error())
|
||||
// if flag {
|
||||
// if err != ParseIPErr {
|
||||
// fmt.Println(ParseIPErr)
|
||||
// }
|
||||
// os.Exit(0)
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
func showmode() {
|
||||
fmt.Println("The specified scan type does not exist")
|
||||
|
@ -15,32 +15,44 @@ var Userdict = map[string][]string{
|
||||
|
||||
var Passwords = []string{"123456", "admin", "admin123", "root", "", "pass123", "pass@123", "password", "123123", "654321", "111111", "123", "1", "admin@123", "Admin@123", "admin123!@#", "{user}", "{user}1", "{user}111", "{user}123", "{user}@123", "{user}_123", "{user}#123", "{user}@111", "{user}@2019", "{user}@123#4", "P@ssw0rd!", "P@ssw0rd", "Passw0rd", "qwe123", "12345678", "test", "test123", "123qwe", "123qwe!@#", "123456789", "123321", "666666", "a123456.", "123456~a", "123456!a", "000000", "1234567890", "8888888", "!QAZ2wsx", "1qaz2wsx", "abc123", "abc123456", "1qaz@WSX", "a11111", "a12345", "Aa1234", "Aa1234.", "Aa12345", "a123456", "a123123", "Aa123123", "Aa123456", "Aa12345.", "sysadmin", "system", "1qaz!QAZ", "2wsx@WSX", "qwe123!@#", "Aa123456!", "A123456s!", "sa123456", "1q2w3e", "Charge123", "Aa123456789"}
|
||||
var PORTList = map[string]int{
|
||||
"ftp": 21,
|
||||
"ssh": 22,
|
||||
"findnet": 135,
|
||||
"netbios": 139,
|
||||
"smb": 445,
|
||||
"mssql": 1433,
|
||||
"oracle": 1521,
|
||||
"mysql": 3306,
|
||||
"rdp": 3389,
|
||||
"psql": 5432,
|
||||
"redis": 6379,
|
||||
"fcgi": 9000,
|
||||
"mem": 11211,
|
||||
"mgo": 27017,
|
||||
"ms17010": 1000001,
|
||||
"cve20200796": 1000002,
|
||||
"web": 1000003,
|
||||
"webonly": 1000003,
|
||||
"webpoc": 1000003,
|
||||
"smb2": 1000004,
|
||||
"wmiexec": 1000005,
|
||||
"all": 0,
|
||||
"portscan": 0,
|
||||
"icmp": 0,
|
||||
"main": 0,
|
||||
// 常规服务端口
|
||||
"ftp": 21,
|
||||
"ssh": 22,
|
||||
"findnet": 135,
|
||||
"netbios": 139,
|
||||
"smb": 445,
|
||||
"mssql": 1433,
|
||||
"oracle": 1521,
|
||||
"mysql": 3306,
|
||||
"rdp": 3389,
|
||||
"psql": 5432,
|
||||
"redis": 6379,
|
||||
"fcgi": 9000,
|
||||
"mem": 11211,
|
||||
"mgo": 27017,
|
||||
|
||||
// 特定端口的扫描类型
|
||||
"wmiexec": 135,
|
||||
"wmiinfo": 135,
|
||||
"smbinfo": 445,
|
||||
"smb2": 445,
|
||||
"ms17010": 445,
|
||||
"cve20200796": 445,
|
||||
|
||||
// Web相关
|
||||
"web": 0, // 使用Webport
|
||||
"webonly": 0, // 使用Webport
|
||||
"webpoc": 0, // 使用Webport
|
||||
|
||||
// 特殊扫描类型
|
||||
"hostname": 0, // 使用135,137,139,445
|
||||
"all": 0, // 全部扫描
|
||||
"portscan": 0, // 使用DefaultPorts + Webport
|
||||
"icmp": 0, // ICMP检测
|
||||
"main": 0, // 使用DefaultPorts
|
||||
"localinfo": 0, // 本地信息收集
|
||||
}
|
||||
|
||||
var PortGroup = map[string]string{
|
||||
"ftp": "21",
|
||||
"ssh": "22",
|
||||
|
Loading…
x
Reference in New Issue
Block a user