libnjection + python3(swig):NameError

时间:2016-07-18 22:10:49

标签: python swig python-3.5

我正在尝试将libinjection与python3.5一起使用。该库使用SWIG进行python绑定。 setup.py有下一个模块选项:

MODULE = Extension(
'_libinjection', [
    'libinjection/libinjection_wrap.c',
    'libinjection/libinjection_sqli.c',
    'libinjection/libinjection_html5.c',
    'libinjection/libinjection_xss.c'
],
swig_opts=['-Wextra', '-builtin'],
define_macros = [],
include_dirs = [],
libraries = [],
library_dirs = [],
)

我安装了模块,

# pip3 show libinjection                
---                                                                                          
Metadata-Version: 1.1                                                                        
Name: libinjection                                                                           
Version: 3.9.1                                                                               
Summary: Wrapper around libinjection c-code to detect sqli                                   
Home-page: https://libinjection.client9.com/                                                 
Author: Nick Galbreath                                                                       
Author-email: nickg@client9.com                                                              
License: UNKNOWN                                                                             
Location: /usr/local/lib/python3.5/dist-packages/libinjection-3.9.1-py3.5-linux-x86_64.egg   
Requires:                                                                                    
Classifiers:                                                                                 
  Intended Audience :: Developers                                                            
  License :: OSI Approved :: BSD License                                                     
  Topic :: Database                                                                          
  Topic :: Security                                                                          
  Operating System :: OS Independent                                                         
  Development Status :: 3 - Alpha                                                            
  Topic :: Internet :: Log Analysis                                                          
  Topic :: Internet :: WWW/HTTP  

但我不能使用任何功能。

Python 3.5.1+ (default, Mar 30 2016, 22:46:26)
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from libinjection import *
>>> sqli_state()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'sqli_state' is not defined

我尝试向SWIG添加-py3-python个选项,但没有任何结果。 Python2.7模块可以很好地使用相同的函数。

如果有人帮助我,真的很棒。谢谢!

0 个答案:

没有答案