* Added .gitignore
* Renamed 'boot_up.py' to 'main.py'
* Made some changes in 'main.py'
* Removed 'boot_up.spec'
* Renamed 'boot_up_upx.spec' to 'build.spec'

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2022-03-12 17:58:44 +07:00
parent b1502da5bc
commit a1c94849cc
5 changed files with 80 additions and 117 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
__pycache__
build
dist
upx

View File

@@ -1,40 +0,0 @@
# -*- 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)

View File

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

View File

@@ -1,40 +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)
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.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='Show computer boot up time',
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)

View File

@@ -1,35 +1,35 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
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()
#!/usr/bin/python3
# -*- coding: utf-8 -*-
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():
pc_name = input("\nВведите имя ПК (пр. R54-630300THE01, Ctrl+C для выхода):\n> ").strip()
for r in expr_list:
if match(r[0], pc_name):
pc_name = "".join([r[1], pc_name])
break
if match(expr_list[2][0], pc_name):
Popen("powershell -ExecutionPolicy Unrestricted -Command \"Get-CimInstance -ClassName win32_operatingsystem -ComputerName "+pc_name+" | select csname, lastbootuptime\"").wait()
else:
print("Имя компьютера не распознано! Попробуйте еще раз.")
main() # Рекурсия наше все!...
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
exit()