Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a hook for PyInstaller to resolve Impacket library #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions build_scripts/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ pip install pyinstaller==3.4
pip install .

# Hardcode UTF-8 in shells
sed -r -i.bak 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py
sed -r -i.bak 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py

# Create hook directory
mkdir /tmp/custom-hooks

# Create hook file
echo "from PyInstaller.utils.hooks import copy_metadata" >> /tmp/custom-hooks/hook-impacket.py
echo "datas = copy_metadata('impacket')" >> /tmp/custom-hooks/hook-impacket.py

# Create standalone executables
for i in examples/*.py
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean -F $i
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean --additional-hooks-dir /tmp/custom-hooks -F $i
done

# Rename binaries and move
Expand Down
13 changes: 10 additions & 3 deletions build_scripts/build_musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,19 @@ pip install pyinstaller==3.4
pip install .

# Hardcode UTF-8 in shells
sed -r -i.bak 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py
sed -r -i.bak 's/sys\.std(in|out)\.encoding/"UTF-8"/g' examples/*exec.py

# Create hook directory
mkdir /tmp/custom-hooks

# Create hook file
echo "from PyInstaller.utils.hooks import copy_metadata" >> /tmp/custom-hooks/hook-impacket.py
echo "datas = copy_metadata('impacket')" >> /tmp/custom-hooks/hook-impacket.py

# Create standalone executables
for i in examples/*.py
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean -F $i
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean --additional-hooks-dir /tmp/custom-hooks -F $i
done

# Rename binaries
Expand Down
12 changes: 9 additions & 3 deletions build_scripts/build_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -euo pipefail

### This script is intended to be run in the cdrx/pyinstaller-windows:python2 Docker image


[[ ! -f /.dockerenv ]] && echo "Do not run this script outside of the docker image! Use the Makefile" && exit 1

# Normalize working dir
Expand All @@ -14,10 +13,17 @@ cd "${ROOT}"
# Install impacket
pip install .

# Create hook directory
mkdir /tmp/custom-hooks

# Create hook file
echo "from PyInstaller.utils.hooks import copy_metadata" >> /tmp/custom-hooks/hook-impacket.py
echo "datas = copy_metadata('impacket')" >> /tmp/custom-hooks/hook-impacket.py

# Create standalone executables
for i in examples/*.py
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean -F $i
do
pyinstaller --specpath /tmp/spec --workpath /tmp/build --distpath /tmp/out --clean --additional-hooks-dir /tmp/custom-hooks -F $i
done

# Rename binaries and move
Expand Down