Skip to content

Commit 4db39c4

Browse files
committed
up 2023-01-01
1 parent 019c68b commit 4db39c4

File tree

1,224 files changed

+21446
-102570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,224 files changed

+21446
-102570
lines changed

3ee8307c128be7296b2fa2ad5453341a3d37c2b6.xml

Lines changed: 27 additions & 0 deletions
Large diffs are not rendered by default.

brute/dicts/filedic.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/Login.jsp
22
/login.jsp
3+
/stats.json
34
/.well-known/security.txt
45
../../../../../../../../../../../../../../../../../../usr/local/cpanel/logs/login_log%00
56
../../../../../../../../../../../../../../../../../../usr/local/cpanel/logs/login_log

config/config.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
"-c",20,
1313
"-o","{PWD}/logs"
1414
],
15-
"uncover": [
16-
"-q","",
17-
"-e","shodan",
18-
"-pc","{PWD}/config/uncover/provider-config.yaml",
19-
"-config","{PWD}/config/uncover/config.yaml",
20-
"-f","ip,port,host",
21-
"-json","-o",""
22-
],
2315
"ffuf": [
2416
"-u","",
2517
"-w","{PWD}/brute/dicts/filedic.txt",
@@ -51,8 +43,10 @@
5143
],
5244
"uncover": [
5345
"-q","",
54-
"-engine","shodan",
55-
"-provider","{PWD}/config/uncover/provider-config.yaml",
46+
"-e","shodan",
47+
"-pc","{PWD}/config/uncover/provider-config.yaml",
48+
"-config","{PWD}/config/uncover/config.yaml",
49+
"-f","ip,port,host",
5650
"-shodan",
5751
"-silent","-nc","-json","-o",""
5852
],

config/nuclei-templates

Submodule nuclei-templates updated 679 files

config/uncover/provider-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
shodan:
2-
- FfH1z0IR5MiktkLbfMlQD93M3lPe32vH
2+
- ZRSzvyQ1GiKZkK0JfSZJKH4ucv8u1ude
33
censys: []
44
fofa: []

