diff --git a/client/requirements.txt b/client/requirements.txt index 1f89c622..495c26a7 100644 --- a/client/requirements.txt +++ b/client/requirements.txt @@ -11,4 +11,4 @@ win_inet_pton dnslib dukpy zeroconf==0.19.1 -python-ntlm +https://github.com/alxchk/python-ntlm/archive/master.zip diff --git a/client/sources-linux/build-docker.sh b/client/sources-linux/build-docker.sh index f2d88455..6e4d8734 100755 --- a/client/sources-linux/build-docker.sh +++ b/client/sources-linux/build-docker.sh @@ -1,12 +1,12 @@ #!/bin/sh -SELF=`readlink -f "$0"` -SELFPWD=`dirname "$SELF"` -SRC=${SELFPWD:-`pwd`} +SELF=$(readlink -f "$0") +SELFPWD=$(dirname "$SELF") +SRC=${SELFPWD:-$(pwd)} cd $SRC -PUPY=`readlink -f ../../pupy/` +PUPY=$(readlink -f ../../pupy/) TEMPLATES=$PUPY/payload_templates EXTERNAL=../../pupy/external @@ -22,23 +22,24 @@ python -m pip install --upgrade setuptools cython python -m pip install --upgrade -q six packaging appdirs CC=/gccwrap CFLAGS_ABORT="-D_FORTIFY_SOURCE=2 -fstack-protector" \ - python -m pip install --upgrade -q pynacl --no-binary :all: + python -m pip install --upgrade -q pynacl --no-binary :all: CC=/gccwrap CFLAGS_FILTER="-Wno-error=sign-conversion" \ - python -m pip install --upgrade -q cryptography --no-binary :all: + python -m pip install --upgrade -q cryptography --no-binary :all: export PRCTL_SKIP_KERNEL_CHECK=yes python -m pip install --upgrade \ - rpyc==3.4.4 pyaml rsa netaddr pyyaml ecdsa idna \ - paramiko pylzma pydbus python-ptrace psutil scandir \ - scapy colorama pyOpenSSL python-xlib msgpack-python python-ntlm \ - u-msgpack-python poster dnslib pyxattr pylibacl python-prctl http_parser \ - https://github.com/alxchk/tinyec/archive/master.zip \ - https://github.com/CoreSecurity/impacket/archive/master.zip \ - https://github.com/warner/python-ed25519/archive/master.zip \ - zeroconf==0.19.1 \ - watchdog pulsectl pyalsaaudio pycryptodomex==3.7.0 --no-binary :all: + rpyc==3.4.4 pyaml rsa netaddr pyyaml ecdsa idna \ + paramiko pylzma pydbus python-ptrace psutil scandir \ + scapy colorama pyOpenSSL python-xlib msgpack-python \ + u-msgpack-python poster dnslib pyxattr pylibacl python-prctl http_parser \ + https://github.com/alxchk/tinyec/archive/master.zip \ + https://github.com/CoreSecurity/impacket/archive/master.zip \ + https://github.com/warner/python-ed25519/archive/master.zip \ + https://github.com/alxchk/python-ntlm/archive/master.zip \ + zeroconf==0.19.1 \ + watchdog pulsectl pyalsaaudio pycryptodomex==3.7.0 --no-binary :all: if [ "$TOOLCHAIN_ARCH" == "x86" ]; then CFLAGS_PYJNIUS="$CFLAGS" @@ -47,11 +48,11 @@ else fi CFLAGS="${CFLAGS_PYJNIUS}" NO_JAVA=1 \ - python -m pip install \ - https://github.com/alxchk/pyjnius/archive/master.zip + python -m pip install \ + https://github.com/alxchk/pyjnius/archive/master.zip CFLAGS="$CFLAGS -DDUK_DOUBLE_INFINITY=\"(1.0 / 0.0)\"" \ - python -m pip install --force-reinstall --upgrade dukpy --no-binary :all: + python -m pip install --force-reinstall --upgrade dukpy --no-binary :all: python -m pip install https://github.com/apple/ccs-pykerberos/archive/master.zip @@ -65,7 +66,7 @@ python -m pip install --upgrade --force $PYKCP python -c 'import kcp' || exit 1 echo "[+] Compile opus" -( cd $PYOPUS && make clean && make && mv -f opus.so /usr/lib/python2.7/site-packages ) +(cd $PYOPUS && make clean && make && mv -f opus.so /usr/lib/python2.7/site-packages) python -c 'import opus' || exit 1 echo "[+] Compile pyuv" @@ -74,12 +75,12 @@ if [ "$TOOLCHAIN_ARCH" == "x86" ]; then CFLAGS_PYUV="-O2 -pipe -DCLOCK_MONOTONIC=1 -UHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC" CFLAGS_PYUV="$CFLAGS_PYUV -U_FILE_OFFSET_BITS -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K8" CFLAGS_PYUV="$CFLAGS_PYUV -D_GNU_SOURCE -DS_ISSOCK(m)='(((m) & S_IFMT) == S_IFSOCK)'" - + CC=/gccwrap CFLAGS_FILTER="-D_FILE_OFFSET_BITS=64" CFLAGS="$CFLAGS_PYUV" \ - python -m pip install pyuv --upgrade --no-binary :all: + python -m pip install pyuv --upgrade --no-binary :all: else CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600 -D_GNU_SOURCE -DS_ISSOCK(m)='(((m) & S_IFMT) == S_IFSOCK)'" \ - python -m pip install pyuv --upgrade --no-binary :all: + python -m pip install pyuv --upgrade --no-binary :all: fi # python -m pip install --upgrade --no-binary :all: pycryptodome==3.7.0 @@ -97,24 +98,24 @@ zip -y -r -9 ${TEMPLATES}/linux-${TOOLCHAIN_ARCH}.zip . \ -x "*.a" -x "*.la" -x "*.o" -x "*.whl" -x "*.txt" -x "*.pyo" -x "*.pyc" \ -x "*test/*" -x "*tests/*" -x "*examples/*" \ -x "*.egg-info/*" -x "*.dist-info/*" \ - -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" >/dev/null + -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" >/dev/null ldconfig echo "[+] Build pupy" case $TOOLCHAIN_ARCH in - amd64) - MAKEFLAGS="ARCH=64" - TARGETS="pupyx64d.lin pupyx64d.lin" - TARGETS="$TARGETS pupyx64.lin pupyx64.lin.so" - ;; +amd64) + MAKEFLAGS="ARCH=64" + TARGETS="pupyx64d.lin pupyx64d.lin" + TARGETS="$TARGETS pupyx64.lin pupyx64.lin.so" + ;; - x86) - MAKEFLAGS="ARCH=32 PIE=" - TARGETS="pupyx86d.lin pupyx86d.lin.so" - TARGTS="$TARGETS pupyx86dpupyx86.lin pupyx86.lin.so" - ;; +x86) + MAKEFLAGS="ARCH=32 PIE=" + TARGETS="pupyx86d.lin pupyx86d.lin.so" + TARGTS="$TARGETS pupyx86dpupyx86.lin pupyx86.lin.so" + ;; esac for target in $TARGETS; do rm -f $TEMPLATES/$target; done @@ -128,12 +129,12 @@ make -j DEBUG=1 $MAKEFLAGS for object in $TARGETS; do if [ -z "$object" ]; then - continue + continue fi - + if [ ! -f $TEMPLATES/$object ]; then - echo "[-] $object - failed" - FAILED=1 + echo "[-] $object - failed" + FAILED=1 fi done diff --git a/client/sources/build-docker.sh b/client/sources/build-docker.sh index 81a7cd5f..77047d91 100755 --- a/client/sources/build-docker.sh +++ b/client/sources/build-docker.sh @@ -9,17 +9,18 @@ PACKAGES="$PACKAGES pyaudio https://github.com/secdev/scapy/archive/master.zip c PACKAGES="$PACKAGES https://github.com/alxchk/pypykatz/archive/master.zip" PACKAGES="$PACKAGES https://github.com/warner/python-ed25519/archive/master.zip" PACKAGES="$PACKAGES https://github.com/alxchk/tinyec/archive/master.zip" -PACKAGES="$PACKAGES adodbapi idna wmi winkerberos http_parser python-ntlm" +PACKAGES="$PACKAGES https://github.com/alxchk/python-ntlm/archive/master.zip" +PACKAGES="$PACKAGES adodbapi idna wmi winkerberos http_parser" -SELF=`readlink -f "$0"` -SELFPWD=`dirname "$SELF"` -SRC=${SELFPWD:-`pwd`} -PUPY=`readlink -f ../../pupy` +SELF=$(readlink -f "$0") +SELFPWD=$(dirname "$SELF") +SRC=${SELFPWD:-$(pwd)} +PUPY=$(readlink -f ../../pupy) cd $SRC -EXTERNAL=`readlink -f ../../pupy/external` -TEMPLATES=`readlink -f ../../pupy/payload_templates` +EXTERNAL=$(readlink -f ../../pupy/external) +TEMPLATES=$(readlink -f ../../pupy/payload_templates) WINPTY=$EXTERNAL/winpty PYKCP=$EXTERNAL/pykcp PYOPUS=$EXTERNAL/pyopus/src @@ -33,19 +34,19 @@ for PYTHON in $PYTHON32 $PYTHON64; do $PYTHON -m pip install -q --upgrade pynacl LIB="C:\\Windows\\openssl-build\\lib" \ - INCLUDE="C:\\Windows\\openssl-build\\include" \ - $PYTHON -m pip install --upgrade --no-binary :all: $PACKAGES_BUILD + INCLUDE="C:\\Windows\\openssl-build\\include" \ + $PYTHON -m pip install --upgrade --no-binary :all: $PACKAGES_BUILD NO_JAVA=1 \ - $PYTHON -m pip install --upgrade --force-reinstall \ - https://github.com/alxchk/pyjnius/archive/master.zip + $PYTHON -m pip install --upgrade --force-reinstall \ + https://github.com/alxchk/pyjnius/archive/master.zip $PYTHON -m pip install --upgrade $PACKAGES $PYTHON -c "from Crypto.Cipher import AES; AES.new" if [ ! $? -eq 0 ]; then - echo "pycryptodome build failed" - exit 1 + echo "pycryptodome build failed" + exit 1 fi rm -rf $PYKCP/{kcp.so,kcp.pyd,kcp.dll,build,KCP.egg-info} @@ -72,7 +73,6 @@ git clean -fdx make -f Makefile.msvc CL=$CL64 mv -f opus.pyd ${WINE64}/drive_c/Python27/Lib/site-packages/ - echo "[+] Compile winpty /32" rm -f $WINPTY/build/winpty.dll make -C ${WINPTY} clean @@ -99,14 +99,14 @@ echo "[+] Build templates /32" cd $WINE32/drive_c/Python27 rm -f ${TEMPLATES}/windows-x86.zip for dir in Lib DLLs; do -cd $dir -zip -q -y \ - -x "*.a" -x "*.o" -x "*.whl" -x "*.txt" -x "*.pyo" -x "*.pyc" -x "*.chm" \ - -x "*test/*" -x "*tests/*" -x "*examples/*" -x "pythonwin/*" \ - -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" \ - -x "*.egg-info/*" -x "*.dist-info/*" -x "*.exe" \ - -r9 ${TEMPLATES}/windows-x86.zip . -cd - + cd $dir + zip -q -y \ + -x "*.a" -x "*.o" -x "*.whl" -x "*.txt" -x "*.pyo" -x "*.pyc" -x "*.chm" \ + -x "*test/*" -x "*tests/*" -x "*examples/*" -x "pythonwin/*" \ + -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" \ + -x "*.egg-info/*" -x "*.dist-info/*" -x "*.exe" \ + -r9 ${TEMPLATES}/windows-x86.zip . + cd - done cd $WINE64/drive_c/Python27 @@ -114,14 +114,14 @@ rm -f ${TEMPLATES}/windows-amd64.zip echo "[+] Build templates /64" for dir in Lib DLLs; do -cd $dir -zip -q -y \ - -x "*.a" -x "*.o" -x "*.whl" -x "*.txt" -x "*.pyo" -x "*.pyc" -x "*.chm" \ - -x "*test/*" -x "*tests/*" -x "*examples/*" -x "pythonwin/*" \ - -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" \ - -x "*.egg-info/*" -x "*.dist-info/*" -x "*.exe" \ - -r9 ${TEMPLATES}/windows-amd64.zip . -cd - + cd $dir + zip -q -y \ + -x "*.a" -x "*.o" -x "*.whl" -x "*.txt" -x "*.pyo" -x "*.pyc" -x "*.chm" \ + -x "*test/*" -x "*tests/*" -x "*examples/*" -x "pythonwin/*" \ + -x "idlelib/*" -x "lib-tk/*" -x "tk*" -x "tcl*" \ + -x "*.egg-info/*" -x "*.dist-info/*" -x "*.exe" \ + -r9 ${TEMPLATES}/windows-amd64.zip . + cd - done echo "[+] Build pupy" @@ -147,12 +147,12 @@ make -f Makefile -j BUILDENV=/build DEBUG=1 ARCH=win64 for object in $TARGETS; do if [ -z "$object" ]; then - continue + continue fi if [ ! -f $TEMPLATES/$object ]; then - echo "[-] $object - failed" - FAILED=1 + echo "[-] $object - failed" + FAILED=1 fi done diff --git a/pupy/requirements.txt b/pupy/requirements.txt index 6163937f..5b9b79c9 100644 --- a/pupy/requirements.txt +++ b/pupy/requirements.txt @@ -43,7 +43,7 @@ xattr dukpy pyaes chardet -python-ntlm +https://github.com/alxchk/python-ntlm/archive/master.zip http_request -e external/pykcp flake8