enum.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/usr/bin/env python2.7
  2. # -*- encoding: utf-8 -*-
  3. #
  4. # author: mrxrobot
  5. # contact: IRC -> Freenode -> #vivaolinux
  6. #
  7. """
  8. This is free and unencumbered software released into the public domain.
  9. Anyone is free to copy, modify, publish, use, compile, sell, or
  10. distribute this software, either in source code form or as a compiled
  11. binary, for any purpose, commercial or non-commercial, and by any
  12. means.
  13. In jurisdictions that recognize copyright laws, the author or authors
  14. of this software dedicate any and all copyright interest in the
  15. software to the public domain. We make this dedication for the benefit
  16. of the public at large and to the detriment of our heirs and
  17. successors. We intend this dedication to be an overt act of
  18. relinquishment in perpetuity of all present and future rights to this
  19. software under copyright law.
  20. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  23. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  24. OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  25. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  26. OTHER DEALINGS IN THE SOFTWARE.
  27. For more information, please refer to <http://unlicense.org/>
  28. """
  29. import socket
  30. import sys
  31. from re import search
  32. class Connect:
  33. def __init__(self, ip, port, wordlist):
  34. self.ip = str(ip)
  35. self.port = int(port)
  36. self.wordlist = open(str(wordlist)).readlines()
  37. self.p = ""
  38. self.d = ""
  39. def Sock(self):
  40. self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  41. self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  42. self.s.connect((self.ip, self.port))
  43. def Send_all(self):
  44. for line in self.wordlist:
  45. self.Sock()
  46. self.s.send("GET /{s}{p} HTTP/1.0\n\n".format(s=line.strip("\r\n"), p=self.p))
  47. self.resp = self.s.recv(1024)
  48. if search("200 OK", self.resp):
  49. self.code = self.resp.split(' ')[1]
  50. print("[+] [{c}] http://{ip}:{port}/{s}{d}".format(ip=self.ip, port=self.port, s=line.strip("\r\n"), c=self.code, d=self.d))
  51. def Show_arch(self):
  52. print("=> Archives <" + 100 * "=")
  53. self.p = ""
  54. self.d = ""
  55. self.Send_all()
  56. def Show_file(self):
  57. print("=> Files <"+ 100 * "=")
  58. self.p = "/"
  59. self.d = "/"
  60. self.Send_all()
  61. if len(sys.argv) < 4:
  62. print("Usage: pyhton %s ip port wordlist_file.txt" %sys.argv[0])
  63. sys.exit(0)
  64. a = Connect(ip=sys.argv[1], port=sys.argv[2], wordlist=sys.argv[3])
  65. a.Show_arch()
  66. a.Show_file()
  67. """
  68. The software works by analyzing the HTTP response codes
  69. If a resource that is requested to the Servirdor exists, the HTTP response will return a code 200
  70. Example usage:
  71. python enum.py 127.0.0.1 80 /home/seu_usuario/wordlist.txt
  72. exemple of wordlist:
  73. adm.txt
  74. robots.txt
  75. enum.py
  76. update.apk
  77. index.html
  78. manual
  79. htdig
  80. license
  81. wp-admin
  82. wp-login
  83. admin
  84. exemple:
  85. out:
  86. => Archives <====================================================================================================
  87. [+] [200] http://127.0.0.1:80/update.apk
  88. [+] [200] http://127.0.0.1:80/index.html
  89. [+] [200] http://127.0.0.1:80/robots.txt
  90. => Files <====================================================================================================
  91. [+] [200] http://127.0.0.1:80/manual/
  92. [+] [200] http://127.0.0.1:80/htdig/
  93. [+] [200] http://127.0.0.1:80/wp-admin/
  94. [+] [200] http://127.0.0.1:80/admin/
  95. """