Jump to content

Recommended Posts

Hello, recently I made a new encryption for python files, and here I am to share it with you

 

file2encrypt = "constinfo.py"
fileOut = "%s_encrypted.py" % (file2encrypt[:len(file2encrypt)-3])

content = ""
for line in open(file2encrypt,"r").readlines():
	for i in xrange(100):
		content += chr(9)
	content += line
	
open(fileOut,"w").write(content)

you can change encryption type by modifying the for loop

 

Have fun guys

  • Lmao 2
  • Scream 1
  • Think 1
Link to post
Spoiler

 

file2encrypt = "constinfo" + "*py"
fileOut = "%s_encrypted" + "*py" && % (file2encrypt[:len(file2encrypt)-3*2/1+5])

content = ""
for line in open(file2encrypt,"r").readlines():
	for i in xrange(100):
		content += chr(9)
	content += line
	
open(fileOut,"file2encrypt" + "file2crypt").write(xrange)

 

 

Looks Better.

 

Thank you very much, will help a lot People.

 

 

Edited by Ace (see edit history)
Link to post

Nice one, but there is nothing better for python files than cythonizing them.

Even tho that xrange could be replaceable with N * chr(9)

Spoiler

So the final pure oneline code is:

file2encrypt = "constinfo.py"
open("%s_encrypted.py" % (file2encrypt[:len(file2encrypt)-3]), "wb").write("".join(map(lambda line:(100*chr(9))+line, open(file2encrypt, "rb").readlines())))

rb/wb because of not to lose the encoding of the files, and neither the original line-endings.

 

Edited by xP3NG3Rx (see edit history)
  • Love 1
Link to post

I was also thinking adding XOR cipher to crypt the strings with a secret key. Its the best protection you should use it.

  • Love 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.