-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontrol.py
More file actions
55 lines (37 loc) · 1.49 KB
/
Copy pathcontrol.py
File metadata and controls
55 lines (37 loc) · 1.49 KB
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
# In order to write this parser at home, I needed bytes objects (in the
# formatting as seen in lab). The easiest way I found to do this was to save
# the bytes object as a string (using bytes.hex() function) to a text file.
# There are better ways to do this, but this was for testing only and is
# not meant for production use.
#
# The sdnParser and printPKTinfo libraries will be used just as
# they would be in lab, taking in bytes objects
#
# please see each imported library for more information
#
# This is used for testing only
#
from PPP.functions import print_Packet
from PPP.functions import parse_Packet
from PPP.functions import make_library
from PPP.functions import john_hexdump
import os
# uncomment this make_library function to create files at ~/Documents/PPP/ that
# contain descriptions for MAC addresses and other data values
# make_library.make_library()
location = 'PPP/library/tests.txt'
packets = open(location,'r').readlines()
# for each line in the text file,
# ex hex_string = 'ff59a300c763a8f2' (type: string)
for hex_string in packets[2:]:
os.system('clear')
# convert the line into it's intended bytes object
pkt = bytes.fromhex(hex_string)
# create an object with the packet's information parsed
Packet = parse_Packet.Parser(pkt)
# print the objects information to console
print_Packet.Printer(Packet)
# print(john_hexdump.john_hexdump(pkt,32,8,'_'))
break
# input('Press enter to continue.')
# print('End of file reached.')