ADD zls_check.py

This commit is contained in:
2023-10-25 10:05:39 +02:00
parent 4a0edfa446
commit 311e60461c
2 changed files with 54 additions and 38 deletions
+14 -2
View File
@@ -80,7 +80,7 @@ def get_winver():
def get_local_ip():
powershell_script = '''
(Get-NetIPAddress | Where-Object { $_.PrefixOrigin -eq "Dhcp" }).IPAddress
Get-NetIPAddress | Where-Object { $_.PrefixOrigin -eq "Dhcp" -and $_.InterfaceAlias -like "*Ethernet*" } | Select-Object -ExpandProperty IPAddress
'''
result = subprocess.check_output(["powershell.exe", "-command", powershell_script], universal_newlines=True)#
ip = result.rsplit('.',1)
@@ -97,4 +97,16 @@ def get_lastlogon(user):
result = subprocess.check_output(["powershell.exe", "-command", powershell_script], universal_newlines=True)
return result
print(get_cpu_brand())
def get_client_info():
powershell_script = f'''Get-WmiObject -Class Win32_OperatingSystem | Select-Object -ExpandProperty ProductType'''
result = subprocess.check_output(["powershell.exe", "-command", powershell_script], universal_newlines=True)
if result[0] == "1":
return "Client"
else:
return "Server"
def get_smb_credential():
powershell_script = f'''Get-SmbConnection | Select-Object -ExpandProperty Credential'''
result = subprocess.check_output(["powershell.exe", "-command", powershell_script], universal_newlines=True)
result.split("\\")
return result[1]