mirror of https://github.com/qwqdanchun/fscan.git
update
This commit is contained in:
parent
9d385eb26a
commit
936c1f5395
|
@ -1,11 +1,9 @@
|
|||
package Plugins
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/jlaffaye/ftp"
|
||||
"github.com/shadow1ng/fscan/common"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
|
|
@ -55,7 +55,7 @@ func GetSys() SystemInfo {
|
|||
|
||||
func IcmpCheck(hostslist []string) {
|
||||
TmpHosts := make(map[string]struct{})
|
||||
var chanHosts = make(chan string)
|
||||
var chanHosts = make(chan string, len(hostslist))
|
||||
conn, err := icmp.ListenPacket("ip4:icmp", "0.0.0.0")
|
||||
endflag := false
|
||||
if err != nil {
|
||||
|
@ -76,7 +76,7 @@ func IcmpCheck(hostslist []string) {
|
|||
|
||||
go func() {
|
||||
for ip := range chanHosts {
|
||||
if _, ok := TmpHosts[ip]; !ok {
|
||||
if _, ok := TmpHosts[ip]; !ok && IsContain(hostslist, ip) {
|
||||
TmpHosts[ip] = struct{}{}
|
||||
if common.Silent == false {
|
||||
fmt.Printf("(icmp) Target '%s' is alive\n", ip)
|
||||
|
@ -90,10 +90,25 @@ func IcmpCheck(hostslist []string) {
|
|||
write(host, conn)
|
||||
}
|
||||
|
||||
if len(hostslist) > 255 {
|
||||
time.Sleep(6 * time.Second)
|
||||
} else {
|
||||
time.Sleep(3 * time.Second)
|
||||
//根据hosts数量修改icmp监听时间
|
||||
start := time.Now()
|
||||
for {
|
||||
if len(AliveHosts) == len(hostslist) {
|
||||
break
|
||||
}
|
||||
since := time.Now().Sub(start)
|
||||
var wait time.Duration
|
||||
switch {
|
||||
case len(hostslist) < 30:
|
||||
wait = time.Second * 1
|
||||
case len(hostslist) <= 256:
|
||||
wait = time.Second * 3
|
||||
default:
|
||||
wait = time.Second * 5
|
||||
}
|
||||
if since > wait {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
endflag = true
|
||||
|
|
|
@ -34,8 +34,8 @@ func PortScan(hostslist []string, ports string, timeout int64) []string {
|
|||
probePorts = tmpPorts
|
||||
}
|
||||
workers := common.Threads
|
||||
Addrs := make(chan Addr)
|
||||
results := make(chan string)
|
||||
Addrs := make(chan Addr, len(hostslist)*len(probePorts))
|
||||
results := make(chan string, len(hostslist)*len(probePorts))
|
||||
var wg sync.WaitGroup
|
||||
|
||||
//接收结果
|
||||
|
|
|
@ -27,6 +27,7 @@ func Flag(Info *HostInfo) {
|
|||
flag.StringVar(&Info.Password, "pwd", "", "password")
|
||||
flag.Int64Var(&Info.Timeout, "time", 3, "Set timeout")
|
||||
flag.StringVar(&Info.Scantype, "m", "all", "Select scan type ,as: -m ssh")
|
||||
flag.StringVar(&Info.Path, "path", "", "fcgi、smb romote file path")
|
||||
flag.IntVar(&Threads, "t", 600, "Thread nums")
|
||||
flag.StringVar(&HostFile, "hf", "", "host file, -hs ip.txt")
|
||||
flag.StringVar(&Userfile, "userf", "", "username file")
|
||||
|
@ -47,5 +48,6 @@ func Flag(Info *HostInfo) {
|
|||
flag.StringVar(&Pocinfo.Cookie, "cookie", "", "set poc cookie")
|
||||
flag.Int64Var(&Pocinfo.Timeout, "wt", 5, "Set web timeout")
|
||||
flag.IntVar(&Pocinfo.Num, "num", 20, "poc rate")
|
||||
flag.StringVar(&SC, "sc", "", "ms17 sc,as -sc x86add -sc x64add")
|
||||
flag.Parse()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue