Package: memecrypt
MemecryptMemecrypt is an encryption tool designed for fun and CTF challenge use.
It can be imported as a python module or used as a standalone
program, depending on whichever is needed.UsageThere are 2 main ways to use memecrypt. Both ways are covered here.Program useInstall from PyPi$python3-mpipinstallmemecryptOptionsLet's start by viewing all the supported arguments.$memecrypt[+]Usage:memecrypt[options][i]Examples:memecrypt-se-ifoo-kbarmemecrypt--subs-x-ffile.txt-k"a_key"memecrypt-sx-i'lorem ipsum'-k'some key'memecrypt--subs-e-ucat.thatlinuxbox.com-k'ascii cat'[i]Positionalarguments:-s--subsSelectthesubstitutioncipher.-e--encryptSelectencryptionmode.-x--decryptSelectdecryptionmode.-k--keykeySpecifykey.-i--inputinput-stringSpecifyinputstring.-u--urlurlGETsdatafromtheurl.-f--filefile-pathSpecifyinputfilepath.[i]Optionalarguments:-h--helpShowthishelpscreenandexit.-v--versionPrintversionandexit.-q--quietOnlyshowoutput.Anyerrorsarestilldisplayed.-o--output-filefileSpecifyafiletowriteto.-p--pipe-inputTakeinputfromstdin.Encryption# As an argument$./memecrypt.py-se-i"foo bar"-k"lorem ipsum"[!]Note:Pleaseusethesamekeyfordecryption.[+]Encryptedresult:
---------------------
MHFGL1AjdjpSXXx8# From a URL$./memecrypt.py--subs--encrypt--urlcat.thatlinuxbox.com--key"cat"[+]FetcheddatafromURL.[!]Note:Pleaseusethesamekeyfordecryption.[+]Encryptedresult:
---------------------
WiJeTFoiXkxaOl5ETDpeREw6XkRMOl5ET.....(andsoon).....# From a local file$./memecrypt.py-se-f<file-path>-k"foobar"-q
NWl8eSlMd35ZXTQxU289Y0ZdNGdGTCdrU2FBQ3pM...(andsoon)...Decryption# Decrypt as an argument../memecrypt.py-sx-ibVQ0cjJfVkY1TGNCKFRWWzIkZVF...-kwow[+]Decryptedresult:
---------------------
Muchencryption,verywow# Decrypt from file$./memecrypt.py--subs--decrypt-f../../projects/outputfile-klol[+]Decryptedresult:
---------------------
Cupcakeipsumdolor.SitamettoppingchocolatebarNotesArguments can be placed in any order and combined however you want, as long as they don't need
a passed value or directly contradict.Module useInstall usingpython3 -m pip install memecryptInitialisingLet's start by creating an instance of thememe_cipherclass.# Import our moduleimportmemecrypt# Create an instancecipher=memecrypt.meme_cipher(message=None,enc_key=None,show_colors=True)# message is the message to work on# enc_key is the key# show_colors=False to turn off all colorsSetting a messageSet message using method or attribute.# Using our previous instancecipher.set_message("foo")# We can access/modify this by accessing the message attributeprint(cipher.message)# Prints: foo# Let's try and set a blank message.cipher.set_message(None)# Prints: [!] Memecrypt: Plaintext/Ciphertext cannot be empty.Setting a keyThis works the same way as setting a message. We'll use
ourcipherinstance. Again, the key cannot be blank orNone.# Setting a keycipher.set_key("bar")# We can access/modify the key from the enc_key attributeprint(cipher.enc_key)# Prints: bar# Same as before, we can't set a blank keycipher.set_key('')# Prints: [!] Memecrypt: Key value cannot be empty.EncryptingEncrypt the values. If key or message is missing, error.# message => foo, key => barcipher.encrypt()# Returns: 'NEgydQ=='DecryptingPerform decryption# message => NEgydQ==, key=> barcipher.decrypt()# Returns: 'foo'Input sourcesTake input from file.# transfer the contents of the url.cat=cipher.fetch_url("cat.thatlinuxbox.com")# Returns a ascii cat.cipher.set_message(cat)# We just set our message as the ascii cat!# Read a local file.foo_file=cipher.read_file("/path/to/file/file.txt")# foo_file will have contents of file.txt# Set our message to contents of file.txtcipher.set_message(foo_file)Output filesWrite output to a file.# Append to a file. Create file if file non-existent.cipher.write_to("path/to/file/file.txt","lorem ipsum dolor")# Let's put our encrypted output to a file.cipher.write_to("foo_bar.txt",cipher.encrypt())