私は ctf チャレンジ用の soem コードを書いています。基本的には socketio を使用して偽の内部ネットワークと通信していますが、python3 bridge.py locked_out.logicdata で次のコードを実行すると、次のエラーが発生します: Socketioエラー: @sio.event AttributeError: 'Client' オブジェクトに属性 'event' がありません。これがなぜなのか誰か知っていますか?乾杯!
#!/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()