add more
This commit is contained in:
1
crypto/MissingRaindeer/attachment
Normal file
1
crypto/MissingRaindeer/attachment
Normal file
@@ -0,0 +1 @@
|
||||
Ci95oTkIL85VWrJLVhns1O2vyBeCd0weKp9o3dSY7hQl7CyiIB/D3HaXQ619k0+4FxkVEksPL6j3wLp8HMJAPxeA321RZexR9qwswQv2S6xQ3QFJi6sgvxkN0YnXtLKRYHQ3te1Nzo53gDnbvuR6zWV8fdlOcBoHtKXlVlsqODku2GvkTQ/06x8zOAWgQCKj78V2mkPiSSXf2/qfDp+FEalbOJlILsZMe3NdgjvohpJHN3O5hLfBPdod2v6iSeNxl7eVcpNtwjkhjzUx35SScJDzKuvAv+6DupMrVSLUfcWyvYUyd/l4v01w+8wvPH9l
|
||||
42
crypto/MissingRaindeer/message.eml
Normal file
42
crypto/MissingRaindeer/message.eml
Normal file
@@ -0,0 +1,42 @@
|
||||
From psparkles@northpole.xms Tue Nov 30 19:07:09 2021
|
||||
Date: Tue, 30 Nov 2021 14:09:11 -0500
|
||||
From: Pep Sparkles <sparkles@northpole.xms>
|
||||
To: Tiny Jingles <tjingles@northpole.xms>
|
||||
Subject: Rudolf's Location
|
||||
Mime-Version: 1.0
|
||||
Content-Type: multipart/mixed; boundary="----=_Part_5028_7368284.1115579351471"
|
||||
|
||||
------=_Part_5028_7368284.1115579351471
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: quoted-printable
|
||||
Content-Disposition: inline
|
||||
From: Pep Sparkles <psparkles@northpole.xms>
|
||||
Date: Nov 30, 2021 1:17 PM
|
||||
Subject: Rudolf's Location
|
||||
To: tjingles@northpole.xms
|
||||
|
||||
|
||||
Hello Mr Jingles,
|
||||
|
||||
We got the reindeer as you requested. There is a problem though. Its nose is so red and bright and makes it very hard to hide him anywhere near north pole. We have moved to a secret location far away. I have encrypted this information with your public key in case you know who is watching.
|
||||
|
||||
|
||||
------=_Part_5028_7368284.1115579351471
|
||||
Content-Type: application/text/plain; name*=secret.enc
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Disposition: attachment
|
||||
Ci95oTkIL85VWrJLVhns1O2vyBeCd0weKp9o3dSY7hQl7CyiIB/D3HaXQ619k0+4FxkVEksPL6j3wLp8HMJAPxeA321RZexR9qwswQv2S6xQ3QFJi6sgvxkN0YnXtLKRYHQ3te1Nzo53gDnbvuR6zWV8fdlOcBoHtKXlVlsqODku2GvkTQ/06x8zOAWgQCKj78V2mkPiSSXf2/qfDp+FEalbOJlILsZMe3NdgjvohpJHN3O5hLfBPdod2v6iSeNxl7eVcpNtwjkhjzUx35SScJDzKuvAv+6DupMrVSLUfcWyvYUyd/l4v01w+8wvPH9l
|
||||
------=_Part_5028_7368284.1115579351471
|
||||
Content-Type: application/octet-stream; name*=pubkey.der
|
||||
Content-Transfer-Encoding: base64
|
||||
Content-Disposition: attachment
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEA5iOXKISx9NcivdXuW+uE
|
||||
y4R2DC7Q/6/ZPNYDD7INeTCQO9FzHcdMlUojB1MD39cbiFzWbphb91ntF6mF9+fY
|
||||
N8hXvTGhR9dNomFJKFj6X8+4kjCHjvT//P+S/CkpiTJkVK+1G7erJT/v1bNXv4Om
|
||||
OfFTIEr8Vijz4CAixpSdwjyxnS/WObbVmHrDMqAd0jtDemd3u5Z/gOUi6UHl+XIW
|
||||
Cu1Vbbc5ORmAZCKuGn3JsZmW/beykUFHLWgD3/QqcT21esB4/KSNGmhhQj3joS7Z
|
||||
z6+4MeXWm5LXGWPQIyKMJhLqM0plLEYSH1BdG1pVEiTGn8gjnP4Qk95oCV9xUxWW
|
||||
ZwIBAw==
|
||||
-----END PUBLIC KEY-----
|
||||
------=_Part_5028_7368284.1115579351471--
|
||||
9
crypto/MissingRaindeer/pubkey.der
Normal file
9
crypto/MissingRaindeer/pubkey.der
Normal file
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEA5iOXKISx9NcivdXuW+uE
|
||||
y4R2DC7Q/6/ZPNYDD7INeTCQO9FzHcdMlUojB1MD39cbiFzWbphb91ntF6mF9+fY
|
||||
N8hXvTGhR9dNomFJKFj6X8+4kjCHjvT//P+S/CkpiTJkVK+1G7erJT/v1bNXv4Om
|
||||
OfFTIEr8Vijz4CAixpSdwjyxnS/WObbVmHrDMqAd0jtDemd3u5Z/gOUi6UHl+XIW
|
||||
Cu1Vbbc5ORmAZCKuGn3JsZmW/beykUFHLWgD3/QqcT21esB4/KSNGmhhQj3joS7Z
|
||||
z6+4MeXWm5LXGWPQIyKMJhLqM0plLEYSH1BdG1pVEiTGn8gjnP4Qk95oCV9xUxWW
|
||||
ZwIBAw==
|
||||
-----END PUBLIC KEY-----
|
||||
65
crypto/XMASSpirit/decrypt.py
Normal file → Executable file
65
crypto/XMASSpirit/decrypt.py
Normal file → Executable file
@@ -1,8 +1,63 @@
|
||||
import random
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from math import gcd
|
||||
|
||||
def decrypt(dt):
|
||||
mod = 256
|
||||
sys.setrecursionlimit(1500)
|
||||
|
||||
parser = argparse.ArgumentParser(description='RSA Common modulus attack')
|
||||
required_named = parser.add_argument_group('required named arguments')
|
||||
required_named.add_argument('-n', '--modulus', help='Common modulus', required=True)
|
||||
required_named.add_argument('-e1', '--e1', help='First exponent', required=True)
|
||||
required_named.add_argument('-e2', '--e2', help='Second exponent', required=True)
|
||||
required_named.add_argument('-ct1', '--ct1', help='First ciphertext', required=True)
|
||||
required_named.add_argument('-ct2', '--ct2', help='Second ciphertext', required=True)
|
||||
|
||||
def egcd(a, b):
|
||||
if a == 0:
|
||||
return (b, 0, 1)
|
||||
else:
|
||||
g, y, x = egcd(b % a, a)
|
||||
return (g, x - (b // a) * y, y)
|
||||
|
||||
def modinv(a, m):
|
||||
g, x, y = egcd(a, m)
|
||||
if g != 1:
|
||||
raise ValueError('Modular inverse does not exist.')
|
||||
else:
|
||||
return x % m
|
||||
|
||||
def attack(c1, c2, e1, e2, N):
|
||||
if gcd(e1, e2) != 1:
|
||||
raise ValueError("Exponents e1 and e2 must be coprime")
|
||||
s1 = modinv(e1,e2)
|
||||
s2 = int((gcd(e1,e2) - e1 * s1) / e2)
|
||||
temp = modinv(c2, N)
|
||||
m1 = pow(c1,s1,N)
|
||||
m2 = pow(temp,-s2,N)
|
||||
return (m1 * m2) % N
|
||||
|
||||
def main():
|
||||
args = parser.parse_args()
|
||||
n = int(args.modulus, 16)
|
||||
ct1 = int(args.ct1, 16)
|
||||
ct2 = int(args.ct2, 16)
|
||||
e1 = int(args.e1, 16)
|
||||
e2 = int(args.e2, 16)
|
||||
print(n)
|
||||
print(ct1)
|
||||
print(ct2)
|
||||
print(e1)
|
||||
print(e2)
|
||||
print('[+] Started attack...')
|
||||
try:
|
||||
message = attack(ct1, ct2, e1, e2, n)
|
||||
print('[+] Attack finished!')
|
||||
print(type(message))
|
||||
print('\nPlaintext message:\n%s' % format(message, 'x'))
|
||||
except Exception as e:
|
||||
print('[+] Attack failed!')
|
||||
print(e.message)
|
||||
|
||||
main()
|
||||
|
||||
f = open('encrypted.bin', 'wb').read()
|
||||
print(f)
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from math import gcd
|
||||
|
||||
sys.setrecursionlimit(1500)
|
||||
|
||||
parser = argparse.ArgumentParser(description='RSA Common modulus attack')
|
||||
required_named = parser.add_argument_group('required named arguments')
|
||||
required_named.add_argument('-n', '--modulus', help='Common modulus', required=True)
|
||||
required_named.add_argument('-e1', '--e1', help='First exponent', required=True)
|
||||
required_named.add_argument('-e2', '--e2', help='Second exponent', required=True)
|
||||
required_named.add_argument('-ct1', '--ct1', help='First ciphertext', required=True)
|
||||
required_named.add_argument('-ct2', '--ct2', help='Second ciphertext', required=True)
|
||||
|
||||
def egcd(a, b):
|
||||
if a == 0:
|
||||
return (b, 0, 1)
|
||||
else:
|
||||
g, y, x = egcd(b % a, a)
|
||||
return (g, x - (b // a) * y, y)
|
||||
|
||||
def modinv(a, m):
|
||||
g, x, y = egcd(a, m)
|
||||
if g != 1:
|
||||
raise ValueError('Modular inverse does not exist.')
|
||||
else:
|
||||
return x % m
|
||||
|
||||
def attack(c1, c2, e1, e2, N):
|
||||
if gcd(e1, e2) != 1:
|
||||
raise ValueError("Exponents e1 and e2 must be coprime")
|
||||
s1 = modinv(e1,e2)
|
||||
s2 = int((gcd(e1,e2) - e1 * s1) / e2)
|
||||
temp = modinv(c2, N)
|
||||
m1 = pow(c1,s1,N)
|
||||
m2 = pow(temp,-s2,N)
|
||||
return (m1 * m2) % N
|
||||
|
||||
def main():
|
||||
args = parser.parse_args()
|
||||
n = int(args.modulus, 16)
|
||||
ct1 = int(args.ct1, 16)
|
||||
ct2 = int(args.ct2, 16)
|
||||
e1 = int(args.e1, 16)
|
||||
e2 = int(args.e2, 16)
|
||||
print(n)
|
||||
print(ct1)
|
||||
print(ct2)
|
||||
print(e1)
|
||||
print(e2)
|
||||
print('[+] Started attack...')
|
||||
try:
|
||||
message = attack(ct1, ct2, e1, e2, n)
|
||||
print('[+] Attack finished!')
|
||||
print(type(message))
|
||||
print('\nPlaintext message:\n%s' % format(message, 'x'))
|
||||
except Exception as e:
|
||||
print('[+] Attack failed!')
|
||||
print(e.message)
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user