-
Notifications
You must be signed in to change notification settings - Fork 10
/
snap-replay.py
52 lines (42 loc) · 1.27 KB
/
snap-replay.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Globals
LOG_FILE = 'logs.txt'
snapchat_aes_key = 'M02cnQ51Ji97vwT4'
DOMAINS = ['feelinsonice-hrd.appspot.com', 'data.flurry.com']
def start(context, flow):
myfile = open(LOG_FILE, 'a')
try:
myfile.write('----- starting replay -----\n')
finally:
myfile.close()
def response(context, flow):
if not (flow.response.request.host in DOMAINS):
return
"""
with open(LOG_FILE,'a') as myfile:
If the data is not from Snapchat, skip analysis.
# TODO: Get fancy with responses.
myfile.write('Response from Snapchat. OOOW\n')
"""
def request(context, flow):
# If the data is not from Snapchat, skip analysis.
if not (flow.request.host in DOMAINS and str(flow.request.path) == '/bq/send'):
return
myfile = open(LOG_FILE, 'a')
try:
form = flow.request.get_form_urlencoded()
myfile.write('before: ' + str(form['recipient']) + '\n')
# Change time to 10 seconds.
form['time'] = ['10']
# Replace recipient list with our user list.
form['recipient'] = ['incion, acotenoff']
# Re-encode the form for sending.
flow.request.set_form_urlencoded(form)
myfile.write('after: ' + str(form['recipient']) + '\n')
finally:
myfile.close()
def end(context, flow):
myfile = open(LOG_FILE, 'a')
try:
myfile.write('----- ending interception -----\n')
finally:
myfile.close()