@@ -21,38 +23,39 @@
- [Our Amazing Contributors](#our-amazing-contributors)
## 📖 History
-Cryptex started out in November 2021 with one developer Alex "cythes" Kollar as an attempt to be less of a script kiddy.
-It has since became so much more. As of april 2022 Alex decided to open the project up to the SSG community to some absolutely incredible results. At this point the SSG | Cryptex Dev Team was founded with a the idea of building cryptex into a cryptography tool that people could use, install and add to with ease. Similar to metasploit. The project and team has evolved so much in just the little time it has existed.
+Cryptex started out in November, 2021, with one developer, Alex "cythes" Kollar, as an attempt to be less of a script kiddie.
+It has since then became so much more. As of April, 2022, Alex decided to open the project up to the SSG community to reap some absolutely incredible results. At this point, the SSG | Cryptex Dev Team was founded with a the idea of building Cryptex into a cryptography tool that people could use, install and add to with ease. Similar to Metasploit, the project and the team has evolved so much in the little time that it has existed for.
-Cryptex itself maturing from Alex's seventeen original Hodge-podge of unoptimized tools, to what is now a professional grade cryptography toolkit. Cryptex is backed by a passionate team of devs ranging from beginners looking for a place to start to advanced devs who want a challenge. We even have a few idea men who come up with whacky encryption ideas for us to try to impliment. (Static Encryption. Go check it out.) Last but 110% not least our sponors who believe in the project enough to financially back us.
+Cryptex itself has matured from Alex's hodgepodge of seventeen original but unoptimized tools, to what is now a professional-grade cryptography toolkit. Cryptex is backed by a passionate team of devs, ranging from beginners looking for a place to start, to advanced devs who want a challenge. We even have a few idea men who come up with wacky encryption ideas for us to try to implement. (Static Encryption; go check it out!) Lastly, but definitely not the least, this has been possible thanks to our sponsors who believe in the project enough to financially back us up.
## 🗓️ Upcoming Release
### Cryptex V1.0.0 - Pumpkin Patch 00
-After participation in Hacktoberfest 2022 we are going to put the collective updates from the event into a new realease. We are Dubbing the Pumpkin Patch. The plan is every year we do Hacktoberfest we will add a new Pumpkin Patch to Cryptex.
+
+After participation in Hacktoberfest 2022, we are going to put the collective updates from the event into a new release, which we will be dubbing as the Pumpkin Patch. The plan is that for every year we participate in Hacktoberfest, we will add a new Pumpkin Patch to Cryptex.
Other notes:
- We are moving away from the Earth Invader.
-- complete rebuild of cryptex to work with Object Oriented Programming.
-- Its now easier to implement new Ciphers and tools.
-- Installer has been rewritten from the ground up in python.
+- Complete rebuild of Cryptex to work with Object-Oriented Programming.
+- It is now easier to implement new ciphers and tools.
+- Installer has been rewritten from the ground-up in Python.
- The main menu can now dynamically add ciphers and tools to the list.
-- We brought back the OG 'Cryptex UI' (We made it look pretty again)
-- Implimented a system that lets us use Ascii art for version names.
+- We brought back the OG 'Cryptex UI' (we made it look pretty again).
+- Implemented a system that lets us use ASCII art for version names.
-All of this is pushing Cryptex ever closer to its goal of becoming the `metaploit of cryptography`
+All of this is pushing Cryptex ever closer to its goal of becoming the `Metaploit of cryptography`
## [🛠️Basic Help](https://github.com/SSGorg/Cryptex/wiki/Cryptex-Syntax)
## 🖐️ Get in touch
-### You can join in on chatting with the dev team on our discord server
+### You can join in on chatting with the dev team on our Discord server
## 🔧 Issues
If you face any problems while using the application, please open an issue here
## 🤝 Contributing
-Contributions, feedback, and bug reports are welcome! Feel free to check out our [issues page](https://github.com/SSGorg/Cryptex/issues) to find out what you could do! but before contrubuting make sure to check out [CONTRIBUTING.md](./CONTRIBUTING.md).
-#### **NOTE:** All active development happens in the [beta branch](https://github.com/SSGorg/Cryptex/tree/beta)
+
+Contributions, feedback, and bug reports are welcome! Feel free to check out our [issues page](https://github.com/SSGorg/Cryptex/issues) to find out what you could do! But before contributing, make sure to check out [CONTRIBUTING.md](./CONTRIBUTING.md).
## Our Amazing Contributors🌟
diff --git a/requirements.txt b/requirements.txt
index 7a40bd8..d69d454 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
qrcode
Cryptography
-googletrans==3.0.0
+googletrans==3.1.0a0
colorama
pillow
numpy
diff --git a/src/cipher/cipher.py b/src/cipher/cipher.py
index 09b5b71..e98afce 100644
--- a/src/cipher/cipher.py
+++ b/src/cipher/cipher.py
@@ -13,3 +13,7 @@ def print_options():
print('''
Not implemented.
''')
+
+ def test(args):
+ raise Exception('Not implemented')
+ return {'status': False, 'msg': 'Not Implemented'}
diff --git a/src/cipher/ciphers/L33T.py b/src/cipher/ciphers/L33T.py
index edbd311..9d6f426 100644
--- a/src/cipher/ciphers/L33T.py
+++ b/src/cipher/ciphers/L33T.py
@@ -14,26 +14,16 @@ class L33T(Cipher): #make sure you change this from text to your cipher
'c': '(',
'e': '3',
'g': '6',
- 'h': '#',
- 'i': '¡',
+ 'h': 'H',
+ 'i': '1',
'k': 'X',
- 'l': '1',
+ 'l': 'l',
'o': '0',
'p': '9',
's': '5',
't': '7',
'x': '*',
'z': '2',
- '0': 'O',
- '1': 'L',
- '2': 'Z',
- '3': 'E',
- '4': 'A',
- '5': 'S',
- '6': 'G',
- '7': 'T',
- '8': 'B',
- '9': 'P',
}
inverse_leet_speak = dict((v, k) for k,v in leet_speak.items())
@@ -76,3 +66,21 @@ def print_options():
python main.py l33t -e -t 'hello'
python main.py l33t -d -t 'h3llo'
''')
+
+ def test(args):
+ total = 2
+
+ args.text = 'hello'
+ expect = 'H3ll0'
+ out = L33T.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ args.text, expect = expect, args.text
+ out = L33T.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
diff --git a/src/cipher/ciphers/__init__.py b/src/cipher/ciphers/__init__.py
index 132747a..9e807e9 100644
--- a/src/cipher/ciphers/__init__.py
+++ b/src/cipher/ciphers/__init__.py
@@ -22,3 +22,10 @@
from .ma import *
from .bac import *
from .ak import *
+from .pf import *
+from .affn import *
+from .pb import *
+from .sha224 import *
+from .sha256 import *
+from .sha384 import *
+from .gc import *
diff --git a/src/cipher/ciphers/affn.py b/src/cipher/ciphers/affn.py
new file mode 100644
index 0000000..bf8014c
--- /dev/null
+++ b/src/cipher/ciphers/affn.py
@@ -0,0 +1,101 @@
+"""
+Author: Sparsh Gupta | Contributor
+Description: Affine Cipher Implementation
+"""
+from cipher import Cipher
+import math
+
+def extended_euclidean_common_devisor(a, b):
+ if a == 0:
+ return (b, 0, 1)
+ else:
+ gcd, x, y = extended_euclidean_common_devisor(b % a, a)
+ return (gcd, y - (b // a) * x, x)
+
+
+def mod_inv(a, m):
+ gcd, x, _ = extended_euclidean_common_devisor(a, m)
+ if gcd != 1:
+ return None # modular inverse does not exist
+ else:
+ return x % m
+
+class Affine(Cipher): #make sure you change this from text to your cipher
+
+ name = 'Affine' #change the name
+ type = 'cipher'
+
+
+ def encode(args):
+ text = args.text
+ key_a=args.key_a
+ key_b=args.key_b
+
+ if not text:
+ return {'text': "No input text", 'success': False}
+
+ if key_a==None :
+ key_a=1
+ if key_b==None:
+ key_b=0
+
+
+ default_dict='abcdefghijklmnopqrstuvwxyz'
+ m=len(default_dict)
+
+ output=''
+ for char in text:
+ if(char in default_dict):
+ x=default_dict.find(char)
+ e_x=(key_a*x+key_b)%m
+ output+=default_dict[e_x]
+ else:
+ output+=char
+ return {'text': output, 'success': True}
+
+ def decode(args):
+ text = args.text
+ key_a=args.key_a
+ key_b=args.key_b
+
+ if not text:
+ return {'text': "No input text", 'success': False}
+
+ if key_a==None :
+ key_a=1
+ if key_b==None:
+ key_b=0
+
+
+ default_dict='abcdefghijklmnopqrstuvwxyz'
+ m=len(default_dict)
+
+ output=''
+ for char in text:
+ if(char in default_dict):
+ x=default_dict.find(char)
+ e_x=(mod_inv(key_a,m)*((x-key_b)%m))%m
+ output+=default_dict[e_x]
+ else:
+ output+=char
+ return {'text': output, 'success': True}
+
+
+ def print_options():
+ #Edit this section as needed for your specific encoding / decoding.
+ print('''
+ ### Modes
+ -d / --decode ---- decode
+ -e / --encode ---- encode
+
+ ### Input
+ -t / --text ------ input text
+ -ka / --key_a ------input key -a
+ -kb / --key_b -------input key -b
+
+ ### Examples
+ python main.py text -e -t 'hello' -ka 21 -kb 1
+ python main.py text -d -t 'hello' -ka 2
+
+ Note: Cipher is Case Sensitive. Default Dictionary: abcdefghijklmnopqrstuvwxyz
+ ''')
diff --git a/src/cipher/ciphers/b64.py b/src/cipher/ciphers/b64.py
index a30f39d..f22e229 100644
--- a/src/cipher/ciphers/b64.py
+++ b/src/cipher/ciphers/b64.py
@@ -48,3 +48,21 @@ def print_options():
python main.py text -e -t 'hello'
python main.py text -d -t 'hello'
''')
+
+ def test(args):
+ total = 2
+
+ args.text = 'hello'
+ expect = 'aGVsbG8='
+ out = B64.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode {args.text}
+ expected "{args.text}" got "{out['text']}"'''}
+
+ args.text, expect = expect, args.text
+ out = B64.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode {args.text}
+ expected "{args.text}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
diff --git a/src/cipher/ciphers/bin.py b/src/cipher/ciphers/bin.py
index 898a42d..46e60cf 100644
--- a/src/cipher/ciphers/bin.py
+++ b/src/cipher/ciphers/bin.py
@@ -46,3 +46,23 @@ def print_options():
python main.py text -e -t 'hello'
python main.py text -d -t 'hello'
''')
+
+ def test(args):
+ total = 2
+
+ args.text = 'hello'
+ expect = '1101000 1100101 1101100 1101100 1101111'
+ # NOTE (marvhus): Should the binary output have a byte length of 7 or 8?
+ out = bin.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ args.text, expect = expect, args.text
+ out = bin.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
+
diff --git a/src/cipher/ciphers/cc.py b/src/cipher/ciphers/cc.py
index 8ac8797..c951f1a 100644
--- a/src/cipher/ciphers/cc.py
+++ b/src/cipher/ciphers/cc.py
@@ -66,3 +66,62 @@ def print_options():
python main.py cc -e -t "hello" -k 10 -ex '123456789'
python main.py cc -d -t "hello" -k 10 -ex '123456789'
''')
+
+ def test(args):
+ total = 0
+ expect = [
+ 'hello',
+ 'ifmmp',
+ 'jgnnq',
+ 'khoor',
+ 'lipps',
+ 'mjqqt',
+ 'nkrru',
+ 'olssv',
+ 'pmttw',
+ 'qnuux',
+ 'rovvy',
+ 'spwwz',
+ 'tqxxa',
+ 'uryyb',
+ 'vszzc',
+ 'wtaad',
+ 'xubbe',
+ 'yvccf',
+ 'zwddg',
+ 'axeeh',
+ 'byffi',
+ 'czggj',
+ 'dahhk',
+ 'ebiil',
+ 'fcjjm',
+ 'gdkkn',
+ 'hello',
+ ]
+ for i in range(1, 26):
+ total += 1
+ args.text = 'hello'
+ args.key = i
+ out = CC.encode(args)
+ if not out['success']:
+ return {'status': False, 'msg': f'''
+ Encoding failed: "{out['text']}"'''}
+
+ if out['text'] not in expect[i]:
+ return {'status': False, 'msg': f'''Failed to encode "hello"
+ expected "{expect[i]}" with key {i} got {out['text']}'''}
+
+ for i in range(1, 26):
+ total += 1
+ args.text = expect[i]
+ args.key = i
+ out = CC.decode(args)
+ if not out['success']:
+ return {'status': False, 'msg': f'''
+ Decoding failed: "{out['text']}"'''}
+
+ if out['text'] not in 'hello':
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "hello" with key {i} got {out['text']}'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
diff --git a/src/cipher/ciphers/gc.py b/src/cipher/ciphers/gc.py
new file mode 100644
index 0000000..c1f7566
--- /dev/null
+++ b/src/cipher/ciphers/gc.py
@@ -0,0 +1,80 @@
+from cipher import Cipher
+
+
+class GC(Cipher):
+
+ name = 'Gaderypoluki Cipher'
+ type = 'cipher'
+
+ def code(args):
+
+ text = args.text
+
+ if not text:
+ return {'text': "No input text", 'success': False}
+
+ encode_lower = {
+ 'g': 'a',
+ 'a': 'g',
+ 'd': 'e',
+ 'e': 'd',
+ 'r': 'y',
+ 'y': 'r',
+ 'p': 'o',
+ 'o': 'p',
+ 'l': 'u',
+ 'u': 'l',
+ 'k': 'i',
+ 'i': 'k',
+ }
+ encode_upper = {
+ 'G': 'A',
+ 'A': 'G',
+ 'D': 'E',
+ 'E': 'D',
+ 'R': 'Y',
+ 'Y': 'R',
+ 'P': 'O',
+ 'O': 'P',
+ 'L': 'U',
+ 'U': 'L',
+ 'K': 'I',
+ 'I': 'K',
+ }
+
+ encode_text = ''
+
+ for char in text:
+ if char.isupper():
+ char = encode_upper.get(char, char)
+ encode_text += char
+ elif char.islower():
+ char = encode_lower.get(char, char)
+ encode_text += char
+ else:
+ encode_text += char
+
+ return {'text': encode_text, 'success': True}
+
+ def encode(args):
+ output = GC.code(args)
+ return output
+
+ def decode(args):
+ output = GC.code(args)
+ return output
+
+
+ def print_options():
+ print('''
+ ### Modes
+ -d / --decode ---- decode
+ -e / --encode ---- encode
+
+ ### Input
+ -t / --text ------ input text
+
+ ### Examples
+ python main.py gc -e -t 'hello'
+ python main.py gc -d -t 'hduup'
+ ''')
diff --git a/src/cipher/ciphers/hex.py b/src/cipher/ciphers/hex.py
index 23ff2ee..ae8c101 100644
--- a/src/cipher/ciphers/hex.py
+++ b/src/cipher/ciphers/hex.py
@@ -12,7 +12,6 @@ class Hex(Cipher): #make sure you change this from text to your cipher
def encode(args):
text = args.text
- filename = args.output
if not text:
return {'text': "No input text", 'success': False}
@@ -24,7 +23,6 @@ def encode(args):
def decode(args):
text = args.text
- filename = args.output
if not text:
return {'text': "No input text", 'success': False}
@@ -42,9 +40,28 @@ def print_options():
### Input
-t / --text ------ input text
- -o / -output ----- output to file
### Example
- python3 main.py -e -t 'Hello world!' -o ~/hello.txt
+ python3 main.py -e -t 'Hello world!'
''')
#TODO(marvhus): Remove -o/--output and instead implement it in the Main.output() function
+
+ def test(args):
+ total = 2
+
+ args.text = 'hello'
+ expect = '68656c6c6f'
+ out = Hex.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ args.text = expect
+ expect = 'hello'
+ out = Hex.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
+
diff --git a/src/cipher/ciphers/mor.py b/src/cipher/ciphers/mor.py
index 58349ee..161b9ca 100644
--- a/src/cipher/ciphers/mor.py
+++ b/src/cipher/ciphers/mor.py
@@ -123,3 +123,22 @@ def print_options():
python main.py mor -e -t 'hello'
python main.py mor -d -t '.... . .-.. .-.. ---'
''')
+
+ def test(args):
+ total = 2
+
+ args.text = 'HELLO'
+ expect = '.... . .-.. .-.. ---'
+ out = Mor.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ args.text, expect = expect, args.text
+ out = Mor.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
+
diff --git a/src/cipher/ciphers/oct.py b/src/cipher/ciphers/oct.py
index 3e36bc9..8a93e74 100644
--- a/src/cipher/ciphers/oct.py
+++ b/src/cipher/ciphers/oct.py
@@ -45,3 +45,21 @@ def print_options():
python main.py oct -e -t 'hello'
python main.py oct -d -t '150 145 154 154 157'
''')
+
+ def test(args):
+ total = 2
+
+ args.text = 'hello'
+ expect = '150 145 154 154 157'
+ out = Oct.encode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to encode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ args.text, expect = expect, args.text
+ out = Oct.decode(args)
+ if not out['success'] or out['text'] != expect:
+ return {'status': False, 'msg': f'''Failed to decode "{args.text}"
+ expected "{expect}" got "{out['text']}"'''}
+
+ return {'status': True, 'msg': f'Ran {total} tests'}
diff --git a/src/cipher/ciphers/pb.py b/src/cipher/ciphers/pb.py
new file mode 100644
index 0000000..92db0c9
--- /dev/null
+++ b/src/cipher/ciphers/pb.py
@@ -0,0 +1,51 @@
+from cipher import Cipher
+import itertools
+
+class Pb(Cipher):
+
+ name = 'Pb'
+ type = 'cipher'
+
+ def brute(args):
+ text=args.text.strip()
+ range_split=[i.strip() for i in args.range.split(',') if i.strip()]
+ range_int=[int(i) for i in range_split if i.isdigit()]
+ step=1
+
+ # Validate if correct input
+ if not text:
+ return {'text': "No input text", 'success': False}
+ if not text.isdigit():
+ return {'text': "Input Text should only contain digits", 'success': False}
+
+ #Validate Range
+ if not range_int or len(range_int)!=len(range_split):
+ return {'text': "Improper Range", 'success': False}
+
+ if len(range_int)<2:
+ range_int.append(range_int[0]+step)
+
+ digits=[f"{i}" for i in range(10)]
+
+ for length in range(range_int[0],range_int[1],step):
+ for item in itertools.product(digits, repeat=length):
+ guess = "".join(item)
+ if guess == text:
+ return {'text': "Found the pin", 'success': True}
+
+
+ return {'text': "Couldn't find the pin", 'success': True}
+
+ def print_options():
+ print('''
+ ### Modes
+ -b / --brute ---- brute
+ ### Input
+ -t / --text ------ input text
+ -i / --input ------ input file [.txt]
+ -r / --range ------- range [