doNaabu_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func DoInitAll() {
1414

1515
func TestDoUncover(t *testing.T) {
1616
DoInitAll()
17-
a := strings.Split(`'gov.cn'
17+
a := strings.Split(`
18+
'ssl:Alibaba'
19+
'gov.cn'
1820
'ssl:"gov.cn"'
1921
'ssl:"China Lodging Group"'
2022
'ssl:"huazhu"'

engine/engineImp.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ func (e *Engine) initNodeId() {
100100
}
101101
}
102102

103+
// 优化使用websocket、或者webRTC
103104
// "https://dt.51pwn.com/api/v1.0/syncResult/task/%d"
104105
// curl -v -XPOST -d '{"Num":22,"task_ids":"","node_id":"xx","task_num":443}' https://127.0.0.1:8081/api/v1.0/syncResult/task/33
105106
// 结果反馈 /api/v1.0/syncResult/task/%d
@@ -237,10 +238,12 @@ func (e *Engine) SendTask(s string) {
237238
}
238239
}
239240

241+
// 注册特定类型的事件处理
240242
func (e *Engine) EngineFuncFactory(nT int64, fnCbk util.EngineFuncType) {
241243
e.RegCaseScanFunc(nT, fnCbk)
242244
}
243245

246+
// 注册特定类型的事件处理
244247
func (e *Engine) RegCaseScanFunc(nType int64, fnCbk util.EngineFuncType) {
245248
e.caseScanFunc.Store(nType, fnCbk)
246249
}

go.mod

Lines changed: 41 additions & 114 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 81 additions & 745 deletions
Large diffs are not rendered by default.

lib/api/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package api
33
import (
44
_ "github.com/hktalent/ProScan4all/engine"
55
"github.com/hktalent/ProScan4all/lib/util"
6-
"github.com/hktalent/ProScan4all/pkg/hydra"
76
naaburunner "github.com/hktalent/ProScan4all/pkg/naabu/v2/pkg/runner"
87
jsoniter "github.com/json-iterator/go"
98
"github.com/projectdiscovery/gologger"
@@ -68,12 +67,13 @@ func StartScan(oOpts *map[string]interface{}) {
6867
noScan := util.GetValAsBool("noScan")
6968

7069
// 直接使用 nmap xml结果文件
71-
if hydra.DoNmapWithFile(options.HostsFile, &naaburunner.Naabubuffer) {
70+
if util.DoNmapWithFile(options.HostsFile, &naaburunner.Naabubuffer) {
7271
os.Setenv("noScan", "true")
7372
naabuRunner.Close()
7473
} else if noScan {
7574
s1, err := naabuRunner.MergeToFile()
7675
if nil == err {
76+
util.DoInput(s1, &naaburunner.Naabubuffer)
7777
data, err := ioutil.ReadFile(s1)
7878
if nil == err {
7979
naaburunner.Naabubuffer.Write(data)

lib/util/Const.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import (
44
"context"
55
"fmt"
66
util "github.com/hktalent/go-utils"
7+
jsoniter "github.com/json-iterator/go"
78
"github.com/remeh/sizedwaitgroup"
89
"net/http"
910
"os"
1011
"regexp"
1112
"strings"
1213
)
1314

15+
var Json = jsoniter.ConfigCompatibleWithStandardLibrary
16+
1417
// 全局线程控制
1518
var Wg *sizedwaitgroup.SizedWaitGroup
1619

@@ -78,7 +81,7 @@ func SetHeader4Map(m *map[string]string) {
7881
// 程序main整体等待
7982
func DoSyncFunc(cbk func()) {
8083
Wg.Add()
81-
go func() {
84+
DefaultPool.Submit(func() {
8285
defer Wg.Done()
8386
for {
8487
select {
@@ -90,7 +93,7 @@ func DoSyncFunc(cbk func()) {
9093
return
9194
}
9295
}
93-
}()
96+
})
9497
}
9598

9699
// 检查 cookie

lib/util/GLock.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package util
2+
3+
import (
4+
"fmt"
5+
"sync"
6+
"time"
7+
)
8+
9+
var lk sync.Mutex
10+
11+
// 全局统一锁,避免相同目标、相同任务重复执行
12+
// 库级:不重复
13+
// 执行第一次,就进行标记,第二次返回true
14+
func IsDoIt(s string, nType int) bool {
15+
lk.Lock()
16+
defer lk.Unlock()
17+
k := fmt.Sprintf("IsDo%s_%d", s, nType)
18+
if o := clientHttpCc.Get(k); nil != o {
19+
if v, ok := o.Value().(bool); ok && v {
20+
return v
21+
}
22+
}
23+
clientHttpCc.Set(k, true, time.Hour*24)
24+
return false
25+
}

lib/util/SPool.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package util
2+
3+
import (
4+
"github.com/panjf2000/ants/v2"
5+
"time"
6+
)
7+
8+
const (
9+
// DefaultAntsPoolSize sets up the capacity of worker pool, 256 * 1024.
10+
DefaultAntsPoolSize = 1 << 18
11+
12+
// ExpiryDuration is the interval time to clean up those expired workers.
13+
ExpiryDuration = 10 * time.Second
14+
15+
// Nonblocking decides what to do when submitting a new task to a full worker pool: waiting for a available worker
16+
// or returning nil directly.
17+
Nonblocking = true
18+
)
19+
20+
// Pool is the alias of ants.Pool.
21+
type Pool = ants.Pool
22+
23+
var DefaultPool *Pool
24+
25+
func create() *Pool {
26+
options := ants.Options{ExpiryDuration: ExpiryDuration, Nonblocking: Nonblocking}
27+
defaultAntsPool, _ := ants.NewPool(DefaultAntsPoolSize, ants.WithOptions(options))
28+
return defaultAntsPool
29+
}
30+
31+
func init() {
32+
RegInitFunc4Hd(func() {
33+
// It releases the default pool from ants.
34+
ants.Release()
35+
DefaultPool = create()
36+
})
37+
}

lib/util/VulInfo.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package util
2+
3+
type VulnInfo struct {
4+
Name string
5+
VulID []string
6+
Version string
7+
Author string
8+
VulDate string
9+
References []string
10+
AppName string
11+
AppPowerLink string
12+
AppVersion string
13+
VulType string
14+
Description string
15+
Category string
16+
Dork QueryDork
17+
}
18+
19+
type QueryDork struct {
20+
Fofa string
21+
Quake string
22+
Zoomeye string
23+
Shodan string
24+
}

lib/util/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ func DoCmd(args ...string) (string, error) {
311311
if nil != err {
312312
return "", err
313313
}
314-
return string(outStr + "\n" + errStr), err
314+
return outStr + "\n" + errStr, err
315315
}
316316

317317
func doFile(config *embed.FS, s fs.DirEntry, szPath string) {

pkg/hydra/doNmapResult.go renamed to lib/util/doNmapResult.go

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package hydra
1+
package util
22

33
import (
44
"bytes"
55
"fmt"
66
"github.com/antchfx/xmlquery"
7-
"github.com/hktalent/ProScan4all/lib/util"
8-
"github.com/hktalent/ProScan4all/pkg"
7+
"github.com/hktalent/51pwnPlatform/lib/scan/Const"
8+
"github.com/hktalent/51pwnPlatform/pkg/models"
99
"io/ioutil"
1010
"log"
1111
"os"
@@ -15,23 +15,24 @@ import (
1515

1616
// 弱口令检测
1717
func CheckWeakPassword(ip, service string, port int) {
18-
util.DoSyncFunc(func() {
19-
// 在弱口令检测范围就开始检测,结果....
20-
service = strings.ToLower(service)
21-
if pkg.Contains(ProtocolList, service) {
22-
//log.Println("start CheckWeakPassword ", ip, ":", port, "(", service, ")")
23-
Start(ip, port, service)
24-
}
25-
})
18+
if !bCheckWeakPassword {
19+
return
20+
}
21+
// 在弱口令检测范围就开始检测,结果....
22+
service = strings.ToLower(service)
23+
SendEvent(&models.EventData{
24+
EventType: Const.ScanType_Pswd4hydra,
25+
EventData: []interface{}{ip, port, service},
26+
}, Const.ScanType_Pswd4hydra)
2627
}
2728

2829
// 开启了es
29-
var enableEsSv, bCheckWeakPassword bool = false, true
30+
var bCheckWeakPassword bool = true
3031

3132
func init() {
32-
util.RegInitFunc(func() {
33-
enableEsSv = util.GetValAsBool("enableEsSv")
34-
bCheckWeakPassword = util.GetValAsBool("CheckWeakPassword")
33+
RegInitFunc(func() {
34+
EnableEsSv = GetValAsBool("EnableEsSv")
35+
bCheckWeakPassword = GetValAsBool("CheckWeakPassword")
3536
//log.Println("CheckWeakPassword = ", util.GetVal("CheckWeakPassword"), " bCheckWeakPassword = ", bCheckWeakPassword)
3637
})
3738
}
@@ -45,6 +46,11 @@ func GetAttr(att []xmlquery.Attr, name string) string {
4546
return ""
4647
}
4748

49+
// 解析 nmap、masscan 输出的xml结果
50+
// 解析的结果保存到 bf 中
51+
// 解析的同时:
52+
// 1、触发端口弱口令检测,如果当前任务不需要,则,弱口令检测的入口处拦截、过滤
53+
// 2、端口 POC 检测,如果当前任务不需要,则,弱口令检测的入口处拦截、过滤
4854
func DoParseXml(s string, bf *bytes.Buffer) {
4955
doc, err := xmlquery.Parse(strings.NewReader(s))
5056
if err != nil {
@@ -80,7 +86,7 @@ func DoParseXml(s string, bf *bytes.Buffer) {
8086
// 存储结果到其他地方
8187
//x9 := AuthInfo{IPAddr: ip, Port: port, Protocol: service}
8288
// 构造发送es等数据
83-
if enableEsSv {
89+
if EnableEsSv {
8490
var xx09 = [][]string{}
8591
if a1, ok := m1[ip]; ok {
8692
xx09 = a1
@@ -94,21 +100,21 @@ func DoParseXml(s string, bf *bytes.Buffer) {
94100
bf.Write([]byte(szUlr + "\n"))
95101
if os.Getenv("NoPOC") != "true" {
96102
if "445" == szPort && service == "microsoft-ds" || "135" == szPort && service == "msrpc" {
97-
util.PocCheck_pipe <- &util.PocCheck{
103+
PocCheck_pipe <- &PocCheck{
98104
Wappalyzertechnologies: &[]string{service},
99105
URL: szUlr,
100106
FinalURL: szUlr,
101107
Checklog4j: false,
102108
}
103-
} else if "8291" == szPort { // CVE_2018_14847
104-
util.PocCheck_pipe <- &util.PocCheck{
109+
} else if "8291" == szPort { // RouterOS CVE_2018_14847
110+
PocCheck_pipe <- &PocCheck{
105111
Wappalyzertechnologies: &[]string{"RouterOS"},
106112
URL: szUlr,
107113
FinalURL: szUlr,
108114
Checklog4j: false,
109115
}
110-
} else if "2181" == szPort {
111-
util.PocCheck_pipe <- &util.PocCheck{
116+
} else if "2181" == szPort { // Zookeeper Unauthority
117+
PocCheck_pipe <- &PocCheck{
112118
Wappalyzertechnologies: &[]string{"ZookeeperUnauthority"},
113119
URL: szUlr,
114120
FinalURL: szUlr,
@@ -120,7 +126,7 @@ func DoParseXml(s string, bf *bytes.Buffer) {
120126
}
121127
// 若密码、破解
122128
if bCheckWeakPassword {
123-
if "8728" == szPort && service == "unknown" {
129+
if "8728" == szPort && service == "unknown" { // router
124130
CheckWeakPassword(ip, "router", port)
125131
} else if ("5985" == szPort || "5986" == szPort) && -1 < strings.Index(service, "microsoft ") {
126132
CheckWeakPassword(ip, "winrm", port)
@@ -130,22 +136,22 @@ func DoParseXml(s string, bf *bytes.Buffer) {
130136
}
131137

132138
s1 := fmt.Sprintf("%s\t%d\t%s\n", ip, port, service)
133-
util.SendLog(ip, "nmap", s1, "")
139+
SendLog(ip, "nmap", s1, "")
134140
log.Printf("%s", s1)
135141
}
136142
}
137143
}
138-
if enableEsSv {
144+
if EnableEsSv {
139145
if 0 < len(m1) {
140146
for k, x := range m1 {
141-
util.SendAData[[]string](k, x, util.Nmap)
147+
SendAData[[]string](k, x, Nmap)
142148
}
143149
}
144150
}
145151
}
146152

147153
// 处理使用者自己扫描的结果
148-
// 不能用异步,否则后续流程无法读取 buff
154+
// 不能用异步,否则后续流程无法读取 buff
149155
func DoNmapWithFile(s string, bf *bytes.Buffer) bool {
150156
if strings.HasSuffix(strings.ToLower(s), ".xml") {
151157
b, err := ioutil.ReadFile(s)
@@ -154,15 +160,14 @@ func DoNmapWithFile(s string, bf *bytes.Buffer) bool {
154160
} else {
155161
log.Println("DoNmapWithFile: ", err)
156162
}
157-
158163
return true
159164
}
160165
return false
161166
}
162167

163168
// 处理 naabu 端口扫描环节的结果文件
164169
func DoNmapRst(bf *bytes.Buffer) {
165-
if x1, ok := util.TmpFile[string(util.Naabu)]; ok {
170+
if x1, ok := TmpFile[string(Naabu)]; ok {
166171
for _, x := range x1 {
167172
defer func(r *os.File) {
168173
r.Close()

0 commit comments

Comments
 (0)