GeezerVison is showing github.com — Improvements + important fix · KeyAuth/KeyAuth-Python-Example@781297d
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: keyauth.py +11-8Lines changed: 11 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -import win32security # get sid |
| 1 | +import os |
2 | 2 | import json as jsond # json |
3 | | - |
4 | 3 | import time # sleep before exit |
5 | | - |
6 | 4 | import binascii # hex encoding |
7 | | - |
8 | 5 | from uuid import uuid4 # gen random guid |
9 | 6 | import platform |
10 | | -import os |
11 | | -import requests # https requests |
12 | 7 |
|
13 | 8 | try: |
| 9 | + if os.name == 'nt': |
| 10 | + import win32security # get sid (WIN only) |
| 11 | + import requests # https requests |
14 | 12 | from Crypto.Cipher import AES |
15 | 13 | from Crypto.Hash import SHA256 |
16 | 14 | from Crypto.Util.Padding import pad, unpad |
17 | 15 | except ModuleNotFoundError: |
18 | 16 | print("Exception when importing modules") |
19 | | - print("installing necessary modules....") |
20 | | - os.system("pip install pycryptodome") |
| 17 | + print("Installing necessary modules....") |
| 18 | + if os.path.isfile("requirements.txt"): |
| 19 | + os.system("pip install -r requirements.txt") |
| 20 | + else: |
| 21 | + os.system("pip install pywin32") |
| 22 | + os.system("pip install pycryptodome") |
| 23 | + os.system("pip install requests") |
21 | 24 | print("Modules installed!") |
22 | 25 | time.sleep(1.5) |
23 | 26 | os._exit(1) |
|