-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
81 lines (61 loc) · 2 KB
/
test.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import platform
import socket
import subprocess
import shutil
import psutil
hvaErOS=platform.architecture()
hvaEr=platform.node()
hvaErPc=platform.release()
hvaErPcVersjon=platform.version()
hvaErMaskin=platform.machine()
hvaErprosesor=platform.processor()
print(hvaErOS)
print(hvaEr)
print(hvaErPc)
print(hvaErPcVersjon)
print(hvaErMaskin)
print(hvaErprosesor)
print("----------------------------------------------")
#lagring plass på pc-en din
def lagring():
total = int()
used = int()
free = int()
for disk in psutil.disk_partitions():
if disk.fstype:
total += int(psutil.disk_usage(disk.mountpoint).total)
used += int(psutil.disk_usage(disk.mountpoint).used)
free += int(psutil.disk_usage(disk.mountpoint).free)
print(f"Du hadde : {round(total / (1024.0 ** 3), 4)} Giga")
print(f"Hvor mye du har used : {round(used / (1024.0 ** 3), 4)} Giga")
print(f"hvor mye du har igjen : {round(free / (1024.0 **3),4)} Giga")
#Ip address
def ip_address():
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname)
print("pc-navnet er :" + hostname)
print("Ip address er : " + ip)
#programmer du har
def program():
Data = subprocess.check_output(['wmic', 'product', 'get', 'name'])
a = str(Data)
try:
for i in range(len(a)):
print("Du har: ", (a.split("\\r\\r\\n")[6:][i]))
except IndexError as e:
print("Ferdig se opp")
lagring()
ip_address()
program()
import json
import exec.fullog as e
inp = e.getdata() #inp now is a dict() which has items, keys and values.
#Query
print('Data collected on:', inp['header']['timestamp'].date())
print('\n CLASS 1 INFO\n')
for item in inp['Demographics']:
if item['name'] in ['Carly', 'Jane']:
print(item['name'], 'Height:', item['ht'], 'Age:', item['years'])
for item in inp['Activity']:
if item['name'] in ['Cycle', 'Run', 'Swim']:
print(item['name'], 'Athlete:', item['athl_name'], 'Age:', item['years'])