Byzero512/winpwn

Chocking occurs when use recv() method.

yikesoftware opened this issue · 1 comments

I found that it would be chocked when I use recv() to get the ouput of a process.

This is my script:

from winpwn import *

context.log_level = "debug"
context.arch = "amd64"

def exp():
    print(p.recv(1024))

    p.interactive()

if __name__ == "__main__":
    global p
    p = process("1.exe")
    exp()
    p.close()

I think the problem actually occurs in ”winpwn/winpwn.py“:

    def read(self,n,timeout=None,interactive=False):
        buf=''
        try:
            if self.debugger is not None and interactive is False:
                while(len(buf)!=n):
                    buf+=self.Process.read(n-len(buf),timeout) # here
            else:
                buf=self.Process.read(n, timeout) # and here
        except KeyboardInterrupt:
            self.close()
            raise(EOFError(color("[-]: Exited by CTRL+C",'red')))  

My python version: Python 3.8.7

maybe you need to set timeout, because context.timeout=512 by default.