forked from yanapermana/metadecryptor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
metadecryptor.py
192 lines (174 loc) · 4.91 KB
/
metadecryptor.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import os, sys
from encoding3 import *
from classic3 import *
from factor3 import *
from string3 import *
from modern3 import *
from converter3 import *
encoding = Encoding3()
classic = Classic3()
factor = Factor3()
string = String3()
modern = Modern3()
converter = Converter3()
def greeting():
print("""
_ _ _
/\/\ ___| |_ __ _ __| | ___ ___ _ __ _ _ _ __ | |_ ___ _ __ v1.0
/ \ / _ \ __/ _` |/ _` |/ _ \/ __| '__| | | | '_ \| __/ _ \| '__|
/ /\/\ \ __/ || (_| | (_| | __/ (__| | | |_| | |_) | || (_) | |
\/ \/\___|\__\__,_|\__,_|\___|\___|_| \__, | .__/ \__\___/|_|
|___/|_|
""")
def author():
print("""\nby Yana Permana @yansen1204 <[email protected]>\n""")
def helps():
print("""Core Commands
=============
\tCommand\t\tDescription
\t-------\t\t-----------
\t-h\t\tHelp
\t-author\t\tAuthor
\t-credit\t\tCredits
\t-hex\t\tDecode hexadecimal
\t-b64\t\tDecode base64
\t-caesar\t\tBreak caesar cipher
\t-vigenere\tBreak vigenere cipher
\t-affine\t\tBreak affine cipher
\t-reverse\tDecrypt reverse cipher
\t-bacon\t\tDecrypt bacon cipher
\t-morse\t\tDecrypt morse cipher
\t-pediaphone\tDecrypt pediaphone cipher
\t-transpose\tDecrypt transpose cipher
\t-friedman\tIs monoalpabetical or polyalphabetical?
Factoring Modulus
==================
\tCommand\t\tDescription
\t-------\t\t-----------
\t-prho\t\tPollard rho
\t-euler\t\tEuler
\t-fermat\t\tFermat
\t-trial\t\tTrial division
\t-vfactor\tV Factor
\t-dasilva\tDa Silva
Strings
==================
\tCommand\t\tDescription
\t-------\t\t-----------
\t-digit\t\tGather Digit
\t-lower\t\tGather Lowercase
\t-upper\t\tGather Uppercase
\t-upperdigit\tGather Uppercase and Digit
\t-lowerdigit\tGather Lowercase and Digit
Modern
==================
\tCommand\t\tDescription
\t-------\t\t-----------
\t-checkRSA\tIs your RSA is secure?
Converter
==================
\tCommand\t\tDescription
\t-------\t\t-----------
\t-alpha2num\tConvert alphabet to number
\t-num2alpha\tConvert number to alphabet
""");
def credit():
print("""
Thanks to
=============
\tNo.\t\tName
\t-------\t\t-----------
\t1\t\tAl Sweigart
\t2\t\tSteven D'Aprano
\t3\t\tRidwan Fajar S.
""");
def main():
greeting()
try:
if sys.argv[1] == '-h':
helps()
elif sys.argv[1] == '-author':
author()
elif sys.argv[1] == '-credit':
credit()
elif sys.argv[1] == '-b64':
if sys.argv[2] != '':
print(encoding.b642asc(sys.argv[2]))
elif sys.argv[1] == '-hex':
if sys.argv[2] != '':
print(encoding.hex2asc(sys.argv[2]))
elif sys.argv[1] == '-caesar':
if sys.argv[2] != '':
classic.caesar(sys.argv[2])
elif sys.argv[1] == '-pediaphone':
if sys.argv[2] != '':
classic.pediaphone(sys.argv[2])
elif sys.argv[1] == '-reverse':
if sys.argv[2] != '':
classic.reverses(sys.argv[2])
elif sys.argv[1] == '-bacon':
if sys.argv[2] != '':
classic.bacon(sys.argv[2])
elif sys.argv[1] == '-morse':
if sys.argv[2] != '':
classic.morse(sys.argv[2])
elif sys.argv[1] == '-transpose':
if sys.argv[2] != '':
classic.transpose(sys.argv[2])
elif sys.argv[1] == '-affine':
if sys.argv[2] != '':
classic.affine(sys.argv[2])
elif sys.argv[1] == '-vigenere':
if sys.argv[2] != '':
classic.vigenere(sys.argv[2])
elif sys.argv[1] == '-friedman':
if sys.argv[2] != '':
classic.friedman(sys.argv[2])
elif sys.argv[1] == '-prho':
if sys.argv[2] != '':
print('(p, q):', factor.pollard_rhos(int(sys.argv[2])))
elif sys.argv[1] == '-euler':
if sys.argv[2] != '':
print('(p, q):', factor.eulers(int(sys.argv[2])))
elif sys.argv[1] == '-fermat':
if sys.argv[2] != '':
print('(p, q):', factor.fermats(int(sys.argv[2])))
elif sys.argv[1] == '-trial':
if sys.argv[2] != '':
print('(p, q):', factor.trials(int(sys.argv[2])))
elif sys.argv[1] == '-vfactor':
if sys.argv[2] != '':
print('(p, q):', factor.vfactors(int(sys.argv[2])))
elif sys.argv[1] == '-dasilva':
if sys.argv[2] != '':
print('(p, q):', factor.dasilvas(int(sys.argv[2])))
elif sys.argv[1] == '-digit':
if sys.argv[2] != '':
string.digits(sys.argv[2])
elif sys.argv[1] == '-lower':
if sys.argv[2] != '':
string.lowers(sys.argv[2])
elif sys.argv[1] == '-upper':
if sys.argv[2] != '':
string.uppers(sys.argv[2])
elif sys.argv[1] == '-upperdigit':
if sys.argv[2] != '':
string.upperdigits(sys.argv[2])
elif sys.argv[1] == '-lowerdigit':
if sys.argv[2] != '':
string.lowerdigits(sys.argv[2])
elif sys.argv[1] == '-checkRSA':
if sys.argv[2] != '':
modern.check_RSAs(sys.argv[2])
elif sys.argv[1] == '-alpha2num':
if sys.argv[2] != '':
converter.alphabet_to_numbers(sys.argv[2])
elif sys.argv[1] == '-num2alpha':
if sys.argv[2] != '':
converter.number_to_alphabets(sys.argv[2])
else:
helps()
except:
helps()
if __name__ == '__main__':
main()