Websocket Socketio错误:@sio.event AttributeError:';客户';对象没有属性';事件';
因此,我正在为ctf挑战编写soem代码,基本上我使用socketio与一个假的内部网络通信,但是当我使用python3 bridge.py locked_out.logicaldata运行以下代码时,我得到以下错误:socketio error:@sio.event AttributeError:“Client”对象没有属性“event”。有人知道为什么会这样吗?干杯Websocket Socketio错误:@sio.event AttributeError:';客户';对象没有属性';事件';,websocket,socket.io,python-socketio,Websocket,Socket.io,Python Socketio,因此,我正在为ctf挑战编写soem代码,基本上我使用socketio与一个假的内部网络通信,但是当我使用python3 bridge.py locked_out.logicaldata运行以下代码时,我得到以下错误:socketio error:@sio.event AttributeError:“Client”对象没有属性“event”。有人知道为什么会这样吗?干杯 #!/usr/bin/python3 ''' Use this script to connect to the Cars
#!/usr/bin/python3
'''
Use this script to connect to the Cars network and send your packets.
A URL must be added bellow in order to connect.
You can either use it as a commandline tool and give the packet as an argument or
change the script to fit your needs
'''
import socketio
import time
import sys
# Insert here provided URL
URL = 'http://some_url_for_ctf_challenge'
# Init socket
sio = socketio.Client()
@sio.event
def connect():
print('[!] connection established')
@sio.event
def disconnect():
print('disconnected from server')
print("[!] Connecting to server..")
# Connect to the network
sio.connect(URL)
# Give the packet as an argument
packet = sys.argv[1]
# Do NOT remove - Use sleep to not flood the network
time.sleep(0.1)
print("[!] Sending packet")
# Send data into the network
sio.emit('endpoint', packet)
# close connection
sio.disconnect()
将
pip freeze
的输出添加到您的问题中,这样我就可以看到您安装了哪些软件包。事实上,当我将文件移到下载文件夹之外(我在MacOs上)时,这件事开始运行得非常好!就像它无法从下载文件夹中访问python模块一样。你知道为什么会这样吗?是的,你可能有一个socketio.py
文件在socketio
包后面。