4bd5580784
git-svn-id: file:///home/svn/framework3/trunk@4287 4d416f70-5f16-0410-b530-b9f4589650da
31 lines
677 B
Ruby
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
|