Add save-as feature
The tool produces A LOT OF results so it's really painful to manually copy and paste and to be able to use the data. So it should automatically save. Tagging the issue here because I forgot to do it: Fix #4039
This commit is contained in:
parent
f34ad57199
commit
3310342a95
|
@ -47,6 +47,7 @@ filters = ['all','exploit','payload','post','nop','encoder','auxiliary']
|
||||||
type ='ALL'
|
type ='ALL'
|
||||||
match = nil
|
match = nil
|
||||||
check = false
|
check = false
|
||||||
|
save = nil
|
||||||
|
|
||||||
opts = Rex::Parser::Arguments.new(
|
opts = Rex::Parser::Arguments.new(
|
||||||
"-h" => [ false, "Help menu." ],
|
"-h" => [ false, "Help menu." ],
|
||||||
|
@ -56,6 +57,7 @@ opts = Rex::Parser::Arguments.new(
|
||||||
"-f" => [ true, "Filter based on Module Type [All,Exploit,Payload,Post,NOP,Encoder,Auxiliary] (Default = ALL)."],
|
"-f" => [ true, "Filter based on Module Type [All,Exploit,Payload,Post,NOP,Encoder,Auxiliary] (Default = ALL)."],
|
||||||
"-t" => [ true, "Type of Reference to sort by #{types.keys}"],
|
"-t" => [ true, "Type of Reference to sort by #{types.keys}"],
|
||||||
"-x" => [ true, "String or RegEx to try and match against the Reference Field"],
|
"-x" => [ true, "String or RegEx to try and match against the Reference Field"],
|
||||||
|
"-o" => [ false, "Save the results to a file"]
|
||||||
)
|
)
|
||||||
|
|
||||||
flags = []
|
flags = []
|
||||||
|
@ -95,6 +97,9 @@ opts.parse(ARGV) { |opt, idx, val|
|
||||||
when "-x"
|
when "-x"
|
||||||
flags << "Regex: #{val}"
|
flags << "Regex: #{val}"
|
||||||
match = Regexp.new(val)
|
match = Regexp.new(val)
|
||||||
|
when "-o"
|
||||||
|
flags << "Output to file: Yes"
|
||||||
|
save = val
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,6 +151,17 @@ def is_url_alive?(uri)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def save_results(path, results)
|
||||||
|
begin
|
||||||
|
File.new(path, 'wb') do |f|
|
||||||
|
f.write(results)
|
||||||
|
end
|
||||||
|
puts "Results saved to: #{path}"
|
||||||
|
rescue
|
||||||
|
puts "Failed to save the file"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Always disable the database (we never need it just to list module
|
# Always disable the database (we never need it just to list module
|
||||||
# information).
|
# information).
|
||||||
framework_opts = { 'DisableDatabase' => true }
|
framework_opts = { 'DisableDatabase' => true }
|
||||||
|
@ -220,3 +236,5 @@ puts
|
||||||
puts tbl.to_s
|
puts tbl.to_s
|
||||||
puts
|
puts
|
||||||
puts "Number of bad references found: #{bad_refs_count}"
|
puts "Number of bad references found: #{bad_refs_count}"
|
||||||
|
|
||||||
|
save_results(save, tbl.tos) if save
|
||||||
|
|
Loading…
Reference in New Issue