This shows you the differences between two versions of the page.
isc:labs:02 [2023/10/17 19:18] david.gherghita |
isc:labs:02 [2024/03/03 13:03] (current) vlad_iulius.nastase [05 [20p] We want Jokes instead of Nukes] |
||
---|---|---|---|
Line 153: | Line 153: | ||
{{:isc:labs:isc-lab02-secret.zip|This file (compressed as .zip)}} was encrypted using the following code. Can you decrypt it? | {{:isc:labs:isc-lab02-secret.zip|This file (compressed as .zip)}} was encrypted using the following code. Can you decrypt it? | ||
- | <code> | + | <code python> |
from Crypto.Cipher import AES | from Crypto.Cipher import AES | ||
from Crypto import Random | from Crypto import Random | ||
Line 190: | Line 190: | ||
<solution -hidden> | <solution -hidden> | ||
- | <code> | + | <code python> |
from Crypto.Cipher import AES | from Crypto.Cipher import AES | ||
Line 230: | Line 230: | ||
</code> | </code> | ||
* **Note**: the result is a decimal number, you need to convert it to an ASCII text using the snippet below: | * **Note**: the result is a decimal number, you need to convert it to an ASCII text using the snippet below: | ||
- | <code> | + | <code python> |
print(hex(message)[2:].decode("hex")) # python 2 | print(hex(message)[2:].decode("hex")) # python 2 | ||
print(bytearray.fromhex(hex(message)[2:])) # python 3 | print(bytearray.fromhex(hex(message)[2:])) # python 3 | ||
Line 239: | Line 239: | ||
<solution -hidden> | <solution -hidden> | ||
- | <code> | + | <code python> |
import gmpy2 | import gmpy2 | ||
Line 265: | Line 265: | ||
<solution -hidden> | <solution -hidden> | ||
- | <code> | + | <code python> |
+ | |||
+ | # Key = 1e: i_guess_it_kinda_is_otp | ||
+ | |||
+ | from itertools import cycle | ||
+ | |||
+ | c = 'wAyk{mmAwjAuwpzAwmAqjn' | ||
- | Key = 1e: i_guess_it_kinda_is_otp | + | for i in range(0,256): |
+ | print("".join([chr(x[0] ^ ord(x[1])) for x in zip(cycle([i]), c)])) | ||
</code> | </code> | ||
Line 300: | Line 307: | ||
<solution -hidden> | <solution -hidden> | ||
- | <code> | + | <code python> |
original_iv = bytes.fromhex('7ec00bc6fd663984c1b6c6fd95ceeef1') | original_iv = bytes.fromhex('7ec00bc6fd663984c1b6c6fd95ceeef1') |