forked from shaba/openuds
Fixed path fixing :)
This commit is contained in:
parent
b9c55437ad
commit
9cdab65845
@ -263,6 +263,7 @@ def sslError(hostname: str, serial):
|
||||
settings.endGroup()
|
||||
return approved
|
||||
|
||||
|
||||
# Used only if command line says so
|
||||
def minimal(api: RestApi, ticket: str, scrambler: str):
|
||||
try:
|
||||
@ -300,8 +301,7 @@ def minimal(api: RestApi, ticket: str, scrambler: str):
|
||||
QtWidgets.QMessageBox.critical(
|
||||
None, # type: ignore
|
||||
'Error',
|
||||
'{}'.format(str(e))
|
||||
+ '\n\nPlease, retry again in a while.',
|
||||
'{}'.format(str(e)) + '\n\nPlease, retry again in a while.',
|
||||
QtWidgets.QMessageBox.Ok,
|
||||
)
|
||||
return 0
|
||||
@ -322,7 +322,7 @@ if __name__ == "__main__":
|
||||
app.setStyle('plastique') # type: ignore
|
||||
else:
|
||||
logger.debug('Platform is Mac OS, adding homebrew possible paths')
|
||||
os.environ['PATH'] += os.pathsep.join(['/opt/homebrew/bin'])
|
||||
os.environ['PATH'] += ''.join(os.pathsep + i for i in ('/opt/homebrew/bin',))
|
||||
logger.debug('Now path is %s', os.environ['PATH'])
|
||||
|
||||
# First parameter must be url
|
||||
|
@ -44,7 +44,7 @@ from .log import logger
|
||||
|
||||
_unlinkFiles: typing.List[str] = []
|
||||
_tasksToWait: typing.List[typing.Any] = []
|
||||
_execBeforeExit: typing.List[typing.Callable[[],None]] = []
|
||||
_execBeforeExit: typing.List[typing.Callable[[], None]] = []
|
||||
|
||||
sys_fs_enc = sys.getfilesystemencoding() or 'mbcs'
|
||||
|
||||
@ -65,9 +65,11 @@ nVgtClKcDDlSaBsO875WDR0CAwEAAQ==
|
||||
-----END PUBLIC KEY-----'''
|
||||
|
||||
|
||||
def saveTempFile(content: str, filename: typing.Optional[str]=None) -> str:
|
||||
def saveTempFile(content: str, filename: typing.Optional[str] = None) -> str:
|
||||
if filename is None:
|
||||
filename = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(16))
|
||||
filename = ''.join(
|
||||
random.choice(string.ascii_lowercase + string.digits) for _ in range(16)
|
||||
)
|
||||
filename = filename + '.uds'
|
||||
|
||||
filename = os.path.join(tempfile.gettempdir(), filename)
|
||||
@ -88,7 +90,7 @@ def readTempFile(filename: str) -> typing.Optional[str]:
|
||||
return None
|
||||
|
||||
|
||||
def testServer(host: str, port: typing.Union[str, int], timeOut: int=4) -> bool:
|
||||
def testServer(host: str, port: typing.Union[str, int], timeOut: int = 4) -> bool:
|
||||
try:
|
||||
sock = socket.create_connection((host, int(port)), timeOut)
|
||||
sock.close()
|
||||
@ -97,7 +99,9 @@ def testServer(host: str, port: typing.Union[str, int], timeOut: int=4) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def findApp(appName: str, extraPath:typing.Optional[str] = None) -> typing.Optional[str]:
|
||||
def findApp(
|
||||
appName: str, extraPath: typing.Optional[str] = None
|
||||
) -> typing.Optional[str]:
|
||||
searchPath = os.environ['PATH'].split(os.pathsep)
|
||||
if extraPath:
|
||||
searchPath += list(extraPath)
|
||||
@ -118,6 +122,7 @@ def getHostName() -> str:
|
||||
logger.info('Hostname: %s', hostname)
|
||||
return hostname
|
||||
|
||||
|
||||
# Queing operations (to be executed before exit)
|
||||
|
||||
|
||||
@ -179,14 +184,13 @@ def verifySignature(script: bytes, signature: bytes) -> bool:
|
||||
from cryptography.hazmat.primitives import serialization, hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import utils, padding
|
||||
|
||||
public_key = serialization.load_pem_public_key(data=PUBLIC_KEY, backend=default_backend())
|
||||
public_key = serialization.load_pem_public_key(
|
||||
data=PUBLIC_KEY, backend=default_backend()
|
||||
)
|
||||
|
||||
try:
|
||||
public_key.verify(
|
||||
base64.b64decode(signature),
|
||||
script,
|
||||
padding.PKCS1v15(),
|
||||
hashes.SHA256()
|
||||
base64.b64decode(signature), script, padding.PKCS1v15(), hashes.SHA256()
|
||||
)
|
||||
except Exception: # InvalidSignature
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user