Advertisement
H_11_IFF

Simulation of a server to be attacked

Dec 7th, 2023
2,225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | Cybersecurity | 0 0
  1. import socket
  2.  
  3. def main():
  4.     # Crea un socket UDP
  5.     sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  6.  
  7.     # Assegna un indirizzo e una porta al socket
  8.     host = "0.0.0.0"
  9.     port = 8080
  10.     sock.bind((host, port))
  11.  
  12.     # Attende richieste
  13.     while True:
  14.         data, address = sock.recvfrom(1024)
  15.  
  16.         # Stampa la richiesta
  17.         print("Received from", address, ":", data)
  18.  
  19. if __name__ == "__main__":
  20.     main()
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement