【发布时间】:2021-11-14 16:31:53
【问题描述】:
这是我的代码。我的主机名查找失败。
import random
import time
import os
sec = int(input(" input time to change Ip in Sec: "))
limit = int(input('how many time do you want to change your ip: '))
ip = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
# main fuction
for _ in range(1,5):
ip = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
time.sleep(6)
os.system('sudo ifconfig wlo1 down')
os.system('sudo ifconfig wlo1 ip')
os.system('sudo ifconfig wlo1 up')
print('Your Current IP Address is ',ip)
这显示了错误:
input time to change Ip in Sec: 2
how many time do you want to change your ip: 3
ip: Host name lookup failure
ifconfig: --help gives usage information.
Your Current IP Address is 212.49.83.22
ip: Host name lookup failure
ifconfig: --help gives usage information.
Your Current IP Address is 199.147.166.42
【问题讨论】:
标签: python linux system ip-address