Guest User

Untitled

a guest
Nov 29th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import sys
  2. import msfrpc
  3. import time
  4.  
  5. if __name__ == '__main__':
  6.  
  7. client = msfrpc.Msfrpc({})
  8.  
  9. client.login(user='msf', password='mypass')
  10.  
  11.  
  12.  
  13. res = client.call('console.create')
  14. console_id = res['id']
  15. print "res: %s" %res
  16.  
  17.  
  18. a = client.call('console.write', [console_id, "use auxiliary/scanner/snmp/snmp_loginn"])
  19. time.sleep(1)
  20.  
  21. time.sleep(1)
  22. a = client.call('console.write', [console_id, "runn"])
  23. time.sleep(5)
  24.  
  25. while True:
  26. res = client.call('console.read',[console_id])
  27. if len(res['data']) > 1:
  28. print res['data'],
  29.  
  30. if res['busy'] == True:
  31. time.sleep(1)
  32. continue
  33.  
  34. break
  35.  
  36. cleanup = client.call('console.destroy',[console_id])
  37. print "Cleanup result: %s" %cleanup['result']
Add Comment
Please, Sign In to add comment