Encrypt your messages via Python Cryptography!

ZiksthemW

Uzman üye
28 Mar 2020
1,025
113
Oslo

Hi Precious​
THT family, In this thread we will have a look at python cryptography.

images


Firstly, What is Encrypt?

Encrption is a double-sided. A double-sided encryption method means that the password is broken and readable afterwards. If you Encrypt anything and send it to someone else, he can Decrypt that file and see your thing

Let's Encrypt!

Firstly, open your CMD and input "python -m pip install cryptography" then we wait until it's downloaded. When it downloaded it will look like the picture down below

unknown.png


then input "python" and "import cryptography" and close cmd

then open Python IDLE, a screen like below will appear;

unknown.png


then press File at the top left and choose New File, a new window will open, you can close the previous one.

Then type the password generation code to Python IDLE

Password generation code;
Kod:
from cryptography.fernet import Fernet

anahtar = Fernet.generate_key() #let's create our key
print (anahtar) #Anahtarımızı yazdıralım

file = open('anahtar.zikstht', 'wb') #You can change the zikstht
file.write(anahtar) # printing the key in the file
file.close()

After typing this, press Run from above and press Run Module, then another screen will appear. If you haven't changed anything, you will see a file called key.zikstht on your desktop. Do not write anything in it.

To try it out, create a txt file called zikstht.txt on the desktop and write something in it, then run the following code

Encrypt Code;
Kod:
from cryptography.fernet import Fernet

file = open('anahtar.zikstht', 'rb')
key = file.read() # Creating our key
file.close()

with open('zikstht.txt', 'rb') as f: #our file and its extension to encrypt
    data = f.read()

fernet = Fernet(key)
encrypted = fernet.encrypt(data)

#Dosyayı şifreleme
with open('zikssifre.zikstht', 'wb') as f: # You can change the ziksthemw part as you want
    f.write(encrypted)

And our text / code is now encrypted! You can see the encrypted text / code on the desktop as zikssifre.zikstht, To Decrypt our file you need to run the code down below

Decrypt code;
Kod:
from cryptography.fernet import Fernet

file = open('anahtar.zikstht', 'rb')
key = file.read()
file.close()

#Opening the file that we Encrypted
with open('zikssifre.zikstht', 'rb') as f: 
    data = f.read()

fernet = Fernet(key)
encrypted = fernet.decrypt(data)

with open('ziksdecrypt.txt', 'wb') as f: #you can change the .txt
    f.write(encrypted)

And now the password is broken! If you haven't changed the names, there will be a file called ziksdecrypt.txt on your desktop where you have your pure text!

If you have a question or an error occurred send your messages via D.M.

 
Son düzenleme:
Üst

Turkhackteam.org internet sitesi 5651 sayılı kanun’un 2. maddesinin 1. fıkrasının m) bendi ile aynı kanunun 5. maddesi kapsamında "Yer Sağlayıcı" konumundadır. İçerikler ön onay olmaksızın tamamen kullanıcılar tarafından oluşturulmaktadır. Turkhackteam.org; Yer sağlayıcı olarak, kullanıcılar tarafından oluşturulan içeriği ya da hukuka aykırı paylaşımı kontrol etmekle ya da araştırmakla yükümlü değildir. Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz. Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.