-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathrePy2exe.py
296 lines (266 loc) · 8.78 KB
/
rePy2exe.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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#!/usr/bin/env python
# -.- coding: utf-8 -.-
# Coded by: Alisson Moretto - 4w4k3 - [email protected]
# view more: https://github.com/4w4k3/rePy2exe
import time, os, sys
def clear():
os.system('clear')
BLUE, RED, WHITE, YELLOW, MAGENTA, GREEN, END = '\33[94m', '\033[91m', '\33[97m', '\33[93m', '\033[1;35m', '\033[1;32m', '\033[0m'
def heading():
sys.stdout.write(GREEN + """
_ .-') ('-. _ (`-. ('-. ) (`-. ('-.
( \( -O ) _( OO) ( (OO ) _( OO) ( OO ). _( OO)
,------.(,------. _.` \ ,--. ,--.-----.(,------.(_/. \_)-.(,------.
| /`. '| .---'(__...--'' \ `.' / ,-. \| .---' \ `.' / | .---'
| / | || | | / | |.-') /'-' | || | \ /\ | |
| |_.' (| '--. | |_.' (OO \ / .' /(| '--. \ \ | (| '--.
| . '.'| .--' | .___.'| / /\_ .' /__ | .--' .' \_) | .--'
| |\ \ | `---. | | `-./ /.__) || `---. / .'. \ | `---.
`--' '--'`------' `--' `--' `-------'`------''--' '--' `------' """ + END + BLUE +
'\n' + '{1}R{0}everse {1}E{0}ngineering {1}Py2Exe{2}{3}'.format(YELLOW, RED, YELLOW, BLUE).center(90) +
'\n' + 'by: {0}Alisson Moretto ({1}4w4k3{2})'.format(
YELLOW, RED, YELLOW, BLUE).center(140) +
'\n' + '{0}[email protected]'.format(
BLUE).center(140) + '\n' + 'Version: {0}0.4{1}\n'.format(YELLOW, END).center(145))
def optionBanner():
print('\nChoose option from menu:\n')
time.sleep(0.2)
print('\t{0}[{1}1{2}]{3} Reverse Exe -> Py').format(YELLOW, RED, YELLOW, WHITE)
time.sleep(0.2)
print('\t{0}[{1}2{2}]{3} Reverse Exe -> Pyc').format(YELLOW, RED, YELLOW, WHITE)
time.sleep(0.2)
print('\t{0}[{1}3{2}]{3} Reverse Pyc -> Py').format(YELLOW, RED, YELLOW, WHITE)
time.sleep(0.2)
print('\n\t{0}[{1}Q{2}]{3} Quit {0}[{1}U{2}]{3} Update \n').format(YELLOW, RED, YELLOW, WHITE)
def exe2pyc():
s = raw_input("Type the path of your exe: ")
ff = str(s)
check = os.path.isfile(ff)
if check == True:
os.popen('python unpy2exe.py ' + s)
c = str(s.split('.exe')[0])
d = '.py.pyc'
z = c + d
os.popen('mv single.py.pyc ' + z)
cwd = str(os.getcwd())
clear()
heading()
print ' '
print 'Processing the EXEcutable...'
sys.stdout.write(YELLOW + ' [*] Working : ' + END + cwd + '/' + str(s))
print ' '
time.sleep(5)
clear()
heading()
print ' '
print 'Everything is OK!'
sys.stdout.write(GREEN + ' [*] Done : ' + END + cwd + '/' + c + '.py.pyc')
print ' '
sys.exit(0)
else:
print ' '
sys.stdout.write(RED + ' [!] File not found : ' + END + str(s))
print ' '
print ' '
enter = raw_input("Press any key to return ")
clear()
heading()
print ' '
def pyc2py():
cwd = str(os.getcwd())
s = raw_input("Type the path of your .pyc: ")
ff = str(s)
check = os.path.isfile(ff)
if check == True:
new = raw_input("Type a name to save your .py: ")
clear()
heading()
print ' '
sys.stdout.write(YELLOW + ' [*] Working : ' + END + str(s))
os.popen('./pycdc/pycdc ' + s + ' >> ' + new + '.py')
print ' '
time.sleep(3)
clear()
heading()
print ' '
print 'Everything is OK!'
sys.stdout.write(GREEN + ' [*] Done : ' + END + cwd + '/' + str(new) + '.py')
print ' '
sys.exit(0)
else:
print ' '
sys.stdout.write(RED + ' [!] File not found : ' + END + str(s))
print ' '
print ' '
enter = raw_input("Press any key to return ")
clear()
heading()
print ' '
def exe2py():
cwd = str(os.getcwd())
s = raw_input("Type the path of your .exe: ")
ff = str(s)
check = os.path.isfile(ff)
if check == True:
clear()
heading()
print ' '
os.popen('python unpy2exe.py ' + s)
clear()
heading()
print ' '
new = raw_input("Type a name to save your .py: ")
os.popen('./pycdc/pycdc ' + 'single.py.pyc' + ' >> ' + new + '.py')
clear()
heading()
print ' '
sys.stdout.write(YELLOW + ' [*] Working : ' + END + str(s))
print ' '
time.sleep(3)
clear()
heading()
print ' '
print 'Everything is OK!'
sys.stdout.write(GREEN + ' [*] Done : ' + END + cwd + '/' + str(new) + '.py')
os.popen('rm -Rf single.py.pyc')
print ' '
sys.exit(0)
else:
print ' '
sys.stdout.write(RED + ' [!] File not found : ' + END + str(s))
print ' '
print ' '
enter = raw_input("Press any key to return ")
clear()
heading()
print ' '
def updater():
os.system('python2.7 updater.py')
def pp():
print """
....
,''. : __
\|_.' `: _.----._//_
.' .'.`'-._ .' _/ -._ \)-.----O
'._.'.' '--''-'._ '--..--'-`
.'.'___ /`'---'. / ,-'`
* _<__.-._))../ /'----'/.'_____:'.
\_ : \ ] : '.
\___: SEE YOU \\ LATER ! : '.
: \\__ : .'
:_______________|__]__________: .'
.' __ '. :.'
.' .' '. '.
.' .' '. '. #rePy2exe
.' .' '. '.
_.' .'______________'. '._
[_0______________________0_]
"""
def main():
clear()
path = 'pycdc'
if os.path.isdir(path):
pass
else:
heading()
print ' '
sys.stdout.write(YELLOW + ' [*] NotFound : ' + END + 'pycdc')
print ' '
choice = raw_input('Dependencies not found, want clone it? (y/n)')
if choice == 'y':
clear()
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Searching Cmake...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
abc = os.system('which cmake')
if abc == 256:
clear()
heading()
print ' '
sys.stdout.write(YELLOW + ' [*] Searching Cmake : ' + END + RED + 'Not Found' + END)
print ' '
print ' '
print ' Please install it : https://cmake.org '
print ' -> apt-get install cmake -y'
sys.exit(0)
else:
print "OK"
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Cloning Dependencies...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
os.popen('git clone https://github.com/4w4k3/pycdc.git')
clear()
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Compiling Dependencies...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
os.system('cd pycdc && cmake ../pycdc/ && make')
elif choice == 'Y':
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Searching Cmake...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
abc = os.system('which cmake')
if abc == 256:
clear()
heading()
print ' '
sys.stdout.write(YELLOW + ' [*] Searching Cmake : ' + END + RED + 'Not Found' + END)
print ' '
print ' '
print ' Please install it : https://cmake.org '
sys.exit(0)
else:
print "OK"
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Cloning Dependencies...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
os.popen('git clone https://github.com/4w4k3/pycdc.git')
clear()
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' [*] Compiling Dependencies...'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
print ' '
os.system('cd pycdc && cmake ../pycdc/ && make')
else:
sys.exit(0)
clear()
heading()
try:
while True:
optionBanner()
header = ('{0}rePy2exe{1}> {2}'.format(BLUE, WHITE, END))
choice = raw_input(header)
if choice.upper() == 'Q' or choice.upper() == 'EXIT':
clear()
pp()
print('\t{0} And that\'s all, folks. xD').format(YELLOW, RED, YELLOW, WHITE)
print '**************************************************'
raise SystemExit
elif choice == '1':
exe2py()
elif choice == '2':
exe2pyc()
elif choice == '3':
pyc2py()
elif choice.upper() == 'UPDATE':
updater()
elif choice.upper() == 'U':
updater()
else:
clear()
print 'Invalid Option'
time.sleep(1)
clear()
heading()
print ' '
except KeyboardInterrupt:
clear()
pp()
print('\t{0} And that\'s all, folks. xD').format(YELLOW, RED, YELLOW, WHITE)
print '**************************************************'
if __name__ == '__main__':
main()