Tidying up some of the in-built console shell interface

This commit is contained in:
Christian Frichot
2011-11-27 18:46:26 +08:00
parent 25206bddc8
commit af7becdfc3
2 changed files with 28 additions and 6 deletions

View File

@@ -67,7 +67,7 @@ class Core
print_status("Move back one step")
end
def cmd_exit
def cmd_exit(* args)
driver.stop
end
@@ -92,10 +92,12 @@ class Core
print_error("no such job")
else
#This is a special job, that has to be terminated different prior to cleanup
driver.http_hook_server.stop if driver.jobs[val].name == "http_hook_server"
print_line("Stopping job: #{val}...")
driver.jobs.stop_job(val)
if driver.jobs[val].name == "http_hook_server"
print_line("Nah uh uh - can't stop this job ya BeEF head!")
else
print_line("Stopping job: #{val}...")
driver.jobs.stop_job(val)
end
end
when "-l"
cmd_jobs_list
@@ -206,6 +208,16 @@ class Core
return
end
onlinezombies = []
BeEF::Core::Models::HookedBrowser.all(:lastseen.gt => (Time.new.to_i - 30)).each do |zombie|
onlinezombies << zombie.id
end
if not onlinezombies.include?(args[0].to_i)
print_status("Browser does not appear to be online..")
return false
end
if not driver.interface.settarget(args[0]).nil?
if (driver.dispatcher_stack.size > 1 and
@@ -239,6 +251,16 @@ class Core
return
end
offlinezombies = []
BeEF::Core::Models::HookedBrowser.all(:lastseen.lt => (Time.new.to_i - 30)).each do |zombie|
offlinezombies << zombie.id
end
if not offlinezombies.include?(args[0].to_i)
print_status("Browser does not appear to be offline..")
return false
end
if not driver.interface.setofflinetarget(args[0]).nil?
if (driver.dispatcher_stack.size > 1 and
driver.current_dispatcher.name != 'Core')

View File

@@ -403,7 +403,7 @@ class ShellInterface
end
# set and add the System Platform
system_platform = BD.get(zombie_session, 'SystemPlatform')
system_platform = BD.get(self.targetsession, 'SystemPlatform')
if not system_platform.nil?
encoded_system_platform = CGI.escapeHTML(system_platform)
encoded_system_platform_hash = { 'System Platform' => encoded_system_platform }