Jump to content

Encrypting file ---> python

Recommended Posts

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

Share this post

Link to post
Share on other sites

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(). 


Share this post

Link to post
Share on other sites

Thank u i was woundering why some files ive been looking up look like


gibrish when i try to edit them. You answered the question.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...