gr703_trale 2 years ago
parent
commit
3e69f0b345
1 changed files with 17 additions and 1 deletions
  1. 17 1
      ifcfg.py

+ 17 - 1
ifcfg.py

@@ -1,4 +1,20 @@
 import dns.resolver
+import socket
+import ipaddress
+import subprocess
+ip_addr = socket.gethostbyname(socket.gethostname())
+netmask = ipaddress.IPv4Network(ip_addr).netmask
+
+
+
+
+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_resolver.nameservers)
+print("DNS - ", dns_resolver.nameservers)