mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-07-14 05:12:36 +08:00
update
This commit is contained in:
parent
38fc6dd0c3
commit
cdbd1aebc2
@ -131,7 +131,7 @@ func MS17010Scan(info *common.HostInfo) {
|
||||
}
|
||||
|
||||
} else {
|
||||
result := fmt.Sprintf("%s\t \t(%s)\n", ip, os)
|
||||
result := fmt.Sprintf("%s (%s)", ip, os)
|
||||
common.LogSuccess(result)
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ func IsContain(items []string, item string) bool {
|
||||
}
|
||||
|
||||
func Scan(info *common.HostInfo) {
|
||||
Hosts,_ := common.ParseIP(info.Host)
|
||||
Hosts,_ := common.ParseIP(info.Host,info.HostFile)
|
||||
if info.Isping == false{
|
||||
Hosts = ICMPRun(Hosts)
|
||||
}
|
||||
@ -72,9 +72,6 @@ func Scan(info *common.HostInfo) {
|
||||
port,_:=common.PORTList[info.Scantype]
|
||||
scantype = strconv.Itoa(port)
|
||||
AddScan(scantype,info,ch,&wg)
|
||||
//wg.Add(1)
|
||||
//go scan_func(PluginList,scantype,info,ch,&wg)
|
||||
//ch <- 1
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
|
@ -15,7 +15,6 @@ Loop:
|
||||
for _,user:=range common.Userdict["smb"]{
|
||||
for _,pass:=range common.Passwords{
|
||||
pass = strings.Replace(pass, "{user}", string(user), -1)
|
||||
//fmt.Println(user,pass)
|
||||
//flag,err := SmblConn(info,user,pass)
|
||||
flag,err := doWithTimeOut(info,user,pass)
|
||||
//fmt.Println(user,pass,flag,err)
|
||||
|
@ -36,13 +36,13 @@ func geturl(info *common.HostInfo) (err error, result string) {
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
re :=regexp.MustCompile("<title>(.*)</title>")
|
||||
find := re.FindAllStringSubmatch(string(body),-1)
|
||||
if len(find) > 1{
|
||||
if len(find) > 0{
|
||||
title = find[0][1]
|
||||
}else {
|
||||
title = "None"
|
||||
}
|
||||
if len(title) > 20{
|
||||
title = title[:20]
|
||||
if len(title) > 50{
|
||||
title = title[:50]
|
||||
}
|
||||
if resp.StatusCode == 400 && string(url[5]) != "https"{
|
||||
info.Url = strings.Replace(url, "http://", "https://", 1)
|
||||
|
@ -38,6 +38,8 @@ fscan.exe -h 192.168.1.1/24 -m ms17010 (指定模块)
|
||||
exec command (ssh)
|
||||
-h string
|
||||
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
|
||||
-hf string
|
||||
host file, -hs ip.txt
|
||||
-m string
|
||||
Select scan type ,as: -m ssh (default "all")
|
||||
-no
|
||||
@ -64,6 +66,7 @@ fscan.exe -h 192.168.1.1/24 -m ms17010 (指定模块)
|
||||
username
|
||||
-userf string
|
||||
username file
|
||||
|
||||
```
|
||||
|
||||
## 运行截图
|
||||
@ -79,6 +82,11 @@ fscan.exe -h 192.168.1.1/24 -m ms17010 (指定模块)
|
||||
`fscan.exe -h 192.168.x.x -c "whoami;id" (ssh 命令)`
|
||||

|
||||
|
||||
|
||||
## 最近更新
|
||||
2020/11/15
|
||||
[+] 支持ip以文件导入,-hs ip.txt
|
||||
|
||||
## 未来计划
|
||||
[*] 增加内网常见高危漏洞
|
||||
[*] 增加高危web漏洞扫描
|
||||
|
@ -74,7 +74,7 @@ func Readfile(filename string)([]string,error){
|
||||
file, err := os.Open(filename)
|
||||
if err!=nil{
|
||||
fmt.Println("Open %s error, %v", filename,err)
|
||||
return nil,err
|
||||
os.Exit(0)
|
||||
}
|
||||
defer file.Close()
|
||||
var content []string
|
||||
@ -92,7 +92,7 @@ func Readfile(filename string)([]string,error){
|
||||
|
||||
|
||||
func ParseInput(Info *HostInfo){
|
||||
if Info.Host==""{
|
||||
if Info.Host=="" && Info.HostFile ==""{
|
||||
fmt.Println("Host is none")
|
||||
flag.Usage()
|
||||
os.Exit(0)
|
||||
@ -124,3 +124,11 @@ func ParseScantype(Info *HostInfo){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func CheckErr(text string,err error){
|
||||
if err!=nil{
|
||||
fmt.Println(text,err.Error())
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
@ -1,21 +1,57 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var ParseIPErr error =errors.New("host parsing error\n" +
|
||||
var ParseIPErr =errors.New("host parsing error\n" +
|
||||
"format: \n"+
|
||||
"192.168.1.1/24\n"+
|
||||
"192.168.1.1\n" +
|
||||
"192.168.1.1/8\n"+
|
||||
"192.168.1.1/16\n"+
|
||||
"192.168.1.1/24\n"+
|
||||
"192.168.1.1,192.168.1.2\n" +
|
||||
"192.168.1.1-255")
|
||||
|
||||
func ParseIP(ip string)([]string,error){
|
||||
func ParseIP(ip string,filename string)(hosts []string,err error){
|
||||
|
||||
if ip != ""{
|
||||
hosts,err = ParseIPs(ip)
|
||||
}
|
||||
if filename != ""{
|
||||
var filehost []string
|
||||
filehost,_ = Readipfile(filename)
|
||||
hosts = append(hosts,filehost...)
|
||||
}
|
||||
hosts = RemoveDuplicate(hosts)
|
||||
return hosts,err
|
||||
}
|
||||
|
||||
func ParseIPs(ip string)(hosts []string,err error){
|
||||
if strings.Contains(ip,","){
|
||||
IPList:=strings.Split(ip,",")
|
||||
var ips []string
|
||||
for _,ip:=range IPList{
|
||||
ips,err = ParseIPone(ip)
|
||||
CheckErr(ip,err)
|
||||
hosts = append(hosts,ips...)
|
||||
}
|
||||
return hosts,err
|
||||
}else {
|
||||
hosts,err = ParseIPone(ip)
|
||||
CheckErr(ip,err)
|
||||
return hosts,err
|
||||
}
|
||||
}
|
||||
|
||||
func ParseIPone(ip string)([]string,error){
|
||||
reg:=regexp.MustCompile(`[a-zA-Z]+`)
|
||||
switch {
|
||||
case strings.Contains(ip[len(ip)-3:len(ip)],"/24"):
|
||||
@ -24,8 +60,6 @@ func ParseIP(ip string)([]string,error){
|
||||
return ParseIPD(ip)
|
||||
case strings.Contains(ip[len(ip)-2:len(ip)],"/8"):
|
||||
return ParseIPE(ip)
|
||||
case strings.Contains(ip,","):
|
||||
return ParseIPB(ip)
|
||||
case strings.Count(ip,"-")==1:
|
||||
return ParseIPC(ip)
|
||||
case reg.MatchString(ip):
|
||||
@ -42,7 +76,6 @@ func ParseIP(ip string)([]string,error){
|
||||
return []string{ip},nil
|
||||
}
|
||||
}
|
||||
|
||||
//Parsing CIDR IP
|
||||
func ParseIPA(ip string)([]string,error){
|
||||
realIP:=ip[:len(ip)-3]
|
||||
@ -129,3 +162,38 @@ func ParseIPE(ip string)([]string,error){
|
||||
}
|
||||
return AllIP,nil
|
||||
}
|
||||
|
||||
func Readipfile(filename string)([]string,error){
|
||||
file, err := os.Open(filename)
|
||||
if err!=nil{
|
||||
fmt.Println("Open %s error, %v", filename,err)
|
||||
os.Exit(0)
|
||||
}
|
||||
defer file.Close()
|
||||
var content []string
|
||||
scanner := bufio.NewScanner(file)
|
||||
scanner.Split(bufio.ScanLines)
|
||||
for scanner.Scan() {
|
||||
text := strings.TrimSpace(scanner.Text())
|
||||
if text != "" {
|
||||
host,err := ParseIPs(text)
|
||||
CheckErr(text,err)
|
||||
content=append(content,host...)
|
||||
}
|
||||
}
|
||||
return content,nil
|
||||
}
|
||||
|
||||
|
||||
func RemoveDuplicate(old []string) ([]string) {
|
||||
result := make([]string, 0, len(old))
|
||||
temp := map[string]struct{}{}
|
||||
for _, item := range old {
|
||||
if _, ok := temp[item]; !ok {
|
||||
temp[item] = struct{}{}
|
||||
result = append(result, item)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ var DefaultPorts = "21,22,23,80,135,443,445,1433,1521,3306,5432,6379,7001,8080,8
|
||||
|
||||
type HostInfo struct {
|
||||
Host string
|
||||
HostFile string
|
||||
Ports string
|
||||
Url string
|
||||
Timeout int64
|
||||
|
@ -22,6 +22,7 @@ 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",100,"Thread nums")
|
||||
|
Loading…
Reference in New Issue
Block a user