Add files via upload

This commit is contained in:
2022-03-07 20:20:06 +07:00
committed by GitHub
parent 7277f321c0
commit de200458d1
5 changed files with 122 additions and 0 deletions

32
boot_up.py Normal file
View File

@@ -0,0 +1,32 @@
from sys import exit
from re import match
from subprocess import Popen
# Список выражений по которым проводится проверка
# По дефолту стоит регион R54, индекс 630300
expr_list = [
[r"^[a-zA-Z]+\d+$", "R54-630300"], # THE01
[r"^\d+[a-zA-Z]+\d+$", "R54-"], # 630300THE01
[r"^[rR]\d*[-]\d+[a-zA-Z]+\d+$", ""] # R54-630300THE01
]
def main():
comp_name = input("\nВведите имя ПК (пр. R54-630300THE01, Ctrl+C для выхода):\n> ")
for r in expr_list:
if match(r[0], comp_name):
comp_name = "{}{}".format(r[1], comp_name)
break
if match(expr_list[2][0], comp_name):
subprocess.Popen("powershell -ExecutionPolicy Unrestricted -Command \"Get-CimInstance -ClassName win32_operatingsystem -ComputerName "+comp_name+" | select csname, lastbootuptime\"").wait()
else:
print("Имя компьютера не распознано! Попробуйте еще раз.")
main() # Рекурсия наше все!...
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
exit()

40
boot_up.spec Normal file
View File

@@ -0,0 +1,40 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['boot_up.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='boot_up',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=False,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None)

40
boot_up_upx.spec Normal file
View File

@@ -0,0 +1,40 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['boot_up.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='boot_up_upx',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None)

3
build.bat Normal file
View File

@@ -0,0 +1,3 @@
@echo off
pyinstaller boot_up.spec
pyinstaller boot_up_upx.spec --upx-dir=upx\

View File

@@ -0,0 +1,7 @@
write-host "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> (<28><>. R54-630300IT04):"
$pc_name = read-host
Get-CimInstance -ClassName win32_operatingsystem -ComputerName $pc_name | select csname, lastbootuptime
Pause