2020-12-29 01:17:10 -08:00
package common
import (
"flag"
2022-07-07 00:04:59 -07:00
"runtime"
"runtime/debug"
"time"
2020-12-29 01:17:10 -08:00
)
2022-07-06 06:42:00 -07:00
func init ( ) {
go func ( ) {
for {
2022-08-15 20:18:09 -07:00
GC ( )
2022-07-06 06:42:00 -07:00
time . Sleep ( 10 * time . Second )
}
} ( )
}
2022-08-15 20:18:09 -07:00
func GC ( ) {
runtime . GC ( )
debug . FreeOSMemory ( )
}
2020-12-29 01:17:10 -08:00
func Banner ( ) {
banner := `
___ _
/ _ \ ___ ___ _ __ __ _ ___ | | __
/ / _ \ / ____ / __ | / __ | ' __ / _ ` + " ` " + ` | / __ | | / /
/ / _ \ \ _____ \ __ \ ( __ | | | ( _ | | ( __ | <
\ ____ / | ___ / \ ___ | _ | \ __ , _ | \ ___ | _ | \ _ \
2022-01-06 21:38:38 -08:00
fscan version : ` + version + `
2020-12-29 01:17:10 -08:00
`
print ( 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" )
2021-09-13 21:16:01 -07:00
flag . StringVar ( & NoHosts , "hn" , "" , "the hosts no scan,as: -hn 192.168.1.1/24" )
2020-12-29 01:17:10 -08:00
flag . StringVar ( & Info . Ports , "p" , DefaultPorts , "Select a port,for example: 22 | 1-65535 | 22,80,3306" )
2021-12-07 01:01:21 -08:00
flag . StringVar ( & PortAdd , "pa" , "" , "add port base DefaultPorts,-pa 3389" )
2022-04-20 18:56:07 -07:00
flag . StringVar ( & UserAdd , "usera" , "" , "add a user base DefaultUsers,-usera user" )
flag . StringVar ( & PassAdd , "pwda" , "" , "add a password base DefaultPasses,-pwda password" )
2021-05-05 20:37:29 -07:00
flag . StringVar ( & NoPorts , "pn" , "" , "the ports no scan,as: -pn 445" )
2022-07-03 08:41:39 -07:00
flag . StringVar ( & Command , "c" , "" , "exec command (ssh)" )
flag . StringVar ( & SshKey , "sshkey" , "" , "sshkey file (id_rsa)" )
flag . StringVar ( & Domain , "domain" , "" , "smb domain" )
flag . StringVar ( & Username , "user" , "" , "username" )
flag . StringVar ( & Password , "pwd" , "" , "password" )
flag . Int64Var ( & Timeout , "time" , 3 , "Set timeout" )
flag . StringVar ( & Scantype , "m" , "all" , "Select scan type ,as: -m ssh" )
flag . StringVar ( & Path , "path" , "" , "fcgi、smb romote file path" )
2021-03-07 18:00:56 -08:00
flag . IntVar ( & Threads , "t" , 600 , "Thread nums" )
2022-01-06 21:38:38 -08:00
flag . IntVar ( & LiveTop , "top" , 10 , "show live len top" )
2021-06-29 20:07:24 -07:00
flag . StringVar ( & HostFile , "hf" , "" , "host file, -hf ip.txt" )
2021-02-04 22:43:07 -08:00
flag . StringVar ( & Userfile , "userf" , "" , "username file" )
flag . StringVar ( & Passfile , "pwdf" , "" , "password file" )
2022-04-20 02:45:27 -07:00
flag . StringVar ( & PortFile , "portf" , "" , "Port File" )
2022-04-20 18:56:07 -07:00
flag . StringVar ( & PocPath , "pocpath" , "" , "poc file path" )
2021-02-04 22:43:07 -08:00
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" )
2021-11-24 18:16:39 -08:00
flag . BoolVar ( & IsBrute , "nobr" , false , "not to Brute password" )
2022-04-20 02:45:27 -07:00
flag . IntVar ( & BruteThread , "br" , 1 , "Brute threads" )
2021-02-04 22:43:07 -08:00
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" )
2021-05-13 20:47:30 -07:00
flag . Int64Var ( & WaitTime , "debug" , 60 , "every time to LogErr" )
2021-05-13 19:43:26 -07:00
flag . BoolVar ( & Silent , "silent" , false , "silent scan" )
2022-07-02 02:25:15 -07:00
flag . BoolVar ( & PocFull , "full" , false , "poc full scan,as: shiro 100 key" )
2021-03-03 22:42:10 -08:00
flag . StringVar ( & URL , "u" , "" , "url" )
2021-03-25 00:36:21 -07:00
flag . StringVar ( & UrlFile , "uf" , "" , "urlfile" )
2021-02-04 22:43:07 -08:00
flag . StringVar ( & Pocinfo . PocName , "pocname" , "" , "use the pocs these contain pocname, -pocname weblogic" )
2022-07-03 08:41:39 -07:00
flag . StringVar ( & Proxy , "proxy" , "" , "set poc proxy, -proxy http://127.0.0.1:8080" )
2022-05-07 08:46:22 -07:00
flag . StringVar ( & Socks5Proxy , "socks5" , "" , "set socks5 proxy, will be used in tcp connection, timeout setting will not work" )
2022-07-03 08:48:06 -07:00
flag . StringVar ( & Cookie , "cookie" , "" , "set poc cookie,-cookie rememberMe=login" )
2022-07-03 08:41:39 -07:00
flag . Int64Var ( & WebTimeout , "wt" , 5 , "Set web timeout" )
2022-08-15 20:18:09 -07:00
flag . BoolVar ( & DnsLog , "dns" , false , "using dnslog poc" )
2022-07-03 08:48:06 -07:00
flag . IntVar ( & PocNum , "num" , 20 , "poc rate" )
2022-07-02 02:25:15 -07:00
flag . StringVar ( & SC , "sc" , "" , "ms17 shellcode,as -sc add" )
2020-12-29 01:17:10 -08:00
flag . Parse ( )
}