mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-13 21:02:44 +08:00
ftp默认列出前5个目录
This commit is contained in:
parent
df45b07ce8
commit
fbf480b3a8
@ -30,10 +30,25 @@ func FtpConn(info *common.HostInfo, user string, pass string) (flag bool, err er
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
err = conn.Login(Username, Password)
|
err = conn.Login(Username, Password)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
defer conn.Logout()
|
|
||||||
result := fmt.Sprintf("FTP:%v:%v:%v %v", Host, Port, Username, Password)
|
|
||||||
common.LogSuccess(result)
|
|
||||||
flag = true
|
flag = true
|
||||||
|
result := fmt.Sprintf("FTP:%v:%v:%v %v", Host, Port, Username, Password)
|
||||||
|
dirs, err := conn.List("")
|
||||||
|
//defer conn.Logout()
|
||||||
|
if err == nil {
|
||||||
|
if len(dirs) > 0 {
|
||||||
|
for i := 0; i < len(dirs); i++ {
|
||||||
|
if len(dirs[i].Name) > 50 {
|
||||||
|
result += "\n [->]" + dirs[i].Name[:50]
|
||||||
|
} else {
|
||||||
|
result += "\n [->]" + dirs[i].Name
|
||||||
|
}
|
||||||
|
if i == 5 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
common.LogSuccess(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return flag, err
|
return flag, err
|
||||||
|
@ -17,6 +17,9 @@ func Scan(info common.HostInfo) {
|
|||||||
Hosts = ICMPRun(Hosts, info.IcmpThreads, info.Ping)
|
Hosts = ICMPRun(Hosts, info.IcmpThreads, info.Ping)
|
||||||
fmt.Println("icmp alive hosts len is:", len(Hosts))
|
fmt.Println("icmp alive hosts len is:", len(Hosts))
|
||||||
}
|
}
|
||||||
|
if info.Scantype == "icmp" {
|
||||||
|
return
|
||||||
|
}
|
||||||
AlivePorts := TCPportScan(Hosts, info.Ports, info.Timeout)
|
AlivePorts := TCPportScan(Hosts, info.Ports, info.Timeout)
|
||||||
if info.Scantype == "portscan" {
|
if info.Scantype == "portscan" {
|
||||||
return
|
return
|
||||||
@ -32,13 +35,13 @@ func Scan(info common.HostInfo) {
|
|||||||
if info.Scantype == "all" {
|
if info.Scantype == "all" {
|
||||||
if IsContain(severports, info.Ports) {
|
if IsContain(severports, info.Ports) {
|
||||||
AddScan(info.Ports, info, ch, &wg)
|
AddScan(info.Ports, info, ch, &wg)
|
||||||
|
} else if info.Ports == "445" { //scan more vul
|
||||||
|
AddScan("1000001", info, ch, &wg)
|
||||||
|
AddScan("1000002", info, ch, &wg)
|
||||||
} else {
|
} else {
|
||||||
AddScan("1000003", info, ch, &wg) //webtitle
|
AddScan("1000003", info, ch, &wg) //webtitle
|
||||||
}
|
}
|
||||||
if info.Ports == "445" { //scan more vul
|
|
||||||
AddScan("1000001", info, ch, &wg)
|
|
||||||
AddScan("1000002", info, ch, &wg)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
port, _ := common.PortlistBack[info.Scantype]
|
port, _ := common.PortlistBack[info.Scantype]
|
||||||
scantype := strconv.Itoa(port)
|
scantype := strconv.Itoa(port)
|
||||||
|
@ -94,7 +94,11 @@ func ParseInput(Info *HostInfo) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
if Info.Outputfile != "" {
|
if Info.Outputfile != "" {
|
||||||
Outputfile = Info.Outputfile
|
if !strings.Contains(Outputfile, "/") && !strings.Contains(Outputfile, `\`) {
|
||||||
|
Outputfile = getpath() + Info.Outputfile
|
||||||
|
} else {
|
||||||
|
Outputfile = Info.Outputfile
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if Info.IsSave == true {
|
if Info.IsSave == true {
|
||||||
IsSave = false
|
IsSave = false
|
||||||
@ -116,6 +120,10 @@ func ParseScantype(Info *HostInfo) {
|
|||||||
switch Info.Scantype {
|
switch Info.Scantype {
|
||||||
case "webtitle":
|
case "webtitle":
|
||||||
Info.Ports = "80,81,443,7001,8000,8080,8089,9200"
|
Info.Ports = "80,81,443,7001,8000,8080,8089,9200"
|
||||||
|
case "ms17010":
|
||||||
|
Info.Ports = "445"
|
||||||
|
case "cve20200796":
|
||||||
|
Info.Ports = "445"
|
||||||
case "portscan":
|
case "portscan":
|
||||||
default:
|
default:
|
||||||
port, _ := PORTList[Info.Scantype]
|
port, _ := PORTList[Info.Scantype]
|
||||||
@ -132,3 +140,18 @@ func CheckErr(text string, err error) {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getpath() string {
|
||||||
|
filename := os.Args[0]
|
||||||
|
var path string
|
||||||
|
if strings.Contains(filename, "/") {
|
||||||
|
tmp := strings.Split(filename, `/`)
|
||||||
|
tmp[len(tmp)-1] = ``
|
||||||
|
path = strings.Join(tmp, `/`)
|
||||||
|
} else if strings.Contains(filename, `\`) {
|
||||||
|
tmp := strings.Split(filename, `\`)
|
||||||
|
tmp[len(tmp)-1] = ``
|
||||||
|
path = strings.Join(tmp, `\`)
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
@ -29,6 +29,7 @@ var PORTList = map[string]int{
|
|||||||
"findnet": 135,
|
"findnet": 135,
|
||||||
"all": 0,
|
"all": 0,
|
||||||
"portscan": 0,
|
"portscan": 0,
|
||||||
|
"icmp": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
var PortlistBack = map[string]int{
|
var PortlistBack = map[string]int{
|
||||||
@ -48,9 +49,11 @@ var PortlistBack = map[string]int{
|
|||||||
"findnet": 135,
|
"findnet": 135,
|
||||||
"all": 0,
|
"all": 0,
|
||||||
"portscan": 0,
|
"portscan": 0,
|
||||||
|
"icmp": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
var Outputfile = "result.txt"
|
var Outputfile = getpath() + "result.txt"
|
||||||
|
|
||||||
var IsSave = true
|
var IsSave = true
|
||||||
|
|
||||||
var DefaultPorts = "21,22,80,81,135,443,445,1433,3306,5432,6379,7001,8000,8080,8089,9200,11211,27017"
|
var DefaultPorts = "21,22,80,81,135,443,445,1433,3306,5432,6379,7001,8000,8080,8089,9200,11211,27017"
|
||||||
|
@ -23,7 +23,7 @@ func Flag(Info *HostInfo) {
|
|||||||
flag.StringVar(&Info.Ports, "p", DefaultPorts, "Select a port,for example: 22 | 1-65535 | 22,80,3306")
|
flag.StringVar(&Info.Ports, "p", DefaultPorts, "Select a port,for example: 22 | 1-65535 | 22,80,3306")
|
||||||
flag.StringVar(&Info.Command, "c", "", "exec command (ssh)")
|
flag.StringVar(&Info.Command, "c", "", "exec command (ssh)")
|
||||||
flag.IntVar(&Info.Threads, "t", 200, "Thread nums")
|
flag.IntVar(&Info.Threads, "t", 200, "Thread nums")
|
||||||
flag.IntVar(&Info.IcmpThreads, "it", 11000, "Icmp Threads nums")
|
flag.IntVar(&Info.IcmpThreads, "it", 3300, "Icmp Threads nums")
|
||||||
flag.BoolVar(&Info.Isping, "np", false, "not to ping")
|
flag.BoolVar(&Info.Isping, "np", false, "not to ping")
|
||||||
flag.BoolVar(&Info.Ping, "ping", false, "using ping replace icmp")
|
flag.BoolVar(&Info.Ping, "ping", false, "using ping replace icmp")
|
||||||
flag.BoolVar(&Info.IsSave, "no", false, "not to save output log")
|
flag.BoolVar(&Info.IsSave, "no", false, "not to save output log")
|
||||||
|
Loading…
Reference in New Issue
Block a user