Delete Operation Shadow Watcher/SDP.py
This commit is contained in:
@@ -1,252 +0,0 @@
|
|||||||
import time
|
|
||||||
import os
|
|
||||||
import cv2
|
|
||||||
import random
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from watchdog.observers import Observer
|
|
||||||
from watchdog.events import FileSystemEventHandler
|
|
||||||
from plyer import notification
|
|
||||||
from datetime import datetime
|
|
||||||
from threading import Thread, Lock
|
|
||||||
|
|
||||||
useMessCamo = False
|
|
||||||
# Message Camo
|
|
||||||
def messCamo(text, yesorno):
|
|
||||||
if yesorno:
|
|
||||||
text = text.replace("Created", "Deployed")
|
|
||||||
text = text.replace("Modified", "In Action")
|
|
||||||
text = text.replace("Deleted", "Extracted")
|
|
||||||
|
|
||||||
text = text.replace("Logging", "SAS")
|
|
||||||
text = text.replace("Log", "BlackOps")
|
|
||||||
text = text.replace("Text", "Transmission")
|
|
||||||
text = text.replace("Client", "FieldAgent")
|
|
||||||
text = text.replace("MOD", "Command")
|
|
||||||
text = text.replace("Peer2Peer", "CovertChannel")
|
|
||||||
text = text.replace("Senso", "Surveillance")
|
|
||||||
text = text.replace("dll", "Directive")
|
|
||||||
text = text.replace("Extensions", "Attachments")
|
|
||||||
text = text.replace("Serilog", "SignalLog")
|
|
||||||
text = text.replace("AssemblyName", "OperationName")
|
|
||||||
text = text.replace("Crypto", "Cipher")
|
|
||||||
text = text.replace("BouncyCastle", "Stronghold")
|
|
||||||
text = text.replace("Microsoft", "Megacorp")
|
|
||||||
text = text.replace("Modules", "Units")
|
|
||||||
text = text.replace("Feedback", "Debriefing")
|
|
||||||
text = text.replace("Message", "CipherText")
|
|
||||||
text = text.replace("Common", "StandardIssue")
|
|
||||||
text = text.replace("Management", "Command")
|
|
||||||
text = text.replace("Formatters", "Encoders")
|
|
||||||
text = text.replace("Json", "Jupiter")
|
|
||||||
text = text.replace("json", "jupiter")
|
|
||||||
text = text.replace("NetworkFilter", "Barricade")
|
|
||||||
text = text.replace("deps", "Assets")
|
|
||||||
text = text.replace("FilterBridge", "Bridgehead")
|
|
||||||
text = text.replace("Pipelines", "Comms")
|
|
||||||
text = text.replace("System", "Apparatus")
|
|
||||||
text = text.replace("Engine", "Propulsion")
|
|
||||||
text = text.replace("Notifications", "Alerts")
|
|
||||||
text = text.replace("AzureAD", "AlphaDelta")
|
|
||||||
text = text.replace("Broker", "Handler")
|
|
||||||
text = text.replace("Modcache", "Safehouse")
|
|
||||||
text = text.replace("RemoteScreen", "Oversight")
|
|
||||||
text = text.replace("DirectX", "DirectiveX")
|
|
||||||
text = text.replace("Vortice", "Vortex")
|
|
||||||
text = text.replace("libwebp", "IntelWeb")
|
|
||||||
text = text.replace("libsharpyuv", "IntelSharp")
|
|
||||||
text = text.replace("store-journal", "MissionLog")
|
|
||||||
text = text.replace("store", "Reserve")
|
|
||||||
text = text.replace("store-journal", "MissionLog")
|
|
||||||
text = text.replace("Command_Policies", "EngagementRules")
|
|
||||||
text = text.replace("Sharpgen", "Nitrogen")
|
|
||||||
text = text.replace("Runtime", "MissionClock")
|
|
||||||
text = text.replace("Abstractions", "FaultyDebriefing")
|
|
||||||
text = text.replace("protobuf-net", "Bumper")
|
|
||||||
text = text.replace("SIPSorceryMedia", "Radio")
|
|
||||||
text = text.replace("Direct3D11", "Directive-3-Delta-Eleven")
|
|
||||||
return text
|
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Unit Determination
|
|
||||||
def unitdetermine(unitname):
|
|
||||||
unittype = random.randint(1, 3)
|
|
||||||
if unittype == 1:
|
|
||||||
unitname = str(random.randint(21, 23)) + " SAS"
|
|
||||||
elif unittype == 2:
|
|
||||||
unitname = "Task Force " + str(random.randint(0, 200)).zfill(3)
|
|
||||||
else:
|
|
||||||
unitname = "Overlord"
|
|
||||||
return unitname
|
|
||||||
|
|
||||||
# Replace UUID
|
|
||||||
def uuidreplace(inpo):
|
|
||||||
uuid_pattern = re.compile(r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}', re.IGNORECASE)
|
|
||||||
modified_text = uuid_pattern.sub(unitdetermine("testificate"), inpo)
|
|
||||||
return modified_text
|
|
||||||
# ---------------- CONFIG ----------------
|
|
||||||
|
|
||||||
WATCH_DIR = r"C:\Program Files\Renato Software\Senso.Cloud.Client"
|
|
||||||
LOG_FILE = "DATETIME.txt"
|
|
||||||
|
|
||||||
BATCH_WINDOW = 10 # Seconds between notification flushes
|
|
||||||
LATEST_COUNT = 3 # How many recent changes to show if no priority items
|
|
||||||
MAX_PRIORITY_SHOWN = 10 # Max priority items shown per notification
|
|
||||||
MAX_NOTIFY_LENGTH = 256 # Windows balloon tip max length
|
|
||||||
|
|
||||||
# 🔥 Priority keywords (case-insensitive)
|
|
||||||
PRIORITY_WORDS = ["MOD", "REMOTECONTROL", "PEER2PEER", "REMOTESCREEN"]
|
|
||||||
|
|
||||||
# ---------------- STATE ----------------
|
|
||||||
|
|
||||||
change_buffer = []
|
|
||||||
buffer_lock = Lock()
|
|
||||||
camera_lock = Lock()
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- CAMERA ----------------
|
|
||||||
|
|
||||||
def blink_camera_light(blink_time=0.7):
|
|
||||||
try:
|
|
||||||
cap = cv2.VideoCapture(0, cv2.CAP_DSHOW)
|
|
||||||
if cap.isOpened():
|
|
||||||
ret, _ = cap.read()
|
|
||||||
if ret:
|
|
||||||
time.sleep(blink_time)
|
|
||||||
cap.release()
|
|
||||||
cv2.destroyAllWindows()
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Blanche: {e}")
|
|
||||||
|
|
||||||
|
|
||||||
def async_camera_blink():
|
|
||||||
def _blink():
|
|
||||||
with camera_lock: # prevents webcam thread flooding
|
|
||||||
blink_camera_light()
|
|
||||||
Thread(target=_blink, daemon=True).start()
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- LOGGING ----------------
|
|
||||||
|
|
||||||
def log_change(action, filepath):
|
|
||||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
||||||
entry = f"[{timestamp}] {action.upper()}: {filepath}\n"
|
|
||||||
with open(LOG_FILE, "a", encoding="utf-8") as f:
|
|
||||||
f.write(entry)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- PRIORITY ----------------
|
|
||||||
|
|
||||||
def priority_score(entry: str) -> int:
|
|
||||||
upper = entry.upper()
|
|
||||||
return sum(1 for word in PRIORITY_WORDS if word in upper)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- NOTIFICATION FLUSH ----------------
|
|
||||||
|
|
||||||
def flush_notifications():
|
|
||||||
while True:
|
|
||||||
time.sleep(BATCH_WINDOW)
|
|
||||||
|
|
||||||
with buffer_lock:
|
|
||||||
if not change_buffer:
|
|
||||||
continue
|
|
||||||
|
|
||||||
scored = [(priority_score(c), i, c) for i, c in enumerate(change_buffer)]
|
|
||||||
priority_items = [item for item in scored if item[0] > 0]
|
|
||||||
|
|
||||||
if priority_items:
|
|
||||||
# sort by descending priority then original order
|
|
||||||
priority_items.sort(key=lambda x: (-x[0], x[1]))
|
|
||||||
shown = [c for _, _, c in priority_items[:MAX_PRIORITY_SHOWN]]
|
|
||||||
omitted = len(priority_items) > MAX_PRIORITY_SHOWN
|
|
||||||
else:
|
|
||||||
shown = change_buffer[-LATEST_COUNT:]
|
|
||||||
omitted = len(change_buffer) > len(shown)
|
|
||||||
|
|
||||||
change_buffer.clear()
|
|
||||||
|
|
||||||
message = "\n".join(shown)
|
|
||||||
if omitted:
|
|
||||||
message += "\n..."
|
|
||||||
message = messCamo(message, useMessCamo)
|
|
||||||
# 🔹 Truncate message safely for Windows balloon notifications
|
|
||||||
if len(message) > MAX_NOTIFY_LENGTH:
|
|
||||||
message = message[:MAX_NOTIFY_LENGTH - 3] + "..."
|
|
||||||
|
|
||||||
|
|
||||||
notification.notify(
|
|
||||||
title="(MY OMG PROGRAM) HI!!!!!!!!!!",
|
|
||||||
message=message,
|
|
||||||
timeout=5
|
|
||||||
)
|
|
||||||
|
|
||||||
print("Mike Sierra.")
|
|
||||||
print(messCamo(message, useMessCamo))
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- FILE WATCHER ----------------
|
|
||||||
|
|
||||||
class ChangeHandler(FileSystemEventHandler):
|
|
||||||
def on_any_event(self, event):
|
|
||||||
action = event.event_type.capitalize()
|
|
||||||
filepath = event.src_path
|
|
||||||
filename = os.path.basename(filepath)
|
|
||||||
|
|
||||||
# Write log immediately
|
|
||||||
log_change(action, filepath)
|
|
||||||
|
|
||||||
# Flash camera immediately (async, safe)
|
|
||||||
async_camera_blink()
|
|
||||||
|
|
||||||
entry = "Radio: " + unitdetermine("test") + f" reports that {filename} is {action}"
|
|
||||||
|
|
||||||
with buffer_lock:
|
|
||||||
change_buffer.append(entry)
|
|
||||||
|
|
||||||
log_entry = f"Radio: {unitdetermine('test')} reports that {filename} is {action}"
|
|
||||||
print(messCamo(uuidreplace(log_entry), useMessCamo))
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------- MAIN ----------------
|
|
||||||
RED = "\033[31m"
|
|
||||||
RESET = "\033[0m"
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
# print(f"👀 Monitoring: {WATCH_DIR}")
|
|
||||||
# print(f"📝 Logging to: {os.path.abspath(LOG_FILE)}")
|
|
||||||
# print(f"🔥 Priority words: {', '.join(PRIORITY_WORDS)}")
|
|
||||||
print(f"👀 MY OMG PROGRAM")
|
|
||||||
print(f"📝 Press x y and z to do stuff (unfinished)")
|
|
||||||
print(f"PS not finished nothing will work SO MANY ERRORS")
|
|
||||||
print(f"lol hiiiiiiiiiiiiiiiiiiiiiiiiiii")
|
|
||||||
time.sleep(2)
|
|
||||||
print(RED + messCamo("ERROR: FILE IS NOT AT {WATCH_DIR}", useMessCamo))
|
|
||||||
print(messCamo("ERROR: MODULE DATETIME WAS NOT FOUND AT {os.path.abspath(LOG_FILE)}", useMessCamo))
|
|
||||||
print(messCamo("ERROR: MODULES {', '.join(PRIORITY_WORDS)} NOT FOUND", useMessCamo) + RESET)
|
|
||||||
password = input("WHAT WAS THE PASSWORD?! > ")
|
|
||||||
if password == "Papa-Seven-Mike-Juliett":
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Ensure log file exists
|
|
||||||
if not os.path.exists(LOG_FILE):
|
|
||||||
with open(LOG_FILE, "w", encoding="utf-8") as f:
|
|
||||||
f.write("=== DATETIME ===\n")
|
|
||||||
|
|
||||||
observer = Observer()
|
|
||||||
observer.schedule(ChangeHandler(), WATCH_DIR, recursive=True)
|
|
||||||
observer.start()
|
|
||||||
|
|
||||||
# Start fixed-interval notification flusher
|
|
||||||
Thread(target=flush_notifications, daemon=True).start()
|
|
||||||
|
|
||||||
try:
|
|
||||||
while True:
|
|
||||||
time.sleep(1)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
observer.stop()
|
|
||||||
|
|
||||||
observer.join()
|
|
||||||
Reference in New Issue
Block a user