mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
修改icmp发包模式,更适合大规模探测。
修改报错提示,--debug时,如果10秒内没有LogSuccess的消息,每隔10秒就会打印一下当前进度
This commit is contained in:
+10
-9
@@ -28,8 +28,8 @@ func ParseUser(Info *HostInfo) {
|
||||
Userdict[name] = Info.Usernames
|
||||
}
|
||||
}
|
||||
if Info.Userfile != "" {
|
||||
uesrs, err := Readfile(Info.Userfile)
|
||||
if Userfile != "" {
|
||||
uesrs, err := Readfile(Userfile)
|
||||
if err == nil {
|
||||
for _, uesr := range uesrs {
|
||||
if uesr != "" {
|
||||
@@ -54,8 +54,8 @@ func ParsePass(Info *HostInfo) {
|
||||
}
|
||||
Passwords = Info.Passwords
|
||||
}
|
||||
if Info.Passfile != "" {
|
||||
passs, err := Readfile(Info.Passfile)
|
||||
if Passfile != "" {
|
||||
passs, err := Readfile(Passfile)
|
||||
if err == nil {
|
||||
for _, pass := range passs {
|
||||
if pass != "" {
|
||||
@@ -88,19 +88,20 @@ func Readfile(filename string) ([]string, error) {
|
||||
}
|
||||
|
||||
func ParseInput(Info *HostInfo) {
|
||||
if Info.Host == "" && Info.HostFile == "" {
|
||||
if Info.Host == "" && HostFile == "" {
|
||||
fmt.Println("Host is none")
|
||||
flag.Usage()
|
||||
os.Exit(0)
|
||||
}
|
||||
if Info.Outputfile != "" {
|
||||
//LogErr = Info.Debug
|
||||
if TmpOutputfile != "" {
|
||||
if !strings.Contains(Outputfile, "/") && !strings.Contains(Outputfile, `\`) {
|
||||
Outputfile = getpath() + Info.Outputfile
|
||||
Outputfile = getpath() + TmpOutputfile
|
||||
} else {
|
||||
Outputfile = Info.Outputfile
|
||||
Outputfile = TmpOutputfile
|
||||
}
|
||||
}
|
||||
if Info.IsSave == true {
|
||||
if TmpSave == true {
|
||||
IsSave = false
|
||||
}
|
||||
}
|
||||
|
||||
+25
-27
@@ -53,38 +53,23 @@ var PortlistBack = map[string]int{
|
||||
}
|
||||
|
||||
var Outputfile = getpath() + "result.txt"
|
||||
|
||||
var IsSave = true
|
||||
|
||||
var DefaultPorts = "21,22,80,81,135,443,445,1433,3306,5432,6379,7001,8000,8080,8089,9200,11211,27017"
|
||||
|
||||
type HostInfo struct {
|
||||
Host string
|
||||
HostFile string
|
||||
Ports string
|
||||
Domain string
|
||||
Url string
|
||||
Timeout int64
|
||||
WebTimeout int64
|
||||
Scantype string
|
||||
Ping bool
|
||||
Isping bool
|
||||
Threads int
|
||||
IcmpThreads int
|
||||
Command string
|
||||
Username string
|
||||
Password string
|
||||
Userfile string
|
||||
Passfile string
|
||||
Usernames []string
|
||||
Passwords []string
|
||||
Outputfile string
|
||||
IsSave bool
|
||||
RedisFile string
|
||||
RedisShell string
|
||||
IsWebCan bool
|
||||
Debug bool
|
||||
PocInfo PocInfo
|
||||
Host string
|
||||
Ports string
|
||||
Domain string
|
||||
Url string
|
||||
Timeout int64
|
||||
WebTimeout int64
|
||||
Scantype string
|
||||
Command string
|
||||
Username string
|
||||
Password string
|
||||
Usernames []string
|
||||
Passwords []string
|
||||
}
|
||||
|
||||
type PocInfo struct {
|
||||
@@ -102,3 +87,16 @@ type PocInfo struct {
|
||||
ApiKey string
|
||||
CeyeDomain string
|
||||
}
|
||||
|
||||
var TmpOutputfile string
|
||||
var TmpSave bool
|
||||
var IsPing bool
|
||||
var Ping bool
|
||||
var Pocinfo PocInfo
|
||||
var IsWebCan bool
|
||||
var RedisFile string
|
||||
var RedisShell string
|
||||
var Userfile string
|
||||
var Passfile string
|
||||
var HostFile string
|
||||
var Threads int
|
||||
|
||||
+16
-17
@@ -11,7 +11,7 @@ func Banner() {
|
||||
/ /_\/____/ __|/ __| '__/ _` + "`" + ` |/ __| |/ /
|
||||
/ /_\\_____\__ \ (__| | | (_| | (__| <
|
||||
\____/ |___/\___|_| \__,_|\___|_|\_\
|
||||
fscan version: 1.4.2
|
||||
fscan version: 1.4.3
|
||||
`
|
||||
print(banner)
|
||||
}
|
||||
@@ -19,30 +19,29 @@ func Banner() {
|
||||
func Flag(Info *HostInfo) {
|
||||
Banner()
|
||||
flag.StringVar(&Info.Host, "h", "", "IP address of the host you want to scan,for example: 192.168.11.11 | 192.168.11.11-255 | 192.168.11.11,192.168.11.12")
|
||||
flag.StringVar(&Info.HostFile, "hf", "", "host file, -hs ip.txt")
|
||||
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.IntVar(&Info.Threads, "t", 200, "Thread nums")
|
||||
flag.IntVar(&Info.IcmpThreads, "it", 1100, "Icmp Threads nums")
|
||||
flag.BoolVar(&Info.Isping, "np", false, "not to ping")
|
||||
flag.BoolVar(&Info.Ping, "ping", false, "using ping replace icmp")
|
||||
flag.BoolVar(&Info.IsSave, "no", false, "not to save output log")
|
||||
flag.StringVar(&Info.Domain, "domain", "", "smb domain")
|
||||
flag.StringVar(&Info.Username, "user", "", "username")
|
||||
flag.StringVar(&Info.Userfile, "userf", "", "username file")
|
||||
flag.StringVar(&Info.Password, "pwd", "", "password")
|
||||
flag.StringVar(&Info.Passfile, "pwdf", "", "password file")
|
||||
flag.StringVar(&Info.Outputfile, "o", "result.txt", "Outputfile")
|
||||
flag.Int64Var(&Info.Timeout, "time", 3, "Set timeout")
|
||||
flag.BoolVar(&Info.Debug, "debug", false, "debug mode will print more error info")
|
||||
flag.Int64Var(&Info.WebTimeout, "wt", 3, "Set web timeout")
|
||||
flag.StringVar(&Info.Scantype, "m", "all", "Select scan type ,as: -m ssh")
|
||||
flag.StringVar(&Info.RedisFile, "rf", "", "redis file to write sshkey file (as: -rf id_rsa.pub) ")
|
||||
flag.StringVar(&Info.RedisShell, "rs", "", "redis shell to write cron file (as: -rs 192.168.1.1:6666) ")
|
||||
|
||||
flag.BoolVar(&Info.IsWebCan, "nopoc", false, "not to scan web vul")
|
||||
flag.StringVar(&Info.PocInfo.PocName, "pocname", "", "use the pocs these contain pocname, -pocname weblogic")
|
||||
flag.StringVar(&Info.PocInfo.Proxy, "proxy", "", "set poc proxy, -proxy http://127.0.0.1:8080")
|
||||
flag.IntVar(&Info.PocInfo.Num, "Num", 20, "poc rate")
|
||||
flag.IntVar(&Threads, "t", 200, "Thread nums")
|
||||
flag.StringVar(&HostFile, "hf", "", "host file, -hs ip.txt")
|
||||
flag.StringVar(&Userfile, "userf", "", "username file")
|
||||
flag.StringVar(&Passfile, "pwdf", "", "password file")
|
||||
flag.StringVar(&RedisFile, "rf", "", "redis file to write sshkey file (as: -rf id_rsa.pub) ")
|
||||
flag.StringVar(&RedisShell, "rs", "", "redis shell to write cron file (as: -rs 192.168.1.1:6666) ")
|
||||
flag.BoolVar(&IsWebCan, "nopoc", false, "not to scan web vul")
|
||||
flag.BoolVar(&IsPing, "np", false, "not to ping")
|
||||
flag.BoolVar(&Ping, "ping", false, "using ping replace icmp")
|
||||
flag.StringVar(&TmpOutputfile, "o", "result.txt", "Outputfile")
|
||||
flag.BoolVar(&TmpSave, "no", false, "not to save output log")
|
||||
flag.BoolVar(&LogErr, "debug", false, "debug mode will print more error info")
|
||||
flag.StringVar(&Pocinfo.PocName, "pocname", "", "use the pocs these contain pocname, -pocname weblogic")
|
||||
flag.StringVar(&Pocinfo.Proxy, "proxy", "", "set poc proxy, -proxy http://127.0.0.1:8080")
|
||||
flag.IntVar(&Pocinfo.Num, "Num", 20, "poc rate")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
@@ -3,14 +3,19 @@ package common
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
var Results = make(chan string)
|
||||
var Woker = 0
|
||||
var Start = true
|
||||
var LogSucTime int64
|
||||
var LogErr bool
|
||||
var LogErrTime int64
|
||||
|
||||
func LogSuccess(result string) {
|
||||
Woker++
|
||||
LogSucTime = time.Now().Unix()
|
||||
if Start {
|
||||
go SaveLog()
|
||||
Start = false
|
||||
@@ -50,3 +55,12 @@ func WaitSave() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func LogError(errinfo interface{}) {
|
||||
if LogErr {
|
||||
if (time.Now().Unix()-LogSucTime) > 10 && (time.Now().Unix()-LogErrTime) > 10 {
|
||||
fmt.Println(errinfo)
|
||||
LogErrTime = time.Now().Unix()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user