Adam 2 年之前
父节点
当前提交
fdb9f174bf
共有 1 个文件被更改,包括 5 次插入16 次删除
  1. 5 16
      ifcfg.py

+ 5 - 16
ifcfg.py

@@ -1,20 +1,9 @@
-import dns.resolver
-import socket
-import ipaddress
 import subprocess
-ip_addr = socket.gethostbyname(socket.gethostname())
-netmask = ipaddress.IPv4Network(ip_addr).netmask
-
-
-
 
+n = 1
 config = subprocess.check_output(
     ['chcp', '65001', '&', 'netsh', 'interface', 'ipv4', 'show', 'config'], shell=True)
-check = config.decode('utf-8').split('Configuration for interface "Ethernet"')[1].split('\n')[9]
-print(check)
-
-
-
-dns_resolver = dns.resolver.Resolver()
-dns_resolver.nameservers[0]
-print("DNS - ", dns_resolver.nameservers)
+while n != 10:
+    check = config.decode('utf-8').split('Configuration for interface "Беспроводная сеть"')[1].split('\n')[n]
+    print(check)
+    n += 1