Skip to content

Commit

Permalink
Add challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
s0phialiu committed Mar 12, 2024
1 parent 17ef249 commit 7e50d58
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Hidden Runes"
name: "XOR 101"
author: Sophia
category: Crypto
description: |-
Expand Down
1 change: 1 addition & 0 deletions chals/crypto/hidden_runes/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sigpwny{alphabets_are_very_fun}
File renamed without changes.
1 change: 1 addition & 0 deletions chals/crypto/password_cracking/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sigpwny{code_br3aker_!}
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions chals/crypto/xor_101/chal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def encrypt(message, key):
return bytes([b ^ key[i % len(key)] for i, b in enumerate(message)])

def main():
passphrase = input("Enter passphrase: ")
key = [ord(char) for char in passphrase]
message = b"sigpwny{fake_flag}"

# Encrypt
ciphertext = encrypt(message, key)
print("Encrypted message:", ciphertext.hex())

if __name__ == '__main__':
main()
26 changes: 26 additions & 0 deletions chals/crypto/xor_101/challenge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "XOR 101"
author: Sophia
category: Crypto
description: |-
Breaking news: Seals have reached a new level of intelligence and can now create their own XOR challenges.
One left a comment on a photo of themself. Can you use that to discover the flag?
**author**: Sophia
value: 150
type: dynamic
tags:
- easy
extra:
initial: 150
decay: 125
minimum: 100
flags:
- sigpwny{seals_like_x0r}
files:
- message.txt
- chal.py
- seal1.png
hints:
- Can you use information from the seal photo to decrypt the message?
- Exiftool is helpful.
state: hidden
1 change: 1 addition & 0 deletions chals/crypto/xor_101/flag.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sigpwny{seals_like_x0r}
1 change: 1 addition & 0 deletions chals/crypto/xor_101/message.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
07060a110301100806030601001a13301e15151d1d160539052a11440612
Binary file added chals/crypto/xor_101/seal1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions chals/crypto/xor_101/sol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Step 1: Inspect "comment" tag in metadata for passphrase (ex: exiftool seal1.png)
passphrase = "tomatoisafruit"

# Step 2:
def decrypt(ciphertext, key):
return bytes([b ^ key[i % len(key)] for i, b in enumerate(ciphertext)])

# Provided from message.txt
input = "07060a110301100806030601001a13301e15151d1d160539052a11440612"

# Convert hexadecimal string to bytes
b_input = bytes.fromhex(input)

# Use key to decrypt
key = [ord(char) for char in passphrase]
output = decrypt(b_input, key)

print("Flag:", output.decode('utf-8'))

0 comments on commit 7e50d58

Please sign in to comment.