msfproxy using new database scheme
git-svn-id: file:///home/svn/framework3/trunk@8334 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
a5b4de7e45
commit
6303c4e002
|
@ -31,7 +31,7 @@ defaultport = 8080
|
||||||
defaultip = '0.0.0.0'
|
defaultip = '0.0.0.0'
|
||||||
|
|
||||||
$storedb = false
|
$storedb = false
|
||||||
$storedbpath = './sqlite3.db'
|
$storedbpath = File.join(Msf::Config.get_config_root, 'sqlite3.db')
|
||||||
$tmode = false
|
$tmode = false
|
||||||
$ttarget = ""
|
$ttarget = ""
|
||||||
$tssl = false
|
$tssl = false
|
||||||
|
@ -271,7 +271,15 @@ module HttpProxy
|
||||||
|
|
||||||
# Using $db as connection
|
# Using $db as connection
|
||||||
Thread.new{
|
Thread.new{
|
||||||
$db.execute( "insert into requests values ( ?,?,?,?,?,?,?,?,?,?,?,?)",
|
until !$db.transaction_active?
|
||||||
|
puts "Waiting for db"
|
||||||
|
#wait
|
||||||
|
end
|
||||||
|
|
||||||
|
$db.transaction $db.execute( "insert into wmap_requests values ( ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||||
|
nil,
|
||||||
|
@targethost,
|
||||||
|
@targethost,
|
||||||
@targethost,
|
@targethost,
|
||||||
@targetport,
|
@targetport,
|
||||||
sslint,
|
sslint,
|
||||||
|
@ -285,6 +293,8 @@ module HttpProxy
|
||||||
SQLite3::Blob.new(resp.content),
|
SQLite3::Blob.new(resp.content),
|
||||||
Time.new
|
Time.new
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$db.commit
|
||||||
}.join
|
}.join
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -328,6 +338,10 @@ def usage
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
trap("INT") {
|
||||||
|
exit()
|
||||||
|
}
|
||||||
|
|
||||||
$args = Rex::Parser::Arguments.new(
|
$args = Rex::Parser::Arguments.new(
|
||||||
"-a" => [ false, "Print requests: Default false" ],
|
"-a" => [ false, "Print requests: Default false" ],
|
||||||
"-b" => [ false, "Print responses: Default false" ],
|
"-b" => [ false, "Print responses: Default false" ],
|
||||||
|
@ -336,7 +350,8 @@ $args = Rex::Parser::Arguments.new(
|
||||||
"-v" => [ false, "Print requests and responses: Default false" ],
|
"-v" => [ false, "Print requests and responses: Default false" ],
|
||||||
"-i" => [ true, "Listening IP address. Default 0.0.0.0" ],
|
"-i" => [ true, "Listening IP address. Default 0.0.0.0" ],
|
||||||
"-p" => [ true, "Listening proxy port. Default 8080" ],
|
"-p" => [ true, "Listening proxy port. Default 8080" ],
|
||||||
"-w" => [ true, "Store requests to Metasploit database <path>." ],
|
"-d" => [ false, "Store requests to Metasploit database" ],
|
||||||
|
"-w" => [ true, "Metasploit database path" ],
|
||||||
"-t" => [ true, "Transparent mode. http(s)://host:port." ],
|
"-t" => [ true, "Transparent mode. http(s)://host:port." ],
|
||||||
"-m" => [ true, "Load module. path/module.rb."],
|
"-m" => [ true, "Load module. path/module.rb."],
|
||||||
"-h" => [ false, "Display this help information" ])
|
"-h" => [ false, "Display this help information" ])
|
||||||
|
@ -355,11 +370,15 @@ $args.parse(ARGV) { |opt, idx, val|
|
||||||
$printreq = true
|
$printreq = true
|
||||||
$printres = true
|
$printres = true
|
||||||
$printcon = true
|
$printcon = true
|
||||||
|
when "-d"
|
||||||
|
$storedb = true
|
||||||
|
puts "Storing requests in #{$storedbpath}."
|
||||||
|
$db = SQLite3::Database.new($storedbpath)
|
||||||
when "-w"
|
when "-w"
|
||||||
$storedbpath = val
|
$storedbpath = val
|
||||||
$storedb = true
|
$storedb = true
|
||||||
puts "Storing requests in #{$storedbpath}."
|
puts "Storing requests in #{$storedbpath}."
|
||||||
$db = SQLite3::Database.new($storedbpath)
|
$db = SQLite3::Database.new($storedbpath)
|
||||||
when "-i"
|
when "-i"
|
||||||
defaultip = val
|
defaultip = val
|
||||||
when "-m"
|
when "-m"
|
||||||
|
|
Loading…
Reference in New Issue