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) {
|
func ParseScantype(Info *HostInfo) {
|
||||||
_, ok := PORTList[Scantype]
|
if _, validType := PORTList[Scantype]; !validType {
|
||||||
if !ok {
|
|
||||||
showmode()
|
showmode()
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if Scantype != "all" && Ports == DefaultPorts+","+Webport {
|
if Scantype != "all" && Ports == DefaultPorts+","+Webport {
|
||||||
switch Scantype {
|
switch Scantype {
|
||||||
case "wmiexec":
|
|
||||||
Ports = "135"
|
|
||||||
case "wmiinfo":
|
|
||||||
Ports = "135"
|
|
||||||
case "smbinfo":
|
|
||||||
Ports = "445"
|
|
||||||
case "hostname":
|
case "hostname":
|
||||||
Ports = "135,137,139,445"
|
Ports = "135,137,139,445"
|
||||||
case "smb2":
|
case "web", "webonly", "webpoc":
|
||||||
Ports = "445"
|
|
||||||
case "web":
|
|
||||||
Ports = Webport
|
Ports = Webport
|
||||||
case "webonly":
|
|
||||||
Ports = Webport
|
|
||||||
case "ms17010":
|
|
||||||
Ports = "445"
|
|
||||||
case "cve20200796":
|
|
||||||
Ports = "445"
|
|
||||||
case "portscan":
|
case "portscan":
|
||||||
Ports = DefaultPorts + "," + Webport
|
Ports = DefaultPorts + "," + Webport
|
||||||
case "main":
|
case "main":
|
||||||
Ports = DefaultPorts
|
Ports = DefaultPorts
|
||||||
default:
|
default:
|
||||||
port, _ := PORTList[Scantype]
|
if port := PORTList[Scantype]; port > 0 {
|
||||||
Ports = strconv.Itoa(port)
|
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) {
|
//func CheckErr(text string, err error, flag bool) {
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
fmt.Println("Parse", text, "error: ", err.Error())
|
// fmt.Println("Parse", text, "error: ", err.Error())
|
||||||
if flag {
|
// if flag {
|
||||||
if err != ParseIPErr {
|
// if err != ParseIPErr {
|
||||||
fmt.Println(ParseIPErr)
|
// fmt.Println(ParseIPErr)
|
||||||
}
|
// }
|
||||||
os.Exit(0)
|
// os.Exit(0)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
func showmode() {
|
func showmode() {
|
||||||
fmt.Println("The specified scan type does not exist")
|
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 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{
|
var PORTList = map[string]int{
|
||||||
"ftp": 21,
|
// 常规服务端口
|
||||||
"ssh": 22,
|
"ftp": 21,
|
||||||
"findnet": 135,
|
"ssh": 22,
|
||||||
"netbios": 139,
|
"findnet": 135,
|
||||||
"smb": 445,
|
"netbios": 139,
|
||||||
"mssql": 1433,
|
"smb": 445,
|
||||||
"oracle": 1521,
|
"mssql": 1433,
|
||||||
"mysql": 3306,
|
"oracle": 1521,
|
||||||
"rdp": 3389,
|
"mysql": 3306,
|
||||||
"psql": 5432,
|
"rdp": 3389,
|
||||||
"redis": 6379,
|
"psql": 5432,
|
||||||
"fcgi": 9000,
|
"redis": 6379,
|
||||||
"mem": 11211,
|
"fcgi": 9000,
|
||||||
"mgo": 27017,
|
"mem": 11211,
|
||||||
"ms17010": 1000001,
|
"mgo": 27017,
|
||||||
"cve20200796": 1000002,
|
|
||||||
"web": 1000003,
|
// 特定端口的扫描类型
|
||||||
"webonly": 1000003,
|
"wmiexec": 135,
|
||||||
"webpoc": 1000003,
|
"wmiinfo": 135,
|
||||||
"smb2": 1000004,
|
"smbinfo": 445,
|
||||||
"wmiexec": 1000005,
|
"smb2": 445,
|
||||||
"all": 0,
|
"ms17010": 445,
|
||||||
"portscan": 0,
|
"cve20200796": 445,
|
||||||
"icmp": 0,
|
|
||||||
"main": 0,
|
// 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{
|
var PortGroup = map[string]string{
|
||||||
"ftp": "21",
|
"ftp": "21",
|
||||||
"ssh": "22",
|
"ssh": "22",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user