Guest User

nmap nse exploitdb script

a guest
Oct 20th, 2014
1,372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. #Originally from http://forum.intern0t.org/hacking-tools-utilities/3553-exploitdb-nse-nmap-script.html
  2. #Changed to reflect the exploitdb in kali by MrAgent
  3. #Useage nmap -sV --script=exploitdb.nse xxx.xxx.xxx.xxx
  4.  
  5. description = [[Searches for exploits in the exploitdb on Backtrack. This archive can also be found at http://www.exploitdb.com]]
  6. author = "L10n"
  7. license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
  8. categories = {"safe", "vuln"}
  9.  
  10. require("stdnse")
  11.  
  12. portrule = function(host, port)
  13. return port.state == "open"
  14. end
  15.  
  16. action = function(host, port)
  17. local n = port.version.product
  18. local exploits = ""
  19. for line in io.lines ("/usr/share/exploitdb/files.csv") do
  20. if string.match(line, n) and string.match(line, "remote") then
  21. local items = split(line, ",")
  22. local file = items[2]
  23. local desc = items[3]
  24. exploits = exploits..file.." ---> "..desc.."\n"
  25. end
  26. end
  27. if not string.match(exploits, "\n") then
  28. exploits = nil
  29. end
  30. exploits = " \n"..exploits
  31. return exploits
  32. end
  33.  
  34. function split(str, pat)
  35. local t = {} -- NOTE: use {n = 0} in Lua-5.0
  36. local fpat = "(.-)" .. pat
  37. local last_end = 1
  38. local s, e, cap = str:find(fpat, 1)
  39. while s do
  40. if s ~= 1 or cap ~= "" then
  41. table.insert(t,cap)
  42. end
  43. last_end = e+1
  44. s, e, cap = str:find(fpat, last_end)
  45. end
  46. if last_end <= #str then
  47. cap = str:sub(last_end)
  48. table.insert(t, cap)
  49. end
  50. return t
  51. end
Advertisement
Add Comment
Please, Sign In to add comment