mushorg / pylibinjection Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
There are some changes in libinjection that require changes in pylibinjection.
Hi I tried to install pylibinjection in order to install glastopf afterwards. I installed glastopf via pip successfully but wanted to switch to the developement version. So I removed glastopf via pip and tried to build pylibinjection. But I get an error while "python setup.py install" a error occured:
running build
running build_ext
cythoning src/pylibinjection.pyx to src/pylibinjection.c
warning: src/pylibinjection.pxd:103:44: Function signature does not match previous declaration
building 'pylibinjection' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/opt/libinjection/c -I/usr/include/python2.7 -c src/pylibinjection.c -o build/temp.linux-x86_64-2.7/src/pylibinjection.o
src/pylibinjection.c: In function ‘__pyx_pf_14pylibinjection_detect_sqli’:
src/pylibinjection.c:770:3: error: unknown type name ‘sfilter’
src/pylibinjection.c:791:19: error: ‘sfilter’ undeclared (first use in this function)
src/pylibinjection.c:791:19: note: each undeclared identifier is reported only once for each function it appears in
src/pylibinjection.c:791:28: error: expected expression before ‘)’ token
src/pylibinjection.c:827:3: warning: implicit declaration of function ‘libinjection_sqli_init’ [-Wimplicit-function-declaration]
src/pylibinjection.c:836:3: warning: implicit declaration of function ‘libinjection_is_sqli’ [-Wimplicit-function-declaration]
src/pylibinjection.c:848:3: warning: implicit declaration of function ‘libinjection_sqli_check_fingerprint’ [-Wimplicit-function-declaration]
src/pylibinjection.c:860:41: error: request for member ‘reason’ in something not a structure or union
src/pylibinjection.c:871:51: error: request for member ‘fingerprint’ in something not a structure or union
error: command 'gcc' failed with exit status 1
Yes I deleted src/pylibinjection.c and the same error occurs.
Versions:
python: 2.7.3
gcc: 4.7.2
cython: 0.19.2
Thanks
Shortfinga
Just a tip. You don't need Cython at all in order to use a Cython project. Simply remove the directive from .gitignore about the generated .c and distribute the C code generated by Cython. After that redefine "sourcefiles" pointing it to the .c file and you're done. Moving this way all the end user needs is a C compiler. Take a look at
https://github.com/buffer/pylibemu/blob/master/setup.py
for a nice example.
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f3902a30d76]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f3902a35aac]
/home/user/virt_envs/pylibinjection/local/lib/python2.7/site-packages/pylibinjection.so(+0x15458)[0x7f3901da4458]
python(PyEval_EvalFrameEx+0x9c6)[0x4eb166]
python(PyEval_EvalCodeEx+0x1a0)[0x4f1db0]
python(PyRun_InteractiveOneFlags+0x275)[0x4f29b5]
python(PyRun_InteractiveLoopFlags+0x145)[0x4f2d35]
python(Py_Main+0xdd0)[0x4dac00]
/lib/x86_64-linux-gn
I am unable to install the library using pip3 but works fine for pip2. Following is the snippet from pip3 installation:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: aiohttp in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 1)) (3.4.4)
Requirement already satisfied: aiomysql in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 2)) (0.0.20)
Requirement already satisfied: aiohttp_jinja2==1.1.0 in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 3)) (1.1.0)
Requirement already satisfied: docker<2.6 in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 4)) (2.5.1)
Requirement already satisfied: mimesis<3.0.0 in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 5)) (2.1.0)
Requirement already satisfied: yarl in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 6)) (1.4.2)
Requirement already satisfied: redis in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 7)) (3.4.1)
Requirement already satisfied: aioredis in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 8)) (1.3.1)
Requirement already satisfied: uvloop in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 9)) (0.14.0)
Requirement already satisfied: pymongo in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 10)) (3.10.1)
Collecting pylibinjection
Using cached pylibinjection-0.2.4.tar.gz (68 kB)
Requirement already satisfied: jinja2 in /home/puneet/.local/lib/python3.7/site-packages (from -r requirements.txt (line 12)) (2.10.1)
Requirement already satisfied: pycodestyle in /usr/local/lib/python3.7/dist-packages (from -r requirements.txt (line 13)) (2.4.0)
Collecting geoip2
Using cached geoip2-3.0.0-py2.py3-none-any.whl (23 kB)
Collecting aiodocker
Using cached aiodocker-0.17.0-py3-none-any.whl (28 kB)
Processing /home/puneet/.cache/pip/wheels/84/bf/40/2f6ef700f48401ca40e5e3dd7d0e3c0a90e064897b7fe5fc08/tornado-6.0.3-cp37-cp37m-linux_x86_64.whl
Requirement already satisfied: mako in /usr/lib/python3/dist-packages (from -r requirements.txt (line 17)) (1.0.7)
Requirement already satisfied: chardet<4.0,>=2.0 in /usr/lib/python3/dist-packages (from aiohttp->-r requirements.txt (line 1)) (3.0.4)
Requirement already satisfied: attrs>=17.3.0 in /home/puneet/.local/lib/python3.7/site-packages (from aiohttp->-r requirements.txt (line 1)) (19.1.0)
Requirement already satisfied: multidict<5.0,>=4.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->-r requirements.txt (line 1)) (4.7.4)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /usr/local/lib/python3.7/dist-packages (from aiohttp->-r requirements.txt (line 1)) (3.0.1)
Requirement already satisfied: PyMySQL<=0.9.2,>=0.9 in /home/puneet/.local/lib/python3.7/site-packages (from aiomysql->-r requirements.txt (line 2)) (0.9.2)
Requirement already satisfied: websocket-client>=0.32.0 in /home/puneet/.local/lib/python3.7/site-packages (from docker<2.6->-r requirements.txt (line 4)) (0.57.0)
Requirement already satisfied: six>=1.4.0 in /usr/lib/python3/dist-packages (from docker<2.6->-r requirements.txt (line 4)) (1.12.0)
Requirement already satisfied: docker-pycreds>=0.2.1 in /home/puneet/.local/lib/python3.7/site-packages (from docker<2.6->-r requirements.txt (line 4)) (0.4.0)
Requirement already satisfied: requests!=2.11.0,!=2.12.2,!=2.18.0,>=2.5.2 in /usr/lib/python3/dist-packages (from docker<2.6->-r requirements.txt (line 4)) (2.21.0)
Requirement already satisfied: idna>=2.0 in /home/puneet/.local/lib/python3.7/site-packages (from yarl->-r requirements.txt (line 6)) (2.8)
Requirement already satisfied: hiredis in /home/puneet/.local/lib/python3.7/site-packages (from aioredis->-r requirements.txt (line 8)) (1.0.1)
Requirement already satisfied: cython in /home/puneet/.local/lib/python3.7/site-packages (from pylibinjection->-r requirements.txt (line 11)) (0.29.14)
Requirement already satisfied: MarkupSafe>=0.23 in /home/puneet/.local/lib/python3.7/site-packages (from jinja2->-r requirements.txt (line 12)) (1.1.1)
Collecting urllib3>=1.25.2
Using cached urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
Processing /home/puneet/.cache/pip/wheels/de/72/0f/3cd8691e27e01d9dbab6032e4f1a5ba65ef9e42612b8c379d1/maxminddb-1.5.2-cp37-none-any.whl
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from PyMySQL<=0.9.2,>=0.9->aiomysql->-r requirements.txt (line 2)) (2.6.1)
Building wheels for collected packages: pylibinjection
Building wheel for pylibinjection (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-aeg_thjo/pylibinjection/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aeg_thjo/pylibinjection/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-kr7_pu6d
cwd: /tmp/pip-install-aeg_thjo/pylibinjection/
Complete output (17 lines):
running bdist_wheel
running build
running build_ext
skipping 'src/pylibinjection.c' Cython extension (up-to-date)
building 'pylibinjection' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/submodules
creating build/temp.linux-x86_64-3.7/submodules/libinjection
creating build/temp.linux-x86_64-3.7/submodules/libinjection/c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isubmodules/libinjection/c -I/usr/include/python3.7m -c src/pylibinjection.c -o build/temp.linux-x86_64-3.7/src/pylibinjection.o
src/pylibinjection.c:8:10: fatal error: pyconfig.h: No such file or directory
8 | #include "pyconfig.h"
| ^~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pylibinjection
Running setup.py clean for pylibinjection
Failed to build pylibinjection
ERROR: geoip2 3.0.0 has requirement requests>=2.22.0, but you'll have requests 2.21.0 which is incompatible.
ERROR: aiodocker 0.17.0 has requirement aiohttp>=3.6, but you'll have aiohttp 3.4.4 which is incompatible.
Installing collected packages: pylibinjection, urllib3, maxminddb, geoip2, aiodocker, tornado
Running setup.py install for pylibinjection ... 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-aeg_thjo/pylibinjection/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aeg_thjo/pylibinjection/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-omi97vjb/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/puneet/.local/include/python3.7m/pylibinjection
cwd: /tmp/pip-install-aeg_thjo/pylibinjection/
Complete output (17 lines):
running install
running build
running build_ext
skipping 'src/pylibinjection.c' Cython extension (up-to-date)
building 'pylibinjection' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/src
creating build/temp.linux-x86_64-3.7/submodules
creating build/temp.linux-x86_64-3.7/submodules/libinjection
creating build/temp.linux-x86_64-3.7/submodules/libinjection/c
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isubmodules/libinjection/c -I/usr/include/python3.7m -c src/pylibinjection.c -o build/temp.linux-x86_64-3.7/src/pylibinjection.o
src/pylibinjection.c:8:10: fatal error: pyconfig.h: No such file or directory
8 | #include "pyconfig.h"
| ^~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-aeg_thjo/pylibinjection/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aeg_thjo/pylibinjection/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-omi97vjb/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/puneet/.local/include/python3.7m/pylibinjection Check the logs for full command output.
Is the library available for python 3.5+ or just 2.5-2.7?
While taking a look at setup.py and requirements.txt I realized that they are not correctly defined.
Cython should be used just for generating pylibinjection.c so the following lines
sourcefiles = [
'src/pylibinjection.pyx',
'submodules/libinjection/c/libinjection_sqli.c'
]
should be
sourcefiles = [
'src/pylibinjection.c',
'submodules/libinjection/c/libinjection_sqli.c'
]
and the user is not required to install Cython at all. Please take a look at pylibemu setup.py for an example. In such case I temporarly decomment the lines and set sourcefiles to the .pyx just for producing the .c file. That avoids the end user installing Cython. If needed I can produce a patch for it.
The token vector holds all the tokens with their values and locations. This should be quite valuable for analysis.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.