OWASP / pysap

pysap is an open source Python library that provides modules for crafting and sending packets using SAP's NI, Diag, Enqueue, Router, MS, SNC, IGS, RFC and HDB protocols.
https://owasp.org/www-project-core-business-application-security/
GNU General Public License v2.0
220 stars 61 forks source link

kali 2021 fail install #34

Closed feint9 closed 3 years ago

feint9 commented 3 years ago

Hi,

# vmware workstation 15 OS kali 2021.1 x64 full updated

errors

└─# pip install pysap 26.03.21 Collecting pysap Downloading pysap-0.1.18.tar.gz (9.3 MB) ████████████████████████████████ 9.3 MB 4.0 MB/s Collecting cryptography==2.9.2 Downloading cryptography-2.9.2-cp35-abi3-manylinux2010_x86_64.whl (2.7 MB) ████████████████████████████████ 2.7 MB 10.6 MB/s Collecting scapy==2.4.3 Downloading scapy-2.4.3.tar.gz (905 kB) ████████████████████████████████ 905 kB 6.2 MB/s Requirement already satisfied: six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography==2.9.2->pysap) (1.15.0) Requirement already satisfied: cffi!=1.11.3,>=1.8 in /usr/lib/python3/dist-packages (from cryptography==2.9.2->pysap) (1.14.5) Building wheels for collected packages: pysap, scapy Building wheel for pysap (setup.py) ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"'; file='"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-trr6szi8 cwd: /tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/ Complete output (48 lines): running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-3.9 creating build/lib.linux-x86_64-3.9/pysap copying pysap/SAPDiagItems.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPEnqueue.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPRFC.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPIGS.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPDiagClient.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPPSE.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPLPS.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPMS.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPCredv2.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPHDB.py -> build/lib.linux-x86_64-3.9/pysap copying pysap/SAPSNC.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPDiag.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPCAR.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/init.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPRouter.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPNI.py -> build/lib.linux-x86_64-3.9/pysap
creating build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/fields.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/console.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/crypto.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/init.py -> build/lib.linux-x86_64-3.9/pysap/utils
running build_ext
building 'pysapcompress' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/pysapcompress
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c pysapcompress/pysapcompress.cpp -o build/temp.linux-x86_64-3.9/pysapcompress/pysapcompress.o
pysapcompress/pysapcompress.cpp: In function ‘int decompress_packet(const unsigned char*, int, unsigned char*, int)’:
pysapcompress/pysapcompress.cpp:122:10: warning: variable ‘bufin_length’ set but not used [-Wunused-but-set-variable]
122
SAP_INT bufin_length = 0, bufin_rest = 0, bufout_length = 0, bufout_rest = 0, data_length = 0, bytes_read = 0, bytes_decompressed = 0, total_decompressed = 0; ^~~~
pysapcompress/pysapcompress.cpp: In function ‘int compress_packet(const unsigned char*, int, unsigned char*, int, unsigned int)’:
pysapcompress/pysapcompress.cpp:252:12: warning: variable ‘bufin’ set but not used [-Wunused-but-set-variable]
252
SAP_BYTE bufin = NULL, bufin_pos = NULL, bufout = NULL, bufout_pos = NULL; ^~~~~
pysapcompress/pysapcompress.cpp: In function ‘PyObject* initpysapcompress()’:
pysapcompress/pysapcompress.cpp:460:14: error: ‘Py_InitModule3’ was not declared in this scope
460
module = Py_InitModule3("pysapcompress", pysapcompressMethods, pysapcompress_module_doc); ^~~~~~
pysapcompress/pysapcompress.cpp:473:1: warning: no return statement in function returning non-void [-Wreturn-type]
473
} ^
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
ERROR: Failed building wheel for pysap Running setup.py clean for pysap Building wheel for scapy (setup.py) ... done Created wheel for scapy: filename=scapy-2.4.3-py2.py3-none-any.whl size=1043876 sha256=5c7655a21df3bf5aa293133c71f00803acce648b0d4473edbe9302064706d49d Stored in directory: /root/.cache/pip/wheels/9a/87/a8/5fa6966dcabd6c4587b60b8d42cfeb3f21b7aace507ee76280 Successfully built scapy Failed to build pysap Installing collected packages: scapy, cryptography, pysap Attempting uninstall: scapy Found existing installation: scapy 2.4.4 Not uninstalling scapy at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'scapy'. No files were found to uninstall. Attempting uninstall: cryptography Found existing installation: cryptography 3.3.2 Not uninstalling cryptography at /usr/lib/python3/dist-packages, outside environment /usr Can't uninstall 'cryptography'. No files were found to uninstall. Running setup.py install for pysap ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"'; file='"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-33c9a0ih/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pysap
cwd: /tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/
Complete output (48 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPDiagItems.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPEnqueue.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPRFC.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPIGS.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPDiagClient.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPPSE.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPLPS.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPMS.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPCredv2.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPHDB.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPSNC.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPDiag.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPCAR.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/init.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPRouter.py -> build/lib.linux-x86_64-3.9/pysap
copying pysap/SAPNI.py -> build/lib.linux-x86_64-3.9/pysap
creating build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/fields.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/console.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/crypto.py -> build/lib.linux-x86_64-3.9/pysap/utils
copying pysap/utils/init.py -> build/lib.linux-x86_64-3.9/pysap/utils
running build_ext
building 'pysapcompress' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/pysapcompress
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.9 -c pysapcompress/pysapcompress.cpp -o build/temp.linux-x86_64-3.9/pysapcompress/pysapcompress.o
pysapcompress/pysapcompress.cpp: In function ‘int decompress_packet(const unsigned char*, int, unsigned char*, int)’:
pysapcompress/pysapcompress.cpp:122:10: warning: variable ‘bufin_length’ set but not used [-Wunused-but-set-variable]
122
SAP_INT bufin_length = 0, bufin_rest = 0, bufout_length = 0, bufout_rest = 0, data_length = 0, bytes_read = 0, bytes_decompressed = 0, total_decompressed = 0; ^~~~
pysapcompress/pysapcompress.cpp: In function ‘int compress_packet(const unsigned char*, int, unsigned char*, int, unsigned int)’:
pysapcompress/pysapcompress.cpp:252:12: warning: variable ‘bufin’ set but not used [-Wunused-but-set-variable]
252
SAP_BYTE bufin = NULL, bufin_pos = NULL, bufout = NULL, bufout_pos = NULL; ^~~~~
pysapcompress/pysapcompress.cpp: In function ‘PyObject* initpysapcompress()’:
pysapcompress/pysapcompress.cpp:460:14: error: ‘Py_InitModule3’ was not declared in this scope
460
module = Py_InitModule3("pysapcompress", pysapcompressMethods, pysapcompress_module_doc); ^~~~~~
pysapcompress/pysapcompress.cpp:473:1: warning: no return statement in function returning non-void [-Wreturn-type]
473
} ^
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"'; file='"'"'/tmp/pip-install-spn9quud/pysap_9ef140eec1b346a6b434e46b9a8dc4c8/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-33c9a0ih/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/pysap Check the logs for full command output.

martingalloar commented 3 years ago

Hey @feint9! Thanks for reaching out! pysap is currently only Python 2 compatible, in the log you pasted it's clear that it's trying to build it against Python 3.9.

Make sure you're using Python 2.7 and have the python2.7-dev package installed. I suggest you use a virtualenv, pyenv or similar to make things easier. Kali provides a nice guide for this cases in https://www.kali.org/docs/general-use/using-eol-python-versions/