Socketio错误:@ sio.event AttributeError:“客户端”对象没有属性“事件”

问题描述

所以我正在编写针对ctf挑战的soem代码,基本上我正在使用socketio与虚假的内部网络进行通信,但是当我使用python3 bridge.pylocked_out.logicdata运行以下代码时,我得到了以下内容错误:Socketio错误:@ sio.event AttributeError:“客户端”对象没有属性“事件”。有谁知道为什么会这样吗?干杯!

#!/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() 

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)