-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimpostor.py
executable file
·58 lines (49 loc) · 1.71 KB
/
impostor.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
52
53
54
55
56
57
58
#!/usr/bin/python
"""
Modifies the TCP stack in order to impersonate other operating systems. Based on Craig
Heffner's Security Cloak software.
https://web.archive.org/web/20061202015837/http://www.craigheffner.com/security/
"""
import configparser
import os
import sys
profiles = configparser.ConfigParser()
profiles.read('profiles.ini')
selected_profile = str(sys.argv[1])
if __name__ == "__main__":
# TCP stack options
ttl = profiles[selected_profile]['ttl']
timestamp = profiles[selected_profile]['stamp']
pmtu = profiles[selected_profile]['pmtu']
urgent = profiles[selected_profile]['urg']
window_size = profiles[selected_profile]['window']
sack = profiles[selected_profile]['sack']
# Interface options
interface = None
mtu_size = profiles[selected_profile]['mtu']
vendor_mac = None
print(f"""
Using Profile: {selected_profile}
=============================================
TTL = {ttl}
Enable Timestamp = {timestamp}
Enable PMTU = {pmtu}
Urgent Pointer = {urgent}
Window Size = {window_size}
SACK = {sack}
MTU = {mtu_size}
""")
# set TCP TTL
os.system(f'sysctl net.ipv4.ip_default_ttl={ttl}')
# set TCP timestamp
os.system(f'sysctl -w net.ipv4.tcp_timestamps={timestamp}')
# enable/disable PMTU
os.system(f'echo {pmtu} >/proc/sys/net/ipv4/ip_no_pmtu_disc')
# set Urgent Pointer field
os.system(f'echo {urgent} >/proc/sys/net/ipv4/tcp_stdurg')
# set window size
os.system(f'sysctl -w net.ipv4.tcp_wmem="4096 {window_size} 4194304"')
# enable/disable sack
os.system(f'echo {sack} > /proc/sys/net/ipv4/tcp_sack')
#set mtu
#os.system(f'ifconfig {interface} mtu {mtu_size} up')