-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipConfig.py
More file actions
28 lines (25 loc) · 996 Bytes
/
ipConfig.py
File metadata and controls
28 lines (25 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import subprocess
def wlan_ip():
result=subprocess.run('ipconfig',stdout=subprocess.PIPE,text=True,encoding="latin-1").stdout.lower()
scan=0
for i in result.split('\n'):
if 'wireless lan adapter wi-fi:' in i: scan=4
if scan:
if 'ipv4' in i:
return i.split(':')[1].strip()
def ethernet_ip_for_teknofestKadir():
result=subprocess.run('ipconfig',stdout=subprocess.PIPE,text=True,encoding="latin-1").stdout.lower()
scan=0
for i in result.split('\n'):
if 'ethernet adapter ethernet:' in i: scan=4
if scan:
if 'ipv4' in i:
return i.split(':')[1].strip()
def ethernet_ip_for_teknofestOrhan():
result=subprocess.run('ipconfig',stdout=subprocess.PIPE,text=True,encoding="latin-1").stdout.lower()
scan=0
for i in result.split('\n'):
if 'ethernet adapter ethernet 2:' in i: scan=4
if scan:
if 'ipv4' in i:
return i.split(':')[1].strip()