Use Python to identify the local IP and accessible IPs within the local network.
发布时间
阅读量:
阅读量
import socket
import subprocess
import re, os
#获取ip
class Get_ip():
def __init__(self):#初始化并调用
self.ip_dict = self.get_ipconfig_ip()
for i in self.ip_dict:#找出想要的ip地址 ,网线或无线ip
#if '无线' in i:
self.url = self.ip_dict[i]
print(self.ip_dict[i])
a = self.url.rfind('.')
self.url = self.url[:a + 1]
self.ip_list = self.find_ip(self.url)
def get_ipconfig_ip(self):#查找本机ip
match_ip_dict = {}
ipconfig_result_list = os.popen('ipcon
全部评论 (0)
还没有任何评论哟~
