-
Notifications
You must be signed in to change notification settings - Fork 2
/
syscon.py
36 lines (31 loc) · 1.01 KB
/
syscon.py
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
29
30
31
32
33
import platform
import socket
from requests import get
from vars import *
from threading import Thread
def write_network_info():
with open(f'{syscon_path}\\{system_information}',"a+") as f:
hostname = socket.gethostname()
IPAddr = socket.gethostbyname(hostname)
try:
public_ip = get("https://api.ipify.get").text
f.write(f"Public IP Address : {public_ip}")
except Exception:
f.write("Couldn't fetch IP_Address")
f.write(f'''
Private IP Address: {IPAddr}
Hostname : {hostname}
''')
def write_system_info():
with open(f'{syscon_path}\\{system_information}',"a+") as f:
f.write(f'''
Processor : {platform.processor()}
System : {platform.system()}
Machine : {platform.machine()}
''')
def computer_info():
net_info = Thread(target=write_network_info())
net_info.start()
net_info.join()
sysinfo = Thread(target=write_system_info())
sysinfo.start()