Skip to content

Commit 9279f17

Browse files
committed
优化:nmap未自动加.exe的bug;优化windows下缓存文件未优化体积的bug
1 parent b180682 commit 9279f17

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

config/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"CacheName": ".DbCache",
3+
"autoRmCache": "true",
34
"ssh_username": "pkg/hydra/dicts/ssh_user.txt",
45
"ssh_pswd": "pkg/hydra/dicts/ssh_pswd.txt",
56
"ssh_default": "pkg/hydra/dicts/ssh_default.txt",

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ import (
55
"github.com/hktalent/scan4all/pkg/hydra"
66
naaburunner "github.com/hktalent/scan4all/pkg/naabu/v2/pkg/runner"
77
"github.com/projectdiscovery/gologger"
8+
"os"
89
"runtime"
910
)
1011

1112
func main() {
13+
defer func() {
14+
pkg.Cache1.Close()
15+
if "true" == pkg.GetVal("autoRmCache") {
16+
os.RemoveAll(pkg.GetVal(pkg.CacheName))
17+
}
18+
}()
1219
options := naaburunner.ParseOptions()
1320
pkg.G_Options = options
1421
if runtime.GOOS == "windows" {

pkg/kvDb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ func (r *KvDbOp) SetExpiresAt(ExpiresAt uint64) {
3434

3535
func (r *KvDbOp) Init(szDb string) error {
3636
opts := badger.DefaultOptions(szDb)
37+
opts.CompactL0OnClose = true
38+
opts.LevelOneSize = 256 << 10
39+
opts.LevelSizeMultiplier = 20
3740
db, err := badger.Open(opts)
3841
if nil != err {
3942
log.Println("Init k-v db 不能多个进程同时开启", err)

pkg/naabu/v2/pkg/runner/options.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package runner
33
import (
44
"github.com/hktalent/scan4all/pkg"
55
"os"
6+
"runtime"
67
"strings"
78

89
"github.com/projectdiscovery/fileutil"
@@ -109,6 +110,9 @@ func ParseOptions() *Options {
109110
// 读取结果
110111
szNmap := pkg.GetVal("nmap")
111112
if "" != szNmap {
113+
if runtime.GOOS == "windows" {
114+
szNmap = strings.Replace(szNmap, "nmap", "nmap.exe", -1)
115+
}
112116
tempInput := pkg.GetTempFile(pkg.Naabu)
113117
if tempInput != nil {
114118
szNmap = strings.ReplaceAll(szNmap, "{filename}", tempInput.Name())

0 commit comments

Comments
 (0)