Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ArM4dA authored Feb 21, 2021
1 parent 0f7b3d8 commit 180bd50
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Challenge/chall.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env python3

from struct import pack, unpack
flag = b'darkCON{XXXXXXXXXXXXXXXXXXX}'

def Tup_Int(chunk):
return unpack("I",chunk)[0]

chunks = [flag[i*4:(i+1)*4] for i in range(len(flag)//4)]
ciphertext = ""

f = open('cipher.txt','w')
for i in range(len(chunks) - 2):
block = pack("I", Tup_Int(chunks[i]) ^ Tup_Int(chunks[i+2]))
ciphertext = 'B' + str(i) + ' : ' + str(block) + '\n'
f.write(ciphertext)
5 changes: 5 additions & 0 deletions Challenge/cipher.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
B0 : b'\nQ&4'
B1 : b"\x17'\x0e\x0f"
B2 : b'1X5\r'
B3 : b'072E'
B4 : b'\x18\x00\x15/'
19 changes: 19 additions & 0 deletions Challenge/exploit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

from struct import pack, unpack

def Tup_Int(chunk):
return unpack("I",chunk)[0]

cipher = [b'\nQ&4',b"\x17'\x0e\x0f",b'1X5\r',b'072E',b'\x18\x00\x15/']
chunks = [b'dark',b'CON{']
flag = []

for i in range(len(cipher)):
block = pack("I", Tup_Int(chunks[i]) ^ Tup_Int(cipher[i]))
chunks.append(block)

for x in chunks:
flag.append(x.decode())
print(''.join(flag))

#flag = darkCON{n0T_Th@t_haRd_r1Ght}
9 changes: 9 additions & 0 deletions Key/exploit.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env python3

from Crypto.Util.number import long_to_bytes
import gmpy2
ct = 43472086389850415096247084780348896011812363316852707174406536413629129
e = 3
print(long_to_bytes(gmpy2.iroot(ct,e)[0]).decode())

#KEY = Ju5t_@_K3Y
3 changes: 3 additions & 0 deletions Key/getkey.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
p = 147310848610710067833452759772211595299756697892124273309283511558003008852730467644332450478086759935097628336530735607168904129699752266056721879451840506481443745340509935333411835837548485362030793140972434873394072578851922470507387225635362369992377666988296887264210876834248525673247346510754984183551
ct = 43472086389850415096247084780348896011812363316852707174406536413629129
e = 3

0 comments on commit 180bd50

Please sign in to comment.