blob: f937ff62581725f76846ccfbc011a523435af1f6 (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
from pathlib import Path
import random
import time
import hashlib
from datetime import datetime
# =========================
# CONFIG
# =========================
HOME = Path.home()
TARGET_DIRS = [
HOME / "Documents",
HOME / "Downloads",
HOME / "Desktop"
]
BAIT_FILES = [
"backup_passwords.txt",
"server_keys.txt",
"old_config.txt",
"notes_admin.txt",
"wallet_backup.txt"
]
LOG_FILE = HOME / ".wiretrip_log.txt"
SCAN_INTERVAL = 2
file_hashes = {}
# =========================
# SETUP BAIT FILES
# =========================
def deploy_decoys():
for _ in range(len(BAIT_FILES)):
folder = random.choice(TARGET_DIRS)
filename = random.choice(BAIT_FILES)
path = folder / filename
if not path.exists():
path.write_text("SYSTEM BACKUP FILE - DO NOT MODIFY\n")
print(f"[WireTrip] deployed -> {path}")
# =========================
# HASHING
# =========================
def hash_file(path):
try:
h = hashlib.sha256()
h.update(path.read_bytes())
return h.hexdigest()
except:
return None
# =========================
# LOGGING
# =========================
def log_event(path):
entry = f"[{datetime.now()}] ACCESS DETECTED -> {path}\n"
with open(LOG_FILE, "a") as f:
f.write(entry)
print(entry.strip())
# =========================
# INITIAL STATE
# =========================
def init_state():
for folder in TARGET_DIRS:
for file in folder.glob("*"):
if file.is_file():
file_hashes[file] = hash_file(file)
# =========================
# MONITOR LOOP
# =========================
def monitor():
while True:
for folder in TARGET_DIRS:
for file in folder.glob("*"):
if file.is_file():
current = hash_file(file)
if file not in file_hashes:
file_hashes[file] = current
continue
if file_hashes[file] != current:
log_event(file)
file_hashes[file] = current
time.sleep(SCAN_INTERVAL)
# =========================
# BANNER
# =========================
def banner():
print("""
========================
WIRETRIP
Deception IDS (Lab Tool)
========================
""")
# =========================
# MAIN
# =========================
def main():
banner()
print("[*] Deploying decoy files...")
deploy_decoys()
print("[*] Initializing state...")
init_state()
print("[*] Monitoring system...\n")
monitor()
if __name__ == "__main__":
main()
|