-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubcipher.py
More file actions
31 lines (22 loc) · 749 Bytes
/
subcipher.py
File metadata and controls
31 lines (22 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
from argparse import ArgumentParser
def subcipher(text: str, keys: dict):
print("[=] Substituted text is:")
for c in text:
if c.isalpha():
print( keys[c], end='' )
else:
print(c, end='')
print()
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('text', type=str)
parser.add_argument('--key-file', '-f', type=str, default=13)
args = parser.parse_args()
with open(args.key_file, 'r') as fp:
_keys = {}
for line in fp.readlines():
k, v = line.split('=')
_keys[k.strip()] = v.strip()
subcipher(args.text, _keys)
# GANG MAY KNOW YOUR IDENTITY ABORT ABORT MEET AT SAFE HOUSE B