Reader small image

You're reading from  Kali Linux CTF Blueprints

Product typeBook
Published inJul 2014
PublisherPackt
ISBN-139781783985982
Edition1st Edition
Right arrow
Author (1)
Cameron Buchanan
Cameron Buchanan
author image
Cameron Buchanan

Cameron Buchanan is a penetration tester by trade and a writer in his spare time. He has performed penetration tests around the world for a variety of clients across many industries. Previously, Cameron was a member of the RAF. In his spare time, he enjoys doing stupid things, such as trying to make things fly, getting electrocuted, and dunking himself in freezing cold water. He is married and lives in London.
Read more about Cameron Buchanan

Right arrow

Scenario 3 – RC4, my god, what are you doing?


RC4 was an encryption method briefly in vogue for its speed and simplicity. Anyone who designs or implements cryptography will know that those are two words that, while good when applied with other words, such as secure, thoroughly tested, and 300 rounds, are not great when they make up the core of a description.

RC4 can simply be described as PT XOR key = CT, the explanation to which is as follows:

  • PT is your plaintext value

  • Key is the secret value set to encrypt the values

  • CT is the encrypted cipher text

XOR is exclusive or or bitwise addition, which is where two values are broken down into binary, overlayed, and where the numbers match, a 0 is returned, and where the numbers don't match, a 1 is given.

Setup

Setup can be easily achieved using the PyCrypto library and the following code:

From Crypto.Cipher import XOR
Cipher = XOR.new("iamakey")
msg = str(raw_input("message to send:")
cipher_text = cipher.encrypt(msg)
printcipher_text.encode('base64...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kali Linux CTF Blueprints
Published in: Jul 2014Publisher: PacktISBN-13: 9781783985982

Author (1)

author image
Cameron Buchanan

Cameron Buchanan is a penetration tester by trade and a writer in his spare time. He has performed penetration tests around the world for a variety of clients across many industries. Previously, Cameron was a member of the RAF. In his spare time, he enjoys doing stupid things, such as trying to make things fly, getting electrocuted, and dunking himself in freezing cold water. He is married and lives in London.
Read more about Cameron Buchanan