GoogleMe Posted March 25, 2019 Share Posted March 25, 2019 I wanted to know if there is someway to Encrypt a file (python file) with from ex: AES and make the file run within encryption... for example: Making a calculator encrypt it when you open Idle,Pycharm the output is strange symbols and characters ... and that's how no one can see your code and only u can decrypt it if u remember the parameters... is that possible??? thankx anyway Link to comment Share on other sites More sharing options...
PoSHMagiC0de Posted March 26, 2019 Share Posted March 26, 2019 Okay, I will bite. Yes you can. Powersploit has a module to do it for Powershell as well. For python, there is cool function called exec() that will run a string as python code. Of course it has to be valid python code. Similar to the "invoke-expression" for Powershell. So, what works in Posh, works in Pyth. You can encrypt your code with a key and convert it to base 64 string. That string will be what you put in a new python function as an assignment to a variable..hard coded assignment. Now, your new function takes the key as an input parameter and when ran the reverse happens. Your code is unbase64, decrypted with key back to a string and then ran with exec(). Link to comment Share on other sites More sharing options...
Garda Posted April 24, 2019 Share Posted April 24, 2019 https://wiki.python.org/moin/Pyarmor Link to comment Share on other sites More sharing options...
Bigbiz Posted April 25, 2019 Share Posted April 25, 2019 Thank u i was woundering why some files ive been looking up look like gshshjskaggisis gibrish when i try to edit them. You answered the question. Link to comment Share on other sites More sharing options...
CYBERING Posted March 2, 2020 Share Posted March 2, 2020 There are two terms you should look up. The first is packers / cryptors. These take some code, hide it in some way, and wrap it in something that decodes and runs it when the application is ran. A very simple example - eval(bytes.fromhex('7072696e74282768656c6c6f20776f726c642729')) Now it would be pretty easy to recover the original script in this case. You can just copy out the stuff being passed to the eval, run it, and see the result. That's where the next concept comes in, obfuscation. This makes the code more difficult to understand. This can mean changes in variable names, control flow, using lesser known features (could we maybe move some functionality into decorators?). These can almost always be broken, but the simple idea is there, and they will generally slow someone down when analyzing your software. Link to comment Share on other sites More sharing options...
Cikimi Posted April 14, 2020 Share Posted April 14, 2020 On 3/3/2020 at 7:16 AM, CYBERING said: There are two terms you should look up. The first is packers / cryptors. These take some code, hide it in some way, and wrap it in something that decodes and runs it when the application is ran. A very simple example - eval(bytes.fromhex('7072696e74282768656c6c6f20776f726c642729')) Now it would be pretty easy to recover the original script in this case. You can just copy out the stuff being passed to the eval, run it, and see the result. That's where the next concept comes in, obfuscation. This makes the code more difficult to understand. This can mean changes in variable names, control flow, using lesser known features (could we maybe move some functionality into decorators?). These can almost always be broken, but the simple idea is there, and they will generally slow someone down when analyzing your software. Well said,thank you. Link to comment Share on other sites More sharing options...
Dragu Posted February 21, 2022 Share Posted February 21, 2022 why need try hide python script. is there something to hide lol. you can allways encrypt any file. openssl aes-256-cbc -a -salt -pbkdf2 -in backdoor.py -out facebookhack.py.enc and then decrypt it and pipe to python openssl aes-256-cbc -d -a -pbkdf2 -in facebookhack.py.enc | python - LOL you got point right xD in reality not work. you need pass phraise decrypth it and your victim not run your code without checking it. they will do openssl aes-256-cbc -d -a -pbkdf2 -in facebookhack.py.enc -out really.py nano really.py Link to comment Share on other sites More sharing options...
Irukandji Posted February 21, 2022 Share Posted February 21, 2022 1 year later... Please check the date before posting.. Link to comment Share on other sites More sharing options...
Dragu Posted February 21, 2022 Share Posted February 21, 2022 ill be back in 2 year xD Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.