From 5607fb063824f03df647c0fb47691c10d1c3fb2a Mon Sep 17 00:00:00 2001 From: meemo Date: Mon, 7 Feb 2022 00:35:08 -0500 Subject: [PATCH] Switch windows build process to nuitka --- .gitignore | 7 +++++++ README.md | 16 +++++++++++----- sudomemoDNS.py | 4 ++-- sudomemoDNS_v1.2.1.spec | 32 -------------------------------- 4 files changed, 20 insertions(+), 39 deletions(-) delete mode 100644 sudomemoDNS_v1.2.1.spec diff --git a/.gitignore b/.gitignore index c18dd8d..df94962 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ +.idea/ __pycache__/ +sudomemoDNS.build/ +sudomemoDNS.dist/ +sudomemoDNS.onefile-build/ + +sudomemoDNS.exe + diff --git a/README.md b/README.md index 3ec841d..8b6211c 100644 --- a/README.md +++ b/README.md @@ -50,12 +50,18 @@ Note: `python3` is assumed to be the name of your python binary, if it is not th ## Building on Windows -- Install dnslib, requests, and pyinstaller via the following command as an administrator +- Install Python 3.6+ (preferably 3.9). Make sure to install the x86 version for 32 bit targets. - python -m pip install -r requirements.txt pyinstaller +- Install all requirements via the following command as an administrator -- Modify the paths in all caps in `sudomemoDNS_v1.2.1.spec` to where sudomemoDNS and the sudomemoDNS icon is stored. +``` +python -m pip install -r requirements.txt nuitka zstandard +``` -- Run the following as an administrator: +- Run the following (answer yes to any prompts): - pyinstaller sudomemoDNS_v1.2.1.spec +```shell +python -m nuitka --standalone --onefile --windows-icon-from-ico=sudomemoDNS_icon.ico -o sudomemoDNS.exe sudomemoDNS.py +``` + +- Run `sudomemoDNS.exe` \ No newline at end of file diff --git a/sudomemoDNS.py b/sudomemoDNS.py index 7c8fc04..8522546 100644 --- a/sudomemoDNS.py +++ b/sudomemoDNS.py @@ -2,7 +2,7 @@ from datetime import datetime from json import loads -from socket import socket, AF_INET, SOCK_DGRAM +from socket import socket, AF_INET, SOCK_DGRAM, gethostbyname from sys import platform from time import sleep @@ -182,7 +182,7 @@ for zone in zones: if zone["type"] == "a": ZONES[zone["name"]] = [Record(A, zone["value"])] elif zone["type"] == "p": - ZONES[zone["name"]] = [Record(A, socket.gethostbyname(zone["value"]))] + ZONES[zone["name"]] = [Record(A, gethostbyname(zone["value"]))] print("[INFO] DNS information loaded successfully.") diff --git a/sudomemoDNS_v1.2.1.spec b/sudomemoDNS_v1.2.1.spec deleted file mode 100644 index 8a51ad4..0000000 --- a/sudomemoDNS_v1.2.1.spec +++ /dev/null @@ -1,32 +0,0 @@ -# -*- mode: python -*- - -block_cipher = None - - -a = Analysis(['sudomemoDNS.py'], - pathex=['C:\\PATH\\TO\\SUDOMEMODNS'], - binaries=[], - datas=[], - hiddenimports=[], - hookspath=[], - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False) -pyz = PYZ(a.pure, a.zipped_data, - cipher=block_cipher) -exe = EXE(pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - [], - name='sudomemoDNS_v1.2.1', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - runtime_tmpdir=None, - console=True , icon='C:\\PATH\\TO\\SUDOMEMODNS\\ICON.ico')