mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-23 11:41:53 +08:00
加强poc fuzz模块,支持跑备份文件、目录、shiro-key(默认跑10key,可用-full参数跑100key)等。新增ms17017利用(使用参数: -sc add),可在ms17010-exp.go自定义shellcode,内置添加用户等功能。 新增poc、指纹。支持socks5代理。因body指纹更全,默认不再跑ico图标。
This commit is contained in:
+91
-11
@@ -7,19 +7,98 @@ import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"gopkg.in/yaml.v3"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Poc struct {
|
||||
Name string `yaml:"name"`
|
||||
Set map[string]string `yaml:"set"`
|
||||
Sets map[string][]string `yaml:"sets"`
|
||||
Rules []Rules `yaml:"rules"`
|
||||
Groups map[string][]Rules `yaml:"groups"`
|
||||
Detail Detail `yaml:"detail"`
|
||||
Name string `yaml:"name"`
|
||||
Set StrMap `yaml:"set"`
|
||||
Sets ListMap `yaml:"sets"`
|
||||
Rules []Rules `yaml:"rules"`
|
||||
Groups RuleMap `yaml:"groups"`
|
||||
Detail Detail `yaml:"detail"`
|
||||
}
|
||||
|
||||
type MapSlice = yaml.MapSlice
|
||||
|
||||
type StrMap []StrItem
|
||||
type ListMap []ListItem
|
||||
type RuleMap []RuleItem
|
||||
|
||||
type StrItem struct {
|
||||
Key, Value string
|
||||
}
|
||||
|
||||
type ListItem struct {
|
||||
Key string
|
||||
Value []string
|
||||
}
|
||||
|
||||
type RuleItem struct {
|
||||
Key string
|
||||
Value []Rules
|
||||
}
|
||||
|
||||
func (r *StrMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var tmp yaml.MapSlice
|
||||
if err := unmarshal(&tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, one := range tmp {
|
||||
key, value := one.Key.(string), one.Value.(string)
|
||||
*r = append(*r, StrItem{key, value})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//func (r *RuleItem) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
// var tmp yaml.MapSlice
|
||||
// if err := unmarshal(&tmp); err != nil {
|
||||
// return err
|
||||
// }
|
||||
// //for _,one := range tmp{
|
||||
// // key,value := one.Key.(string),one.Value.(string)
|
||||
// // *r = append(*r,StrItem{key,value})
|
||||
// //}
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func (r *RuleMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var tmp1 yaml.MapSlice
|
||||
if err := unmarshal(&tmp1); err != nil {
|
||||
return err
|
||||
}
|
||||
var tmp = make(map[string][]Rules)
|
||||
if err := unmarshal(&tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, one := range tmp1 {
|
||||
key := one.Key.(string)
|
||||
value := tmp[key]
|
||||
*r = append(*r, RuleItem{key, value})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *ListMap) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
var tmp yaml.MapSlice
|
||||
if err := unmarshal(&tmp); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, one := range tmp {
|
||||
key := one.Key.(string)
|
||||
var value []string
|
||||
for _, val := range one.Value.([]interface{}) {
|
||||
v := fmt.Sprintf("%v", val)
|
||||
value = append(value, v)
|
||||
}
|
||||
*r = append(*r, ListItem{key, value})
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Rules struct {
|
||||
@@ -30,6 +109,7 @@ type Rules struct {
|
||||
Search string `yaml:"search"`
|
||||
FollowRedirects bool `yaml:"follow_redirects"`
|
||||
Expression string `yaml:"expression"`
|
||||
Continue bool `yaml:"continue"`
|
||||
}
|
||||
|
||||
type Detail struct {
|
||||
@@ -400,12 +480,12 @@ func LoadPoc(fileName string, Pocs embed.FS) (*Poc, error) {
|
||||
yamlFile, err := Pocs.ReadFile("pocs/" + fileName)
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("[-] load poc %s error: %v", fileName, err)
|
||||
fmt.Printf("[-] load poc %s error1: %v\n", fileName, err)
|
||||
return nil, err
|
||||
}
|
||||
err = yaml.Unmarshal(yamlFile, p)
|
||||
if err != nil {
|
||||
fmt.Printf("[-] load poc %s error: %v", fileName, err)
|
||||
fmt.Printf("[-] load poc %s error2: %v\n", fileName, err)
|
||||
return nil, err
|
||||
}
|
||||
return p, err
|
||||
@@ -429,12 +509,12 @@ func LoadPocbyPath(fileName string) (*Poc, error) {
|
||||
p := &Poc{}
|
||||
data, err := ioutil.ReadFile(fileName)
|
||||
if err != nil {
|
||||
fmt.Printf("[-] load poc %s error: %v", fileName, err)
|
||||
fmt.Printf("[-] load poc %s error3: %v\n", fileName, err)
|
||||
return nil, err
|
||||
}
|
||||
err = yaml.Unmarshal(data, p)
|
||||
if err != nil {
|
||||
fmt.Printf("[-] load poc %s error: %v", fileName, err)
|
||||
fmt.Printf("[-] load poc %s error4: %v\n", fileName, err)
|
||||
return nil, err
|
||||
}
|
||||
return p, err
|
||||
|
||||
Reference in New Issue
Block a user