Skip to content

Commit bb9bd04

Browse files
authored
Merge pull request #67 from hktalent/main
x
2 parents 9daf030 + 2a74bba commit bb9bd04

File tree

85 files changed

+6292
-258
lines changed

Some content is hidden

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

85 files changed

+6292
-258
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ mkdir ~/MyWork/;cd ~/MyWork/;git clone https://github.com/hktalent/log4j-scan
112112
````
113113
- Intelligently identify honeypots and skip targets. This function is disabled by default. You can set EnableHoneyportDetection=true to enable
114114
- Highly customizable: allow to define your own dictionary through config/config.json configuration, or control more details, including but not limited to: nuclei, httpx, naabu, etc.
115-
- support HTTP Request Smuggling: CL-TE、TE-CL、TE-TE
115+
- support HTTP Request Smuggling: CL-TE、TE-CL、TE-TE、CL_CL、BaseErr
116+
<img width="968" alt="image" src="https://user-images.githubusercontent.com/18223385/182503765-1307a634-61b2-4f7e-9631-a4184ec7ac25.png">
117+
116118
- Support via parameter Cookie='PHPSession=xxxx' ./scan4all -host xxxx.com, compatible with nuclei, httpx, go-poc, x-ray POC, filefuzz, http Smuggling
117119
# work process
118120

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ require (
117117
github.com/projectdiscovery/nuclei/v2 v2.7.5
118118
github.com/projectdiscovery/subfinder/v2 v2.5.2
119119
github.com/satori/go.uuid v1.2.0
120+
github.com/shirou/gopsutil/v3 v3.22.7
120121
github.com/sijms/go-ora/v2 v2.4.25
122+
github.com/simonnilsson/ask v0.2.0
121123
github.com/spf13/viper v1.12.0
122124
github.com/stacktitan/smb v0.0.0-20190531122847-da9a425dceb8
123125
github.com/tj/go-update v2.2.5-0.20200519121640-62b4b798fd68+incompatible
@@ -241,8 +243,6 @@ require (
241243
github.com/russross/blackfriday/v2 v2.1.0 // indirect
242244
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
243245
github.com/segmentio/ksuid v1.0.4 // indirect
244-
github.com/shirou/gopsutil/v3 v3.22.6 // indirect
245-
github.com/simonnilsson/ask v0.2.0 // indirect
246246
github.com/spf13/afero v1.8.2 // indirect
247247
github.com/spf13/cast v1.5.0 // indirect
248248
github.com/spf13/jwalterweatherman v1.1.0 // indirect

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,9 @@ github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c
755755
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
756756
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
757757
github.com/shirou/gopsutil/v3 v3.21.7/go.mod h1:RGl11Y7XMTQPmHh8F0ayC6haKNBgH4PXMJuTAcMOlz4=
758-
github.com/shirou/gopsutil/v3 v3.22.6 h1:FnHOFOh+cYAM0C30P+zysPISzlknLC5Z1G4EAElznfQ=
759758
github.com/shirou/gopsutil/v3 v3.22.6/go.mod h1:EdIubSnZhbAvBS1yJ7Xi+AShB/hxwLHOMz4MCYz7yMs=
759+
github.com/shirou/gopsutil/v3 v3.22.7 h1:flKnuCMfUUrO+oAvwAd6GKZgnPzr098VA/UJ14nhJd4=
760+
github.com/shirou/gopsutil/v3 v3.22.7/go.mod h1:s648gW4IywYzUfE/KjXxUsqrqx/T2xO5VqOXxONeRfI=
760761
github.com/sijms/go-ora/v2 v2.4.25 h1:PtyMsRGHd6FNttdaMEg4NdHuRYxg29NKwsxPuTmCEJ4=
761762
github.com/sijms/go-ora/v2 v2.4.25/go.mod h1:EHxlY6x7y9HAsdfumurRfTd+v8NrEOTR3Xl4FWlH6xk=
762763
github.com/simonnilsson/ask v0.2.0 h1:CpiQtuLyRlrPNVk6aQjaFL51XmBlCIxaqssxentXBBA=

lib/util/sysinfo.go

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
package util
2+
3+
import (
4+
"fmt"
5+
"github.com/shirou/gopsutil/v3/cpu"
6+
"github.com/shirou/gopsutil/v3/disk"
7+
"github.com/shirou/gopsutil/v3/host"
8+
"github.com/shirou/gopsutil/v3/mem"
9+
"github.com/shirou/gopsutil/v3/net"
10+
systemNet "net"
11+
"strconv"
12+
"time"
13+
)
14+
15+
// 分区
16+
type Part struct {
17+
Path string `json:"path"`
18+
FsType string `json:"fstype"`
19+
Total float64 `json:"total"`
20+
Free float64 `json:"free"`
21+
Used float64 `json:"used"`
22+
UsedPercent int `json:"usedPercent"`
23+
}
24+
25+
// 分区集合
26+
type Parts []Part
27+
28+
// CPU
29+
type CpuSingle struct {
30+
Num string `json:"num"`
31+
Percent int `json:"percent"`
32+
}
33+
34+
type CpuInfo struct {
35+
CpuAvg float64 `json:"cpuAvg"`
36+
CpuAll []CpuSingle `json:"cpuAll"`
37+
}
38+
39+
const GB = 1024 * 1024 * 1024
40+
41+
func decimal(v string) float64 {
42+
value, _ := strconv.ParseFloat(v, 64)
43+
return value
44+
}
45+
46+
// 1.主机IP
47+
func GetLocalIP() (ip string) {
48+
addresses, err := systemNet.InterfaceAddrs()
49+
if err != nil {
50+
return ""
51+
}
52+
for _, addr := range addresses {
53+
ipAddr, ok := addr.(*systemNet.IPNet)
54+
if !ok {
55+
continue
56+
}
57+
if ipAddr.IP.IsLoopback() {
58+
continue
59+
}
60+
if !ipAddr.IP.IsGlobalUnicast() {
61+
continue
62+
}
63+
return ipAddr.IP.String()
64+
}
65+
return ""
66+
}
67+
68+
// 2.主机信息
69+
func GetHostInfo() (result *host.InfoStat, err error) {
70+
result, err = host.Info()
71+
return result, err
72+
}
73+
74+
// 3.磁盘信息
75+
func GetDiskInfo() (result Parts, err error) {
76+
parts, err := disk.Partitions(true)
77+
if err != nil {
78+
return result, err
79+
}
80+
for _, part := range parts {
81+
diskInfo, err := disk.Usage(part.Mountpoint)
82+
if err == nil {
83+
result = append(result, Part{
84+
Path: diskInfo.Path,
85+
FsType: diskInfo.Fstype,
86+
Total: decimal(fmt.Sprintf("%.2f", float64(diskInfo.Total/GB))),
87+
Free: decimal(fmt.Sprintf("%.2f", float64(diskInfo.Free/GB))),
88+
Used: decimal(fmt.Sprintf("%.2f", float64(diskInfo.Used/GB))),
89+
UsedPercent: int(diskInfo.UsedPercent),
90+
})
91+
} else {
92+
return result, err
93+
}
94+
}
95+
return result, err
96+
}
97+
98+
// 4.CPU使用率
99+
func GetCpuPercent() (result CpuInfo, err error) {
100+
infos, err := cpu.Percent(1*time.Second, true)
101+
if err != nil {
102+
return result, err
103+
}
104+
var total float64 = 0
105+
for index, value := range infos {
106+
result.CpuAll = append(result.CpuAll, CpuSingle{
107+
Num: fmt.Sprintf("#%d", index+1),
108+
Percent: int(value),
109+
})
110+
total += value
111+
}
112+
result.CpuAvg = decimal(fmt.Sprintf("%.1f", total/float64(len(infos))))
113+
return result, err
114+
}
115+
116+
// 5.内存信息
117+
func GetMemInfo() (float64, []map[string]interface{}) {
118+
info, err := mem.VirtualMemory()
119+
if err != nil {
120+
fmt.Println(err)
121+
return 0, nil
122+
}
123+
return decimal(fmt.Sprintf("%.1f", info.UsedPercent)), []map[string]interface{}{
124+
{"key": "使用率[%]", "value": decimal(fmt.Sprintf("%.1f", info.UsedPercent))},
125+
{"key": "总量[GB]", "value": int(info.Total / GB)},
126+
{"key": "使用量[GB]", "value": int(info.Used / GB)},
127+
{"key": "剩余量[GB]", "value": int(info.Free / GB)},
128+
}
129+
}
130+
131+
// 6.获取网卡信息
132+
func GetNetInfo() (result []net.IOCountersStat, err error) {
133+
info, err := net.IOCounters(true)
134+
if err != nil {
135+
return result, err
136+
}
137+
return info, err
138+
}
139+
140+
// 7.计算上下行带宽
141+
func GetNetSpeed() (speed map[string]map[string]uint64, err error) {
142+
speed = map[string]map[string]uint64{}
143+
info, err := net.IOCounters(true)
144+
if err != nil {
145+
return speed, err
146+
}
147+
for _, item := range info {
148+
if item.BytesSent != 0 {
149+
speed[item.Name] = map[string]uint64{
150+
"send": item.BytesSent,
151+
"recv": item.BytesRecv,
152+
}
153+
}
154+
}
155+
156+
time.Sleep(1 * time.Second)
157+
158+
info, err = net.IOCounters(true)
159+
if err != nil {
160+
return speed, err
161+
}
162+
for _, item := range info {
163+
if item.BytesSent != 0 {
164+
speed[item.Name] = map[string]uint64{
165+
"send": item.BytesSent - speed[item.Name]["send"],
166+
"recv": item.BytesRecv - speed[item.Name]["recv"],
167+
}
168+
}
169+
}
170+
return speed, nil
171+
}

vendor/github.com/projectdiscovery/nuclei/v2/pkg/protocols/http/request.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/shirou/gopsutil/v3/cpu/cpu.go

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/shirou/gopsutil/v3/disk/disk.go

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)