Skip to content

Commit

Permalink
Changes to ping delay
Browse files Browse the repository at this point in the history
  • Loading branch information
nvssks committed Feb 13, 2015
1 parent a3cc634 commit ef70932
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
Binary file modified bin/proxy.exe
Binary file not shown.
Binary file modified bin/webserver.exe
Binary file not shown.
6 changes: 5 additions & 1 deletion lib/SocksServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, socket, event=threading.Event(), bufferSize=Defaults['buffers
def run(self):
self.event.set() #all done
self.server.listen(50)
self.server.setblocking(True)
wrapper_channel, address = self.server.accept()
self.iserver(wrapper_channel)
wrapper_channel.close()
Expand Down Expand Up @@ -182,7 +183,10 @@ def iserver(self, wrapper_channel):

self.lock.acquire()
try:
wrapper_channel.send((struct.pack('!HH',SocketDict[self.srcPort(s)][0],len(data))+data))
wrapper_channel.send((struct.pack('!HH',SocketDict[self.srcPort(s)][0],len(data))+data))
except (TypeError,socket.error, KeyError) as e:
print "[-] Send Failed:", e
pass
finally:
if debug >4: print "[T] Write to channel releasing 1"
self.lock.release()
Expand Down
6 changes: 3 additions & 3 deletions lib/TunnaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ def Pinging_Thread(self):
print "[+] Starting Ping thread"
#self.ptc=threading.Condition()
wait=True
p=0.5
p=0.1
while 1: #loop forever
if wait:
if wait and (self.ping_delay > 0):
self.ptc.acquire()
self.ptc.wait(self.ping_delay+self.penalty) #send ping to server interval + penalty
self.ptc.release()
Expand Down Expand Up @@ -210,7 +210,7 @@ def __init__(self, url , options):
print "[-] Unknown server OS"

#2nd request: send connection options to webshell - In php this thread will stall
self.t = threading.Thread(target=self.Threaded_request, args=(remote_port,remote_ip))
self.t = threading.Thread(target=self.Threaded_request, args=(remote_port,remote_ip,self.options['useSocks']))
self.t.start() #start the thread

except Exception, e:
Expand Down
6 changes: 5 additions & 1 deletion lib/socks4aServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, socket, event=threading.Event(), bufferSize=Defaults['bufferS
def run(self):
self.event.set() #all done
self.server.listen(50)
self.server.setblocking(True)
wrapper_channel, address = self.server.accept()
self.iserver(wrapper_channel)
wrapper_channel.close()
Expand Down Expand Up @@ -201,7 +202,10 @@ def iserver(self, wrapper_channel):

self.lock.acquire()
try:
wrapper_channel.send((struct.pack('!HH',SocketDict[self.srcPort(s)][0],len(data))+data))
wrapper_channel.send((struct.pack('!HH',SocketDict[self.srcPort(s)][0],len(data))+data))
except (TypeError,socket.error, KeyError) as e:
print "[-] Send Failed:", e
pass
finally:
if debug >4: print "[T] Write to channel releasing 1"
self.lock.release()
Expand Down
3 changes: 3 additions & 0 deletions proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def main():

options=dict(Defaults.items() + vars(args).items()) if args else Defaults #If missing options use Default

if options['remote_port']:
options['useSocks']=False

if not options['local_port']:
parser.print_help()
parser.error("Missing local port")
Expand Down
3 changes: 1 addition & 2 deletions webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ def startSocks(self,session):
if self.debug > 3: print "[Debug] starting socks executable"
#./Uploaded Executable random_port
self.fileRun(session,SocksServerSocket.getsockname()[1])
time.sleep(1)
else: #else start proxy in thread
if self.debug > 3: print "[Debug] starting internal socks"
event = threading.Event()
Expand All @@ -280,7 +279,7 @@ def startSocks(self,session):
event.wait()

session['SocksThread'] = SocksThread

time.sleep(1)
sock = socket.socket()
sock.connect(('localhost',SocksServerSocket.getsockname()[1]))
sock.setblocking(0)
Expand Down

0 comments on commit ef70932

Please sign in to comment.