Skip to content

Commit 3a38667

Browse files
committed
up 2022-11-18
1 parent 83f0d8c commit 3a38667

File tree

17 files changed

+76
-171
lines changed

17 files changed

+76
-171
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
config/rockyou.txt filter=lfs diff=lfs merge=lfs -text
2+
main filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*.so
88
db/sqlite3.db
99
*.dylib
10+
sqlite3.db
11+
tools/macOS
1012
release
1113
.DbCache
1214
scan4all_linux

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
url = https://github.com/hktalent/nuclei-templates.git
44
[submodule "config/jaeles-signatures"]
55
path = config/jaeles-signatures
6-
url = https://github.com/hktalent/jaeles-signatures.git
6+
url = https://github.com/jaeles-project/jaeles-signatures

config/config.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
"OWASP": ["Amass"],
44
"ffuf": ["ffuf"],
55
"OJ": ["gobuster"],
6+
"jaeles-project":["jaeles"],
67
"projectdiscovery": ["naabu","nuclei","subfinder","httpx","katana","interactsh","uncover","dnsx","shuffledns","tlsx","asnmap"]
78
},
89
"cmds":{
10+
"jaeles": [
11+
"scan",
12+
"-c",20,
13+
"-o","{PWD}/logs"
14+
],
915
"ffuf": [
1016
"-u","",
1117
"-w","{PWD}/brute/dicts/filedic.txt",
@@ -221,8 +227,8 @@
221227
"nmap": "nmap -n --unique --resolve-all -Pn --min-hostgroup 64 --max-retries 0 --host-timeout 10m --script-timeout 3m -oX {filename} --version-intensity 9 --min-rate 10000 -T4 ",
222228
"HydraUser": "",
223229
"HydraPass": "",
224-
"UrlPrecise": true,
225-
"ParseSSl": true,
230+
"UrlPrecise": false,
231+
"ParseSSl": false,
226232
"EnableSubfinder": true,
227233
"EnableHoneyportDetection": true,
228234
"EnableKsubdomain": true,
@@ -261,8 +267,8 @@
261267
"MaxRedirects": 3
262268
},
263269
"enableEsSv": true,
264-
"enableJaeles": false,
265270
"CheckWeakPassword": true,
271+
"WgThread": 64,
266272
"jaelesThread": 8,
267273
"esthread": 8,
268274
"LimitTask": 4,

engine/engineImp.go

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
jsoniter "github.com/json-iterator/go"
1414
"github.com/panjf2000/ants/v2"
1515
"github.com/projectdiscovery/iputil"
16+
"github.com/remeh/sizedwaitgroup"
1617
"github.com/ulule/deepcopier"
1718
"io/ioutil"
1819
"log"
@@ -31,15 +32,15 @@ var json = jsoniter.ConfigCompatibleWithStandardLibrary
3132

3233
// 引擎对象,全局单实例
3334
type Engine struct {
34-
Context *context.Context // 上下文
35-
Wg *sync.WaitGroup // Wg
36-
Pool int // 线程池
37-
PoolFunc *ants.PoolWithFunc // 线程调用
38-
EventData chan *models.EventData // 数据队列
39-
NodeId string `json:"node_id"` // 分布式引擎节点的id,除非系统更换,docker重制,否则始终一致
40-
LimitTask int `json:"limit_task"` // 当前节点任务并发数的限制
41-
SyTask int `json:"sy_task"` // 剩余task
42-
DtServer string `json:"dt_server"` // 获取任务、提交任务状态的server
35+
Context *context.Context // 上下文
36+
Wg *sizedwaitgroup.SizedWaitGroup // Wg
37+
Pool int // 线程池
38+
PoolFunc *ants.PoolWithFunc // 线程调用
39+
EventData chan *models.EventData // 数据队列
40+
NodeId string `json:"node_id"` // 分布式引擎节点的id,除非系统更换,docker重制,否则始终一致
41+
LimitTask int `json:"limit_task"` // 当前节点任务并发数的限制
42+
SyTask int `json:"sy_task"` // 剩余task
43+
DtServer string `json:"dt_server"` // 获取任务、提交任务状态的server
4344
caseScanFunc sync.Map
4445
}
4546

@@ -56,10 +57,9 @@ func NewEngine(c *context.Context, pool int) *Engine {
5657
if nil != util.G_Engine {
5758
return util.G_Engine.(*Engine)
5859
}
59-
6060
x1 := &Engine{
6161
Context: c,
62-
Wg: &sync.WaitGroup{},
62+
Wg: util.GetWg(util.GetValAsInt("WgThread", 64)),
6363
Pool: pool,
6464
DtServer: util.GetVal("DtServer"),
6565
EventData: make(chan *models.EventData, pool),
@@ -113,7 +113,6 @@ func (e *Engine) GetTask(okTaskIds string) {
113113
var oTsk = map[string]interface{}{}
114114
if data, err := ioutil.ReadAll(resp.Body); nil == err {
115115
if err := json.Unmarshal(data, &oTsk); nil == err {
116-
117116
e.SendEvent(&n1, n1.EventType)
118117
}
119118
}
@@ -238,11 +237,11 @@ func (e *Engine) SendTask(s string) {
238237
}
239238
}
240239

241-
func (e *Engine) EngineFuncFactory(nT int64, fnCbk interface{}) {
240+
func (e *Engine) EngineFuncFactory(nT int64, fnCbk util.EngineFuncType) {
242241
e.RegCaseScanFunc(nT, fnCbk)
243242
}
244243

245-
func (e *Engine) RegCaseScanFunc(nType int64, fnCbk interface{}) {
244+
func (e *Engine) RegCaseScanFunc(nType int64, fnCbk util.EngineFuncType) {
246245
e.caseScanFunc.Store(nType, fnCbk)
247246
}
248247

@@ -261,7 +260,11 @@ func (e *Engine) Close() {
261260
// case 扫描使用的函数
262261
func (e *Engine) DoCase(ed *models.EventData) util.EngineFuncType {
263262
if i, ok := e.caseScanFunc.Load(ed.EventType); ok {
264-
return i.(util.EngineFuncType)
263+
if x, ok := i.(util.EngineFuncType); ok {
264+
return x
265+
} else {
266+
log.Println(i)
267+
}
265268
}
266269
return nil
267270
}
@@ -318,7 +321,7 @@ func (x1 *Engine) Running() {
318321
}
319322
case x2 := <-x1.EventData: // 各种扫描的控制
320323
if nil != x2 && nil != x2.EventData {
321-
x1.Wg.Add(1)
324+
x1.Wg.Add()
322325
x1.PoolFunc.Invoke(x2)
323326
}
324327
case x1, ok := <-util.PocCheck_pipe:

lib/util/Const.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package util
33
import (
44
"context"
55
"fmt"
6+
util "github.com/hktalent/go-utils"
67
"github.com/remeh/sizedwaitgroup"
78
"net/http"
89
"os"
@@ -11,7 +12,13 @@ import (
1112
)
1213

1314
// 全局线程控制
14-
var Wg = sizedwaitgroup.New(32)
15+
var Wg *sizedwaitgroup.SizedWaitGroup
16+
17+
func init() {
18+
RegInitFunc4Hd(func() {
19+
Wg = GetWg(util.GetValAsInt("WgThread", 64))
20+
})
21+
}
1522

1623
// 全局控制
1724
var RootContext = context.Background()
@@ -25,6 +32,11 @@ var DeleteMe = regexp.MustCompile("rememberMe=deleteMe")
2532
// 自定义http 头
2633
var CustomHeaders []string
2734

35+
func GetWg(n int) *sizedwaitgroup.SizedWaitGroup {
36+
x1 := sizedwaitgroup.New(n)
37+
return &x1
38+
}
39+
2840
/*
2941
X-Forwarded-Host: 127.0.0.1
3042
X-Forwarded-For: 127.0.0.1

lib/util/delayClear.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package util
22

33
import (
4+
"github.com/remeh/sizedwaitgroup"
45
"sync"
56
"time"
67
)
@@ -64,15 +65,15 @@ func DoSleep() {
6465
}
6566

6667
// 延时清理
67-
func DoDelayClear(Wg1 ...*sync.WaitGroup) {
68-
var wg2 *sync.WaitGroup
68+
func DoDelayClear(Wg1 ...*sizedwaitgroup.SizedWaitGroup) {
69+
var wg2 *sizedwaitgroup.SizedWaitGroup
6970
if 0 < len(Wg1) && nil != Wg1[0] {
7071
wg2 = Wg1[0]
7172
} else {
7273
wg2 = Wg
7374
}
7475
IsDo <- struct{}{}
75-
wg2.Add(1)
76+
wg2.Add()
7677
go func() {
7778
defer func() {
7879
<-IsDo

lib/util/sv2es.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ func SendReq(data1 interface{}, id string, szType ESaveType) {
100100
c1.ErrLimit = 10000
101101
c1.ErrCount = 0
102102
data, _ := json.Marshal(data1)
103+
c1.UseHttp2 = true
103104
c1.DoGetWithClient4SetHd(c1.GetClient4Http2(), szUrl, "POST", bytes.NewReader(data), func(resp *http.Response, err error, szU string) {
104105
if nil != err {
105106
log.Println("pphLog.DoGetWithClient4SetHd ", err)
106107
} else {
107108
defer resp.Body.Close()
108109
body, err := ioutil.ReadAll(resp.Body)
109110
if nil == err && 0 < len(body) {
110-
Log("Es save result ", string(body))
111+
Log("Es save result ", resp.StatusCode, string(body))
111112
} else if nil != err {
112113
Log(err)
113114
}

lib/util/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ type EngineFuncType func(evt *models.EventData, args ...interface{})
459459

460460
// 工厂方法
461461
// 便于同一、规范引擎调用的方法、参数约束
462-
var EngineFuncFactory func(nT int64, fnCbk interface{})
462+
var EngineFuncFactory func(nT int64, fnCbk EngineFuncType)
463463

464464
// 全局引擎
465465
var G_Engine interface{}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var config embed.FS
2424
var Version string
2525

2626
func main() {
27-
os.Args = []string{"", "-host", "http://192.168.0.109", "-v"}
27+
os.Args = []string{"", "-host", "http://127.0.0.1", "-v"}
2828
//os.Args = []string{"", "-host", "http://127.0.0.1", "-v"}
2929
//os.Args = []string{"", "-host", "https://www.sina.com.cn/", "-v", "-o", "xxx.csv"}
3030
//os.Args = []string{"", "-list", "list.txt", "-v"}

pkg/naabu/v2/pkg/runner/targets.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (r *Runner) MergeToFile() (string, error) {
112112

113113
func (r *Runner) DoSsl(target string) []string {
114114
// 处理ssl 数字证书中包含的域名信息,深度挖掘漏洞
115-
if "true" == util.GetVal("ParseSSl") {
115+
if util.GetValAsBool("ParseSSl") {
116116
aH, err := pkg.DoDns(target)
117117
if nil == err {
118118
return aH
@@ -339,8 +339,7 @@ func (r *Runner) AddTarget(target string) error {
339339
//Add2Naabubuffer(u.Hostname())
340340
// target 长度 大于 s1才处理
341341
////UrlPrecise bool // 精准url扫描,不去除url清单上下文 2022-06-08
342-
UrlPrecise := util.GetVal(util.UrlPrecise)
343-
if "true" == UrlPrecise && len(target) > len(s1) {
342+
if util.GetValAsBool(util.UrlPrecise) && len(target) > len(s1) {
344343
s2 := r1.ReplaceAllString(target[len(s1):], "")
345344
// 包含1个以上/表示有上下文
346345
if 1 < len(s2) {

pkg/xcmd/allCmdTools.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ func DoRaw4FuzzCmd(s, t string) string {
112112
szName, _ := GetTempFile()
113113
return doTpCmd(t, s, szName)
114114
}
115+
116+
// 执行nmap
117+
func doNmap(s string) string {
118+
s = Target2HostsFile(s)
119+
szName, _ := GetTempFile()
120+
return ""
121+
}

pkg/xcmd/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func init() {
2626
rand.Seed(time.Now().UnixNano())
2727
util.RegInitFunc(func() {
2828
Pwd, _ = os.Getwd()
29-
ToolsPath = Pwd + "/../tools/"
29+
ToolsPath = Pwd + "/tools/"
3030
envParm["PWD"] = Pwd
3131
})
3232
}

projectdiscovery/nuclei_Yaml/nuclei_yaml.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/hktalent/51pwnPlatform/pkg/models"
88
"github.com/hktalent/ProScan4all/lib/util"
99
runner2 "github.com/hktalent/ProScan4all/projectdiscovery/nuclei_Yaml/nclruner/runner"
10-
"github.com/hktalent/ProScan4all/webScan/jaeles"
1110
jsoniter "github.com/json-iterator/go"
1211
"github.com/projectdiscovery/fileutil"
1312
"github.com/projectdiscovery/goflags"
@@ -147,9 +146,6 @@ func RunNuclei(buf *bytes.Buffer, xx chan bool, oOpts *map[string]interface{}, o
147146

148147
// 启动web扫描
149148
util.Wg.Add()
150-
if util.GetValAsBool("enableJaeles") {
151-
go jaeles.RunScan(a66, "")
152-
}
153149

154150
options.Targets = *x55
155151
log.Printf("nuclei options.Targets = %+v\n", options.Targets)

simple/naabu.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{"ip":"192.168.0.109","port":8001,"timestamp":"2022-11-18T03:57:01.843856Z"}
2+
{"ip":"192.168.0.109","port":3240,"timestamp":"2022-11-18T03:57:01.843856Z"}
3+
{"ip":"192.168.0.109","port":548,"timestamp":"2022-11-18T03:57:01.843856Z"}
4+
{"ip":"192.168.0.109","port":111,"timestamp":"2022-11-18T03:57:01.843856Z"}

0 commit comments

Comments
 (0)