Python_ Network programming udp-automatic attack on the flying autumn

Source: Internet
Author: User

# Simulate a Receive data
Import socket
Import time


def auto_hack (Udp_socket, Recv_msg, Revc_ip, revc_port=2425):
# Send data
While True:
Print ('-' * 65) # Test
# Udp_socket.sendto (Recv_msg.encode ("Utf-8"), (Revc_ip, Revc_port))
Udp_socket.sendto (' 1:123456:hades:hades:32:%s '% (recv_msg)). Encode (' Utf-8 '), (Revc_ip, Revc_port))
Time.sleep (5)

def main ():
"" "Initialize" "
# Create a UDP socket
Udp_socket = Socket.socket (socket.af_inet, socket. SOCK_DGRAM)

# Binding of ports
Udp_socket.bind (("", 8989))
While True:
# Waiting for data to be received
Recv_data = Udp_socket.recvfrom (1024)

# Messages Received
Recv_msg = Recv_data[0].decode ("Utf-8")
If recv_msg! = None:
Print (Recv_data)
Break

Revc_ip_port = recv_data[1]

# Data splitting of IP and ports
Print (1111)
REVC_IP = revc_ip_port[0]
revc_port = Int (revc_ip_port[1])

Auto_hack (Udp_socket, recv_msg, REVC_IP)
# Auto_hack (Udp_socket)


if __name__ = = ' __main__ ':
Main ()

Python_ Network programming udp-automatic attack on the flying autumn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.