Skip to content

Commit 0213bac

Browse files
committedFeb 18, 2016
Log SIP calls made by intruders
1 parent 1416589 commit 0213bac

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎udp_sip.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import StringIO, re, testrun, threading, time, uuid
1717
from termcolor import colored
18-
from utils import tee_received_text, tee_sent_text
18+
from utils import log_append, tee_received_text, tee_sent_text
1919

2020
USER_AGENT = 'Linphone/3.5.2 (eXosip2/3.6.0)'
2121
#USER_AGENT = 'Asterix PBX'
@@ -106,6 +106,15 @@ def handle_udp_sip(socket, data, srcpeername, dstport):
106106
rheaders = { 'From': headers['From'], 'To': headers['To'], 'Call-ID': headers['Call-ID'], 'CSeq': headers['CSeq'] }
107107
rheaders['Via'] = '{};received={}'.format(headers['Via'].replace(';rport', ''), srcpeername[0])
108108
rheaders['User-Agent'] = USER_AGENT
109+
elif method == 'INVITE':
110+
print("The intruder is trying to make a call")
111+
# Pretend we don't understand to stop further interactions
112+
resp = 'SIP/2.0 501 Not Implemented\n'
113+
rheaders = {}
114+
to_hdr = headers.get('To', '')
115+
from_hdr = headers.get('From', '')
116+
ua_hdr = headers.get('User-Agent', '')
117+
log_append('udp_sip_invites', srcpeername[0], to_hdr, from_hdr, ua_hdr)
109118
elif (method == 'ACK' or method == 'BYE'):
110119
resp = 'SIP/2.0 200 OK\n'
111120
rheaders = dict(headers)

0 commit comments

Comments
 (0)
Please sign in to comment.