0

我正在尝试在 BACKTRACK 5 R1 虚拟机上安装pylorcon-1(用于编写无线数据包嗅探器的 Lorcon 的 Python 包装器)...我从 [Pylorcon 官方页面] [1] 下载的包有 3 个文件 pylorcon .c 、 setup.py 和 tx.py .. 所以正如 README 文件中给出的那样,我尝试执行命令...

python setup.py build

执行上述命令后,我得到以下输出:

running build 
running build_ext
building 'pylorcon' extension 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pylorcon.c -o build/temp.linux-i686-2.6/pylorcon.o 
pylorcon.c:8:20: error: Python.h: No such file or directory
pylorcon.c:9:26: error: structmember.h: No such file or directory
pylorcon.c:10:21: error: tx80211.h: No such file or directory
pylorcon.c:11:28: error: tx80211_packet.h: No such file or directory
pylorcon.c:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:118: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
pylorcon.c: In function ‘Lorcon_dealloc’:
pylorcon.c:128: warning: implicit declaration of function ‘tx80211_getmode’
pylorcon.c:128: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:129: warning: implicit declaration of function ‘tx80211_close’
pylorcon.c:129: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:131: error: ‘Lorcon’ has no member named ‘ob_type’
pylorcon.c:131: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:131: error: (Each undeclared identifier is reported only once
pylorcon.c:131: error: for each function it appears in.)
pylorcon.c:131: error: expected expression before ‘)’ token
pylorcon.c: At top level:
pylorcon.c:136: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:151: error: expected declaration specifiers or ‘...’ before ‘PyObject’
pylorcon.c:151: error: expected declaration specifiers or ‘...’ before ‘PyObject’
pylorcon.c: In function ‘Lorcon_init’:
pylorcon.c:152: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:152: error: ‘iface’ undeclared (first use in this function)
pylorcon.c:152: error: ‘driver’ undeclared (first use in this function)
pylorcon.c:152: warning: left-hand operand of comma expression has no effect
pylorcon.c:153: error: ‘NULL’ undeclared (first use in this function)
pylorcon.c:155: warning: implicit declaration of function ‘PyArg_ParseTupleAndKeywords’
pylorcon.c:155: error: ‘args’ undeclared (first use in this function)
pylorcon.c:155: error: ‘kwds’ undeclared (first use in this function)
pylorcon.c:161: warning: implicit declaration of function ‘Py_INCREF’
pylorcon.c:162: error: ‘Lorcon’ has no member named ‘iface’
pylorcon.c:162: warning: statement with no effect
pylorcon.c:164: error: ‘Lorcon’ has no member named ‘driver’
pylorcon.c:164: warning: statement with no effect
pylorcon.c:166: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:166: warning: implicit declaration of function ‘tx80211_resolvecard’
pylorcon.c:166: warning: implicit declaration of function ‘PyString_AsString’
pylorcon.c:166: error: ‘Lorcon’ has no member named ‘driver’
pylorcon.c:166: warning: statement with no effect
pylorcon.c:168: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:168: error: ‘INJ_NODRIVER’ undeclared (first use in this function)
pylorcon.c:169: warning: implicit declaration of function ‘PyErr_SetString’
pylorcon.c:169: error: ‘LorconError’ undeclared (first use in this function)
pylorcon.c:173: warning: implicit declaration of function ‘tx80211_init’
pylorcon.c:173: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:173: error: ‘Lorcon’ has no member named ‘iface’
pylorcon.c:174: error: ‘Lorcon’ has no member named ‘drivertype’
pylorcon.c:175: warning: implicit declaration of function ‘tx80211_geterrstr’
pylorcon.c:175: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:179: warning: implicit declaration of function ‘tx80211_open’
pylorcon.c:179: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:180: error: ‘Lorcon’ has no member named ‘in_tx’
pylorcon.c:183: warning: implicit declaration of function ‘tx80211_initpacket’
pylorcon.c:183: error: ‘Lorcon’ has no member named ‘in_packet’
pylorcon.c: At top level:
pylorcon.c:191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:196: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:201: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:238: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:269: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:297: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:310: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:327: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:372: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:422: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:455: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:496: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:502: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
pylorcon.c:523: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Lorcon_members’
pylorcon.c:527: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘Lorcon_methods’
pylorcon.c:562: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘LorconType’
pylorcon.c:604: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pylorcon_methods’
pylorcon.c: In function ‘initpylorcon’:
pylorcon.c:617: error: ‘PyObject’ undeclared (first use in this function)
pylorcon.c:617: error: ‘m’ undeclared (first use in this function)
pylorcon.c:617: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
pylorcon.c:617: warning: statement with no effect
pylorcon.c:619: warning: implicit declaration of function ‘PyType_Ready’
pylorcon.c:619: error: ‘LorconType’ undeclared (first use in this function)
pylorcon.c:622: warning: implicit declaration of function ‘Py_InitModule3’
pylorcon.c:622: error: ‘pylorcon_methods’ undeclared (first use in this function)
pylorcon.c:623: warning: statement with no effect
pylorcon.c:625: error: ‘NULL’ undeclared (first use in this function)
pylorcon.c:628: error: ‘LorconError’ undeclared (first use in this function)
pylorcon.c:628: warning: implicit declaration of function ‘PyErr_NewException’
pylorcon.c:628: warning: statement with no effect
pylorcon.c:630: warning: implicit declaration of function ‘PyModule_AddObject’
pylorcon.c:633: error: expected expression before ‘)’ token
pylorcon.c:633: error: invalid operands to binary * (have ‘char **’ and ‘char **’)
error: command 'gcc' failed with exit status 1

我怎样才能解决这个问题?

@Ric ...我执行了您告诉我的命令 sudo apt-get install python-dev然后再次执行命令python setup.py build我得到以下输出:

运行 build
运行 build_ext
构建 'pylorcon' 扩展
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -c pylorcon.c - o build/temp.linux-i686-2.6/pylorcon.o pylorcon.c:10:21: 错误: tx80211.h: 没有这样的文件或目录
pylorcon.c:11:28: 错误: tx80211_packet.h: 没有这样的文件或目录
pylorcon.c:在函数“capToList”中:
pylorcon.c:20:错误:“TX80211_CAP_SNIFF”未声明(在此函数中首次使用)

pylorcon.c:20:错误:(每个未声明的标识符仅报告一次
pylorcon.c :20: 错误: 对于它出现的每个函数。)
pylorcon.c:23: 错误: 'TX80211_CAP_TRANSMIT' 未声明(在此函数中首次使用)

pylorcon.c:26:错误:未声明“TX80211_CAP_SEQ”(在此函数中首次使用)
pylorcon.c:29:错误:未声明“TX80211_CAP_BSSTIME”(在此函数中首次使用)
pylorcon.c:32:错误:未声明“TX80211_CAP_FRAG” (在此函数中首次使用)
pylorcon.c:35:错误:'TX80211_CAP_CTRL'未声明(在此函数中首次使用)
pylorcon.c:38:错误:'TX80211_CAP_DURID'未声明(在此函数中首次使用)
pylorcon.c:41 : 错误:'TX80211_CAP_SNIFFACK' 未声明(首次在此函数中使用)
pylorcon.c:44:错误:'TX80211_CAP_SELFACK' 未声明(首次在此函数中使用)
pylorcon.c:47:错误:'TX80211_CAP_TXNOWAIT' 未声明(首次在此使用功能)
pylorcon.c:50: 错误: 'TX80211_CAP_DSSSTX' 未声明(在此函数中首次使用)
pylorcon.c:53: 错误: 'TX80211_CAP_OFDMTX' 未声明(在此函数中首次使用
) (在此函数中首次使用)
pylorcon.c:59:错误:未声明“TX80211_CAP_SETRATE”(在此函数中首次使用)
pylorcon.c:62:错误:未声明“TX80211_CAP_SETMODULATION”(在此函数中首次使用)
pylorcon.c:65 : 错误 : 'TX80211_CAP_NONE' 未声明(在此函数中首次使用

':
pylorcon.c:86:警告:函数“tx80211_getcardlist”的隐式声明<br> pylorcon.c:86:警告:赋值使指针从整数而不进行
强制转换 pylorcon.c:91:错误:取消引用指向不完整类型
pylorcon.c的指针:96:错误:取消引用指向不完整类型
pylorcon.c:103的指针:错误:取消引用指向不完整类型
pylorcon.c:105的指针:错误:取消引用指向不完整类型
pylorcon.c:111的指针:警告:函数'tx80211_freecardlist的隐式声明'<br> pylorcon.c:在顶层:
pylorcon.c:119:错误:字段“in_tx”的类型不完整
pylorcon.c:120:错误:字段“in_packet”的类型不完整
pylorcon.c:在函数“Lorcon_dealloc”中':
pylorcon.c:128:警告:函数“tx80211_getmode”的隐式声明<br> pylorcon.c:129:警告:函数“tx80211_close”的隐式声明<br> pylorcon.c:在函数“Lorcon_new”中:
pylorcon.c: 142:错误:未声明“INJ_NODRIVER”(在此函数中首次使用)
pylorcon.c:在函数“Lorcon_init”中:
pylorcon.c:166:警告:函数“tx80211_resolvecard”的隐式声明<br> pylorcon.c:168:错误: 'INJ_NODRIVER' 未声明(在此函数中首次使用)
pylorcon.c:173:警告:函数“tx80211_init”的隐式声明<br> pylorcon.c:175:警告:函数“tx80211_geterrstr”的隐式声明<br> pylorcon.c:179:警告:函数“tx80211_open”的隐式声明'<br> pylorcon.c:183:警告:函数“tx80211_initpacket”的隐式声明<br> pylorcon.c:在函数“Lorcon_getmode”中:
pylorcon.c:210:错误:未声明“TX80211_MODE_AUTO”(首次在此函数中使用)
pylorcon.c:213: error: 'TX80211_MODE_ADHOC' undeclared (first use in this function)
pylorcon.c:216: error: 'TX80211_MODE_INFRA' undeclared (first use in this function)
pylorcon.c:219: error: 'TX80211_MODE_MASTER'未声明(在此函数中首次使用)
pylorcon.c:222: 错误: 'TX80211_MODE_REPEAT' 未声明(在此函数中首次使用)
pylorcon.c:225: 错误: 'TX80211_MODE_SECOND' 未声明(在此函数中首次使用
) (在此函数中首次使用)
pylorcon.c:在函数'Lorcon_setmode'中:
pylorcon.c:247:错误:'TX80211_MODE_AUTO'未声明(在此函数中首次使用)
pylorcon.c:249:错误:'TX80211_MODE_ADHOC'未声明(第一次在此函数中使用)
pylorcon.c:251:错误:未声明“TX80211_MODE_INFRA”(在此函数中首次使用)
pylorcon.c:253:错误:未声明“TX80211_MODE_MASTER”(在此函数中首次使用)
pylorcon.c:255:错误: 'TX80211_MODE_REPEAT' 未声明(在此函数中首次使用)
pylorcon.c:257:错误:未声明“TX80211_MODE_SECOND”(首次在此函数中使用) pylorcon.c
:259:错误:未声明“TX80211_MODE_MONITOR”(首次在此函数中使用 ) c:278: error: 'TX80211_FUNCMODE_RFMON' undeclared (first use in this function) pylorcon.c:280: error: 'TX80211_FUNCMODE_INJECT' undeclared (first use in this function) pylorcon.c:282: error: 'TX80211_FUNCMODE_INJMON' undeclared (first use在此函数中使用) pylorcon.c:287:警告:函数“tx80211_setfunctionalmode”的隐式声明<br> pylorcon.c:在函数“Lorcon_getchannel”中:





pylorcon.c:300:警告:函数“tx80211_getchannel”的隐式声明<br> pylorcon.c:在函数“Lorcon_setchannel”中:
pylorcon.c:317:警告:函数“tx80211_setchannel”的隐式声明<br> pylorcon.c:在函数“Lorcon_gettxrate”中:
pylorcon.c:329:警告:函数“tx80211_gettxrate”的隐式声明<br> pylorcon.c:332:错误:未声明“TX80211_RATE_DEFAULT”(在此函数中首次使用)
pylorcon.c:335:错误: 'TX80211_RATE_1MB' 未声明(首次在此函数中使用)
pylorcon.c:338: 错误:'TX80211_RATE_2MB' 未声明(首次在此函数中使用)
pylorcon.c:341: 错误:'TX80211_RATE_5_5MB' 未声明(首次在此函数中使用)
pylorcon.c:344:错误:'TX80211_RATE_6MB' 未声明(在此函数中首次使用)
pylorcon.c:347:错误:未声明“TX80211_RATE_9MB”(在此函数中首次使用)
pylorcon.c:350:错误:未声明“TX80211_RATE_11MB”(在此函数中首次使用)
pylorcon.c:353:错误:未声明“TX80211_RATE_24MB” (在此函数中首次使用)
pylorcon.c:356:错误:未声明“TX80211_RATE_36MB”(在此函数中首次使用)
pylorcon.c:359:错误:未声明“TX80211_RATE_48MB”(在此函数中首次使用)
pylorcon.c:362 : 错误 : 'TX80211_RATE_108MB' 未声明(在此函数中首次使用

'TX80211_CAP_SETRATE' 未声明(在此函数中首次使用)
pylorcon.c:386: 错误: 'TX80211_RATE_DEFAULT' 未声明(首次在此函数中使用)
pylorcon.c:388: 错误: 'TX80211_RATE_1MB' 未声明(首次在此函数中使用)
pylorcon.c:390: 错误: 'TX80211_RATE_2MB' 未声明(在此函数中首次使用)
pylorcon.c:392:错误:未声明“TX80211_RATE_5_5MB”(在此函数中首次使用)
pylorcon.c:394:错误:未声明“TX80211_RATE_6MB”(在此函数中首次使用)
pylorcon.c:396 : error: 'TX80211_RATE_9MB' undeclared (first use in this function)
pylorcon.c:398: error: 'TX80211_RATE_11MB' undeclared (first use in this function)
pylorcon.c:400: error: 'TX80211_RATE_24MB' undeclared (first use in this function)功能)
pylorcon.c:402:错误:未声明“TX80211_RATE_36MB”(在此函数 中
首次使用)
(在此函数中首次使用)
pylorcon.c:412:警告:函数“tx80211_settxrate”的隐式声明<br> pylorcon.c:在函数“Lorcon_getmodulation”中:
pylorcon.c:425:警告:函数“tx80211_getmodulation”的隐式声明<br> pylorcon.c:427: error: 'TX80211_MOD_DEFAULT' undeclared (first use in this function)
pylorcon.c:430: error: 'TX80211_MOD_FHSS' undeclared (first use in this function)
pylorcon.c:433: error: ' TX80211_MOD_DSSS' 未声明(本函数首次使用)
pylorcon.c:436:错误:未声明“TX80211_MOD_OFDM”(在此函数 中
首次使用)
(在此函数中首次使用)
pylorcon.c:445:错误:未声明“TX80211_MOD_MIMOGF”(在此函数中首次使用)
pylorcon.c:在函数“Lorcon_setmodulation”中:
pylorcon.c:459:错误:未声明“TX80211_CAP_SETMODULATION”(首先在此函数中使用)
pylorcon.c:469:错误:未声明“TX80211_MOD_DEFAULT”(在此函数中首次使用)
pylorcon.c:471:错误:未声明“TX80211_MOD_FHSS”(在此函数中首次使用)
pylorcon.c:473:错误: 'TX80211_MOD_DSSS' 未声明(在此函数中首次使用)
pylorcon.c:475:错误:未声明“TX80211_MOD_OFDM”(在此函数 中
首次使用)
(在此函数中首次使用)
pylorcon.c:481:错误:未声明“TX80211_MOD_MIMOGF”(在此函数中首次使用)
pylorcon.c:487:警告:函数“tx80211_setmodulation”的隐式声明<br> pylorcon.c:在函数中“Lorcon_txpacket”:
pylorcon.c:514:警告:函数“tx80211_txpacket”的隐式声明<br>错误:命令“gcc”失败并退出状态

4

1 回答 1

3

您需要为您的操作系统安装所需的开发头文件。

来自Building pylorcon2 页面

$ sudo apt-get install libpcap-dev libnl-dev python-dev

如果您仍然遇到问题,请按照其余说明进行操作。

于 2013-02-24T04:46:08.377 回答