Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. import SimpleHTTPServer
  2. import SocketServer
  3.  
  4. paths = set()
  5.  
  6.  
  7. class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
  8. def do_GET(self):
  9. paths.add("<a href={}>'[]'</a>".format(self.path))
  10. self.send_response(200)
  11. self.end_headers()
  12. # Detect remote file inclusion
  13. if '=http' in self.path:
  14. print 'RFI detected'
  15. # TODO: Add RFI handler here
  16. # Detect local file inclusion
  17. elif '../../' in self.path:
  18. print 'LFI detected'
  19. # TODO: Add LFI handler here
  20.  
  21. # Collect dorks from attacks
  22. paths.add('<a href="{}">a link?</a><br />'.format(self.path))
  23.  
  24.  
  25. #this method hides links on the website
  26. # Compose the attack surface, adding all dorks
  27. http_doc = """
  28. <html>
  29. <style>
  30. a:link, a:visited, a:active, a:hover{{
  31. color:#000000;
  32. text-decoration:none;
  33. cursor:text;
  34. }}
  35. </style>
  36. --- Dump data for table
  37. <a href='foo.sql'>banana</a><br />
  38. {}
  39. </html>
  40. """.format(
  41. ''.join(paths)
  42. )
  43. # Send response
  44. self.wfile.write(http_doc)
  45.  
  46.  
  47.  
  48. #this will return a new
  49.  
  50.  
  51. if __name__ == '__main__':
  52. SocketServer.TCPServer.allow_reuse_address = True
  53. httpd = SocketServer.TCPServer(('localhost', 8080), Handler)
  54. print "Serving at port 8080"
  55. try:
  56. httpd.serve_forever()
  57. except KeyboardInterrupt:
  58. print 'bye'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement