Removal of obsolete views/javascript

git-svn-id: file:///home/svn/framework3/trunk@4443 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2007-02-19 04:06:29 +00:00
parent 692fbc50db
commit d7fda3a701
7 changed files with 3 additions and 291 deletions

View File

@ -9,28 +9,5 @@ class SessionsController < ApplicationController
def list
@sessions = Session.find_all()
end
def stop
end
def interact
cid = params[:id].to_i
$msfweb.connect_session(cid)
if(params[:cmd])
$msfweb.write_session(cid, params[:cmd] + "\n")
end
if (params[:read])
$msfweb.connect_session(cid)
out = $msfweb.read_session(cid) || ''
out = out.unpack('C*').map{|c| sprintf("%%%.2x", c)}.join
script = "// Metasploit Web Session Data\n"
script += "var ses_update = unescape('#{out}');\n"
send_data(script, :type => "text/javascript")
end
end
end

View File

@ -1,50 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Author" content="LMH (lmh@info-pull.com), Metasploit LLC" />
<meta name="Copyright" content="(c) 2006, LMH (lmh@info-pull.com), (c) 2006-2007 Metasploit LLC" />
<title>msfweb v.3 - console demo</title>
<% ["prototype","effects","controls", "window", "application", "session"].each do |js| %>
<%= javascript_include_tag js %><% end %>
<%= stylesheet_link_tag "msfsession" %>
</head>
<body onload="session_init(<%=params[:id]%>)">
<div id="session_window">
<div id="session_output">
</div>
<table id="session_command_bar" border=0 padding=4 cellspacing=0 width='100%'>
<tr>
<td
nowrap='true'
valign='top'
id="session_prompt"
>
&gt;&gt;&nbsp;
</td>
<td nowrap='true' width='100%'>
<textarea
id="session_input"
class="input"
wrap="off"
onkeydown="return session_keydown(event)"
onkeypress="return session_keypress(event)"
rows="1"
></textarea>
</td>
</tr>
</table>
</div>
</body>
</html>

View File

@ -1,2 +0,0 @@
<h1>Sessions#stop</h1>
<p>Find me in app/views/sessions/stop.rhtml</p>

View File

@ -2,7 +2,8 @@
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
ENV['RAILS_ENV'] = 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '1.1.6'

View File

@ -114,7 +114,7 @@ function console_read_output(req) {
function console_update_output(req) {
try { eval(req.responseText); } catch(e){ alert(req.responseText); }
try { eval(req.responseText); } catch(e){ console_printline("!!! An error occurred in the console reader\n"); }
status_free();
@ -127,7 +127,6 @@ function console_update_output(req) {
if(con_update && con_update.length > 0) {
window.scrollTo(0, 10000000);
}
}
function console_update_tabs(req) {

View File

@ -1,213 +0,0 @@
/*
* Copyright (c) 2006 LMH <lmh[at]info-pull.com>
* Added to Metasploit under the terms of the Metasploit Framework License v1.2
* Additions Copyright (C) 2006-2007 Metasploit LLC
*/
var session_id;
var session_history = new Array(); // Commands history
var session_hindex = 0; // Index to current command history
var session_input; // Object to console input
var session_output; // Object to console output
var session_prompt; // Object to console prompt
var session_status;
var session_cmdbar;
// Placeholders
var ses_prompt = "";
var ses_update = "";
var ses_tabbed = "";
// Internal commands
var cmd_internal =
{
help:function() {
session_printline(" Web Session Internal Commands\n");
session_printline("=========================================\n\n");
session_printline(" /help Show this text\n");
session_printline(" /clear Clear the screen\n");
session_printline(" /detach Detach an active session\n");
session_printline(" /kill Abort an active session\n");
session_printline("\n");
},
clear:function() {
session_output.innerHTML = '';
},
detach:function() {
session_printline(">> Detaching active session...\n");
new Ajax.Updater("session_update", document.location, {
asynchronous:true,
evalScripts:true,
parameters:"special=detach"
});
},
kill:function() {
session_printline(">> Killing active session...\n");
new Ajax.Updater("session_update", document.location, {
asynchronous:true,
evalScripts:true,
parameters:"special=kill"
});
}
};
function status_busy() {
session_input.style.color = "red";
}
function status_free() {
session_input.style.color = "white";
}
// This function is based on the excellent example:
// http://tryruby.hobix.com/js/mouseApp.js
function keystroke_block(e) {
e.cancelBubble=true;
e.returnValue = false;
if (window.event && !window.opera) e.keyCode=0;
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
return false;
}
function session_refocus() {
session_input.blur();
session_input.focus();
}
function session_read() {
new Ajax.Updater("session_update", document.location, {
asynchronous:true,
evalScripts:true,
parameters:"read=yes",
onComplete:session_read_output
});
}
function session_printline(s, type) {
if ((s=String(s))) {
var n = document.createElement("div");
// IE has to use innerText
if (n.innerText != undefined) {
n.innerText = s;
// Firefox uses createTextNode
} else {
n.appendChild(document.createTextNode(s));
}
n.className = type;
session_output.appendChild(n);
return n;
}
}
function session_read_output(req) {
// Call the console updated
session_update_output(req);
// Reschedule the session reader
setTimeout(session_read, 1000);
}
function session_update_output(req) {
try { eval(req.responseText); } catch(e){ alert(req.responseText); }
status_free();
if (ses_update.length > 0) {
session_printline(ses_update, 'output_line');
}
session_refocus();
}
function session_keypress(e) {
if (e.keyCode == 13) { // enter
session_input.value = (session_input.value.replace(/^ +/,'')).replace(/ +$/,'');
// ignore duplicate commands in the history
if(session_history[session_history.length-1] != session_input.value) {
session_history.push(session_input.value);
session_hindex = session_history.length - 1;
}
session_printline("\n>> " + session_input.value + "\n\n", 'output_line')
if(session_input.value[0] == '/') {
cmd_name = session_input.value.substring(1);
if(cmd_internal[cmd_name]) {
cmd_internal[cmd_name]();
session_input.value = "";
session_input.focus();
return keystroke_block(e);
}
}
status_busy();
new Ajax.Updater("session_update", document.location, {
asynchronous:true,
evalScripts:true,
parameters:"read=yes&cmd=" + escape(session_input.value),
onComplete:session_update_output
});
session_input.value = "";
session_input.focus();
return keystroke_block(e);
}
}
function session_keydown(e) {
if (e.keyCode == 38) { // up
// TODO: place upper cmd in history on session_input.value
session_input.value = session_history[session_hindex];
if (session_hindex > 0) {
session_hindex--;
}
return keystroke_block(e);
} else if (e.keyCode == 40) { // down
if (session_hindex < session_history.length - 1) {
session_hindex++;
}
session_input.value = session_history[session_hindex];
return keystroke_block(e);
}
}
function session_init(cid) {
session_id = cid;
session_input = document.getElementById("session_input");
session_output = document.getElementById("session_output");
session_prompt = document.getElementById("session_prompt");
session_status = document.getElementById("session_status");
session_cmdbar = document.getElementById("session_command_bar");
session_refocus();
status_free();
session_read();
return true;
}