0

so I'm writing soem code for a ctf challenge, and basically I'm using socketio to communicate with a fake internal network, but when I run the following code with python3 bridge.py locked_out.logicdata, I get the following error: Socketio error: @sio.event AttributeError: 'Client' object has no attribute 'event'. Does anyone know why this might be? Cheers!

#!/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() 
JustABeginner
  • 321
  • 1
  • 5
  • 14
  • 1
    Add the output of `pip freeze` to your question, so that I can see what packages you have installed. – Miguel Grinberg Nov 02 '20 at 10:36
  • actually, when I moved my files outside of the downloads folder (I'm on MacOs), the thing started working perfectly fine! It's like it couldn't access the python module from inside the downloads folder. Do you know why that might be? – JustABeginner Nov 03 '20 at 18:51
  • 1
    Yeah, you probably had a `socketio.py` file that was shadowing the `socketio` package. – Miguel Grinberg Nov 03 '20 at 19:29

0 Answers0