Merge pull request #288 from guardicore/feature/add-island-pyinstaller

Feature/add island pyinstaller
This commit is contained in:
itaymmguardicore 2019-04-07 21:07:29 +03:00 committed by GitHub
commit 740af9ccef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 116 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -0,0 +1,93 @@
# -*- mode: python -*-
import os
import platform
__author__ = 'itay.mizeretz'
block_cipher = None
def main():
a = Analysis(['cc/main.py'],
pathex=['..'],
hiddenimports=get_hidden_imports(),
hookspath=None,
runtime_hooks=None,
binaries=None,
datas=None,
excludes=None,
win_no_prefer_redirects=None,
win_private_assemblies=None,
cipher=block_cipher
)
a.binaries += get_binaries()
a.datas = process_datas(a.datas)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=get_monkey_filename(),
debug=False,
strip=get_exe_strip(),
upx=True,
console=True,
icon=get_exe_icon())
def is_windows():
return platform.system().find("Windows") >= 0
def is_32_bit():
return platform.architecture()[0] == "32bit"
def process_datas(orig_datas):
datas = orig_datas
if is_windows():
datas = [i for i in datas if i[0].find('Include') < 0]
return datas
def get_binaries():
binaries = get_windows_only_binaries() if is_windows() else get_linux_only_binaries()
return binaries
def get_windows_only_binaries():
binaries = []
binaries += get_msvcr()
return binaries
def get_linux_only_binaries():
binaries = []
return binaries
def get_hidden_imports():
return ['_cffi_backend', 'queue'] if is_windows() else ['_cffi_backend']
def get_msvcr():
return [('msvcr100.dll', os.environ['WINDIR'] + '\\system32\\msvcr100.dll', 'BINARY')]
def get_monkey_filename():
return 'monkey_island.exe' if is_windows() else 'monkey_island'
def get_exe_strip():
return not is_windows()
def get_exe_icon():
return 'monkey_island.ico' if is_windows() else None
main() # We don't check if __main__ because this isn't the main script.

View File

@ -9,10 +9,12 @@ flask
Flask-Pymongo
Flask-Restful
Flask-JWT
jsonschema
jsonschema==2.6.0
netifaces
ipaddress
enum34
pycryptodome
boto3
awscli
awscli
cffi
PyInstaller

View File

@ -0,0 +1,5 @@
REM - Builds Monkey Island Server EXE using pyinstaller -
bin\Python27\Scripts\pyinstaller.exe -F --log-level=DEBUG --clean --upx-dir=.\bin monkey_island.spec
move /Y dist\monkey_island.exe monkey_island.exe
rmdir /S /Q build
rmdir /S /Q dist

View File

@ -1,3 +1,4 @@
REM - Runs Monkey Island Server using python -
@title C^&C Server
@pushd ..
@monkey_island\bin\Python27\Scripts\python monkey_island.py

View File

@ -0,0 +1,5 @@
REM - Runs Monkey Island Server using built pyinstaller EXE -
@title C^&C Server
@pushd ..
@monkey_island\monkey_island.exe
@popd

View File

@ -1,2 +1,3 @@
REM - Runs MongoDB Server -
@title MongoDB
@bin\mongodb\mongod.exe --dbpath db

View File

@ -1,4 +1,5 @@
REM - Runs MongoDB Server & Monkey Island Server using built pyinstaller EXE -
if not exist db mkdir db
start windows\run_mongodb.bat
start windows\run_cc.bat
start windows\run_cc_exe.bat
start https://localhost:5000

View File

@ -0,0 +1,5 @@
REM - Runs MongoDB Server & Monkey Island Server using python -
if not exist db mkdir db
start windows\run_mongodb.bat
start windows\run_cc.bat
start https://localhost:5000