metasploit-framework/lib/sqlmap/sqlmap_manager.rb

51 lines
1.3 KiB
Ruby
Raw Normal View History

2014-07-04 15:53:14 +00:00
require 'json'
module Sqlmap
class Manager
def initialize(session)
@session = session
end
def new_task
2014-07-21 23:04:36 +00:00
res = @session.get('/task/new')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def delete_task(task_id)
2014-07-21 23:04:36 +00:00
res = @session.get('/task/' + task_id + '/delete')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def set_option(task_id, key, value)
post = { key => value }
2014-07-21 23:04:36 +00:00
res = @session.post('/option/' + task_id + '/set', nil, post.to_json, {'ctype' => 'application/json'})
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def get_options(task_id)
2014-07-21 23:04:36 +00:00
res = @session.get('/option/' + task_id + '/list')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def start_task(task_id, options = {})
2014-07-21 23:04:36 +00:00
res = @session.post('/scan/' + task_id + '/start' , nil, options.to_json, {'ctype' => 'application/json'})
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def get_task_status(task_id)
2014-07-21 23:04:36 +00:00
res = @session.get('/scan/' + task_id + '/status')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def get_task_log(task_id)
2014-07-21 23:04:36 +00:00
res = @session.get('/scan/' + task_id + '/log')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
def get_task_data(task_id)
2014-07-21 23:04:36 +00:00
res = @session.get('/scan/' + task_id + '/data')
2014-07-04 15:53:14 +00:00
return JSON.parse(res.body)
end
end
end