Files
metasploit-gs/data/msfweb/app/controllers/console_controller.rb
T
HD Moore 4bd5580784 Updates for the web interface
git-svn-id: file:///home/svn/framework3/trunk@4287 4d416f70-5f16-0410-b530-b9f4589650da
2007-01-19 08:46:06 +00:00

31 lines
677 B
Ruby

# Author: LMH <lmh@info-pull.com>
# Description: The AJAX console controller of msfweb v.3. Handles commands,
# operations and sessions carried over the web interface.
class ConsoleController < ApplicationController
#
# Show the working shell and related facilities.
#
def index
cid = params[:id]
if (not (cid and $msfweb.consoles[cid]))
cid = $msfweb.create_console
redirect_to :id => cid
return
end
@cid = params[:id]
@console = $msfweb.consoles[@cid]
if(params[:cmd])
if (params[:cmd].strip.length > 0)
@console.write(params[:cmd] + "\n")
end
send_data(@console.read(), :type => "application/octet-stream")
end
end
end