-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpcap2fuzz.py
More file actions
executable file
·44 lines (30 loc) · 814 Bytes
/
Copy pathpcap2fuzz.py
File metadata and controls
executable file
·44 lines (30 loc) · 814 Bytes
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
#!/usr/bin/python
import sys
import Diameter as dm
from Pdml import PdmlLoader
from Dia import Directory
from struct import unpack, pack
import random
from fuzz import fuzz_msg
import pcapng
if __name__ == '__main__':
random.seed(0)
if len(sys.argv) != 2:
print >>sys.stderr, 'usage: %s <.pcap>' % sys.argv[0]
sys.exit(1)
f = sys.stdout
pcapng.write_shblock(f)
pcapng.write_idblock(f)
pcap = sys.argv[1]
c = PdmlLoader(pcap)
for pdu in c.pdus:
m = dm.Msg.decode(pdu.content)
Directory.tag(m)
pcapng.write_epblock(f, 0, m.encode(), 'No fuzzing', 'inbound')
for mutated, comment in fuzz_msg(m):
mutated.e2e_id = None
mutated.h2h_id = None
raw = mutated.encode()
pcapng.write_epblock(f, 0, raw, comment, 'inbound')
f.flush()
f.close()