Skip to content

Instantly share code, notes, and snippets.

@stevepeak
Last active December 16, 2015 18:50
Show Gist options
  • Save stevepeak/5481088 to your computer and use it in GitHub Desktop.
Save stevepeak/5481088 to your computer and use it in GitHub Desktop.
Fakes caller id broadcasts

Example broadcasted package ^^<U><S> )$01 I S 0000 G A2 05/17 01:33 PM 770-263-7113 PRIVATE

Content: str.split(" ") results in

  • 0 => Line number
  • 1 => I = inbound, O = outbound
  • 2 => S = Start of call, E = end of call
  • 3 => Duration of call in seconds
  • 4 => G = good caller id check, B = bad
  • 5 => n/a
  • 6 => MM/DD
  • 7 => HH:SS
  • 8 => AM or PM
  • 9 => Phone number (xxx-xxx-xxxx)
  • 10 => Caller Name
# Fake caller id broadcast
MYPORT = 3520
import sys, time, random, datetime
from socket import *
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))
s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
while 1:
line = int(random.random()*8) + 1
number = "%d%d%d-%d%d%d-%d%d%d%d" % tuple([int(random.random()*9)+1 for x in range(10)])
se = 'S' if int(random.random()*10)>4 else 'E'
s.sendto('^^<U><S> )$0%d I %s 0000 G A2 %s %s PRIVATE' % (line, se, datetime.datetime.now().strftime("%m/%d %I:%M %p"), number),
('<broadcast>', MYPORT))
print 'Call!', ('::start::' if se=='S' else '<<end>>'), 'line:', line, 'number:', number
time.sleep(int(random.random()*4) + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment