简体   繁体   English

我使用python-scapy时bottle + uwsgi + nginx出现错误

[英]bottle+uwsgi+nginx got an error when I use python-scapy

bootle debug said: 布特尔调试说:

Traceback (most recent call last):
    File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 764, in _handle
        return route.call(**args)
    File "/usr/local/lib/python2.7/dist-packages/bottle.py", line 1575, in wrapper
        rv = callback(*a, **ka)
    File "/home/tin/sg/main.py", line 30, in login
        user.login(sharer)
    File "/home/tin/sg/User.py", line 60, in login
        User.send_tcp(self.ip, sharer.id, sharer.password)
    File "/home/tin/sg/User.py", line 161, in send_tcp
        send(IP(src=ip, dst='destIP') / TCP(sport=sport, dport=80, seq=0, flags='S'))
    File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 251, in send
        __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
    File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 307, in __init__
        self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
    File "/usr/lib/python2.7/socket.py", line 187, in __init__
        _sock = _realsocket(family, type, proto)

error: [Errno 1] Operation not permitted

When I run the app in bottle builtin function run() , it works. 当我在瓶内置函数run()运行该应用程序时,它可以工作。 It only report this error when I use the send() from python-scapy. 在我使用python-scapy中的send()时报告此错误。 and I have aleady do chown www-data:www-data to all myapp files. 我有已位于做到chown www-data:www-data到所有的myapp文件。

How to fix my problem. 如何解决我的问题。

I find a resolution by myself. 我自己找到解决方案。 I modified the setting in the file uwsgi.ini 我修改了uwsgi.ini文件中的设置
add the execute permission 添加执行权限

[uwsgi]
uid = root
gid = root
chmod-socket = 777

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM