Skip to content

Commit

Permalink
加入手工gc回收,尝试节省无用内存。
Browse files Browse the repository at this point in the history
-url 支持逗号隔开。
修复一个poc模块bug。
  • Loading branch information
shadow1ng committed Jul 6, 2022
1 parent 6e5642c commit 30df6b6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 16 deletions.
5 changes: 0 additions & 5 deletions Plugins/ms17010-exp.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ func exploit(address string, grooms int, payload []byte) error {

func makeKernelUserPayload(sc []byte) []byte {
// test DoublePulsar
// sc, err := ioutil.ReadFile("sc.bin")
// if err != nil {
// panic(err)
// }
// return sc
buf := bytes.Buffer{}
buf.Write(loader[:])
// write sc size
Expand Down
10 changes: 2 additions & 8 deletions Plugins/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,10 @@ func Scan(info common.HostInfo) {
}
}
}
if common.URL != "" {
info.Url = common.URL
for _, url := range common.Urls {
info.Url = url
AddScan("1000003", info, ch, &wg)
}
if len(common.Urls) > 0 {
for _, url := range common.Urls {
info.Url = url
AddScan("1000003", info, ch, &wg)
}
}
wg.Wait()
common.LogWG.Wait()
close(common.Results)
Expand Down
1 change: 0 additions & 1 deletion WebScan/lib/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func executePoc(oReq *http.Request, p *Poc) (bool, error, string) {
//fmt.Println("[-] newRequest error: ",err)
return false, err
}
newRequest.URL.Path = req.Url.Path
newRequest.Header = oReq.Header.Clone()
for k, v := range Headers {
newRequest.Header.Set(k, v)
Expand Down
2 changes: 1 addition & 1 deletion WebScan/lib/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
defer oResp.Body.Close()
resp, err := ParseResponse(oResp)
if err != nil {
fmt.Println("[-]ParseResponse error: ", err)
common.LogError("[-]ParseResponse error: " + err.Error())
return nil, err
}
return resp, err
Expand Down
12 changes: 12 additions & 0 deletions common/Parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ func ParsePass(Info *HostInfo) {
Passwords = PwdList
}
}
if URL != "" {
urls := strings.Split(URL, ",")
TmpUrls := make(map[string]struct{})
for _, url := range urls {
if _, ok := TmpUrls[url]; !ok {
TmpUrls[url] = struct{}{}
if url != "" {
Urls = append(Urls, url)
}
}
}
}
if UrlFile != "" {
urls, err := Readfile(UrlFile)
if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion common/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

var version = "1.8.0"
var version = "1.8.1"
var Userdict = map[string][]string{
"ftp": {"ftp", "admin", "www", "web", "root", "db", "wwwroot", "data"},
"mysql": {"root", "mysql"},
Expand Down
10 changes: 10 additions & 0 deletions common/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import (
"flag"
)

func init() {
go func() {
for {
runtime.GC()
debug.FreeOSMemory()
time.Sleep(10 * time.Second)
}
}()
}

func Banner() {
banner := `
___ _
Expand Down

0 comments on commit 30df6b6

Please sign in to comment.