Package: guardshield
GuardShield (Python security)GuardShield is a Python library that provides robust security measures to protect your Python projects. It offers various detection methods to prevent debugging attempts and ensure secure execution of your code.DiscordInstallationpipinstall--force-reinstallguardshieldUsageImport the library:importguardshieldEnable anti-debugger detection and define custom actions on detection:# Custom function to be executed on debugger detectiondefdebugger_detected():print("Debugger detected!")# Create a Security instance with desired settingsmodule=guardshield.Security(anti_debugger=True,# Enable debugger detectionkill_on_debug=False,# Kill the application on detectiondetect_vm=False,# Call custom function on vm detectiondetect_sandbox=False,# Call custom function on sandbox detectionon_detection=debugger_detected# Execute custom function on detection)# Start the security check loop in a separate threadmodule.check_security()# -> dict { 'detected' : bool, 'description' : str }Perform simple checks:# Check if the application is being debuggedmodule.check_debug()# -> bool# Detect if the application is running within a sandbox environment (e.g., Sandboxie)module.check_sandbox()# -> bool# Terminate the applicationmodule.force_kill()# -> None# Detect if the application is running in vm and rdpmodule.check_vm()# -> bool# Crash user pc with Blue screenmodule.crash_pc()# -> None# Create pc fingerprint / hwidmodule.get_uuid()# -> str# Protect injection / hookingmodule.anti_injection()# -> NoneChange logv1.1.5 â‹® 06/02/2024+ bug fix+ dll injection detection (by bytes)v1.1.4 â‹® 04/02/2024+ bug fix+ pyinject process detection (by name)v1.1.3 â‹® 01/02/2024+ injection protectionv1.1.2 â‹® 01/02/2024+ false detection fixBetter anti injectionhttps://www.youtube.com/watch?v=AP1rasewaUw&ab_channel=oxynSecure Compilation and Protection Against Decompilation and Debugging AttacksTo ensure the security of your executable (.exe) file, it is recommended to avoid using PyInstaller for compilation, as it can be easily reversed. Instead, you can use "Nuitka," a source-to-source compiler that compiles Python code into optimized C source code, making it harder for checkers and reverse engineers to understand and modify your code.Follow these steps to compile your code securely:Obfuscate your code using tools like thePyobfuscatewebsite, which can obfuscate variable names and enhance protection.Import GuardShield to prevent debugging during the execution of your code.Compile the code using Nuitka. Here's an example command:python-mnuitka--follow-imports--onefile--standalone--windows-icon-from-ico=icon.icomain.pyAfter compiling the program, you can also provide it with additional protection using the vmprotect application.By following these steps, your code will be well-protected. However, for the utmost security, consider keeping sensitive parts of your code on the server-side as an API and perform critical operations there. This approach adds an extra layer of protection and makes your application almost unbreakable.Request EncryptionTo enhance the security of your API requests, it is recommended to encrypt the requests or add a fingerprint (custom hash) to the request that can be checked in the application and on the server. Here's an example of AES encryption using theAESCipherclass:importbase64fromCrypto.CipherimportAESfromCryptoimportRandomimporthashlibclassAESCipher(object):def__init__(self,key):self.bs=AES.block_sizeself.key=hashlib.sha256(key.encode()).digest()defencrypt(self,raw):raw=self._pad(raw)iv=Random.new().read(AES.block_size)cipher=AES.new(self.key,AES.MODE_CBC,iv)returnbase64.b64encode(iv+cipher.encrypt(raw.encode()))defdecrypt(self,enc):enc=base64.b64decode(enc)iv=enc[:AES.block_size]cipher=AES.new(self.key,AES.MODE_CBC,iv)returnself._unpad(cipher.decrypt(enc[AES.block_size:])).decode('utf-8')def_pad(self,s):returns+(self.bs-len(s)%self.bs)*chr(self.bs-len(s)%self.bs)@staticmethoddef_unpad(s):returns[:-ord(s[len(s)-1:])]classAes:def__init__(self):self.key="SecKey2115"defdecrypt(self,text,key=None):ifkeyisnotNone:self.key=keyreturnAESCipher(self.key).decrypt(text)defencrypt(self,text,key=None):ifkeyisnotNone:self.key=keyreturnAESCipher(self.key).encrypt(text).decode()You can use theAesclass to encrypt and decrypt your requests using AES encryption. Remember to use a strong and secure key for encryption.TodoAdd sandboxie detectionAdd Vm detectionAdd Better cheat engine detectionAdd DLL injection protectionTests