From 0a0b60d6fbc38e84374dfcdc84d1c854e03beb12 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Wed, 31 Jul 2024 17:35:24 +0530 Subject: [PATCH 1/3] feat: add status codes --- .../lexfloatclient/lexfloatstatus_codes.py | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/cryptlex/lexfloatclient/lexfloatstatus_codes.py b/cryptlex/lexfloatclient/lexfloatstatus_codes.py index d8bacad..067f3e7 100644 --- a/cryptlex/lexfloatclient/lexfloatstatus_codes.py +++ b/cryptlex/lexfloatclient/lexfloatstatus_codes.py @@ -1,59 +1,75 @@ class LexFloatStatusCodes: - LF_OK = 0 + LF_OK: 0 - LF_FAIL = 1 + LF_FAIL: 1 - LF_E_PRODUCT_ID = 40 + LF_E_PRODUCT_ID: 40 - LF_E_CALLBACK = 41 + LF_E_CALLBACK: 41 - LF_E_HOST_URL = 42 + LF_E_HOST_URL: 42 - LF_E_TIME = 43 + LF_E_TIME: 43 - LF_E_INET = 44 + LF_E_INET: 44 - LF_E_NO_LICENSE = 45 + LF_E_NO_LICENSE: 45 - LF_E_LICENSE_EXISTS = 46 + LF_E_LICENSE_EXISTS: 46 - LF_E_LICENSE_NOT_FOUND = 47 + LF_E_LICENSE_NOT_FOUND: 47 - LF_E_LICENSE_EXPIRED_INET = 48 + LF_E_LICENSE_EXPIRED_INET: 48 - LF_E_LICENSE_LIMIT_REACHED = 49 + LF_E_LICENSE_LIMIT_REACHED: 49 - LF_E_BUFFER_SIZE = 50 + LF_E_BUFFER_SIZE: 50 - LF_E_METADATA_KEY_NOT_FOUND = 51 + LF_E_METADATA_KEY_NOT_FOUND: 51 - LF_E_METADATA_KEY_LENGTH = 52 + LF_E_METADATA_KEY_LENGTH: 52 - LF_E_METADATA_VALUE_LENGTH = 53 + LF_E_METADATA_VALUE_LENGTH: 53 - LF_E_FLOATING_CLIENT_METADATA_LIMIT = 54 + LF_E_FLOATING_CLIENT_METADATA_LIMIT: 54 - LF_E_METER_ATTRIBUTE_NOT_FOUND = 55 + LF_E_METER_ATTRIBUTE_NOT_FOUND: 55 - LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56 + LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: 56 - LF_E_PRODUCT_VERSION_NOT_LINKED = 57 + LF_E_PRODUCT_VERSION_NOT_LINKED: 57 - LF_E_FEATURE_FLAG_NOT_FOUND = 58 + LF_E_FEATURE_FLAG_NOT_FOUND: 58 - LF_E_IP = 60 + LF_E_SYSTEM_PERMISSION: 59 - LF_E_CLIENT = 70 + LF_E_IP: 60 - LF_E_SERVER = 71 + LF_E_INVALID_PERMISSION_FLAG: 61 - LF_E_SERVER_TIME_MODIFIED = 72 + LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: 62 - LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73 + LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: 63 - LF_E_SERVER_LICENSE_EXPIRED = 74 + LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: 64 - LF_E_SERVER_LICENSE_SUSPENDED = 75 + LF_E_WMIC: 65 - LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76 + LF_E_MACHINE_FINGERPRINT: 66 + + LF_E_PROXY_NOT_TRUSTED: 67 + + LF_E_CLIENT: 70 + + LF_E_SERVER: 71 + + LF_E_SERVER_TIME_MODIFIED: 72 + + LF_E_SERVER_LICENSE_NOT_ACTIVATED: 73 + + LF_E_SERVER_LICENSE_EXPIRED: 74 + + LF_E_SERVER_LICENSE_SUSPENDED: 75 + + LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: 76 \ No newline at end of file From fd79356819c92c3d8174b41a7c82ece6280b5dfc Mon Sep 17 00:00:00 2001 From: muneebkq Date: Fri, 2 Aug 2024 12:44:13 +0530 Subject: [PATCH 2/3] refacor: status code --- .../lexfloatclient_exception.py | 14 +++ .../lexfloatclient/lexfloatstatus_codes.py | 90 +++++++++---------- 2 files changed, 58 insertions(+), 46 deletions(-) diff --git a/cryptlex/lexfloatclient/lexfloatclient_exception.py b/cryptlex/lexfloatclient/lexfloatclient_exception.py index 391efca..f6207d4 100644 --- a/cryptlex/lexfloatclient/lexfloatclient_exception.py +++ b/cryptlex/lexfloatclient/lexfloatclient_exception.py @@ -64,4 +64,18 @@ def get_error_message(code): return 'The server license has been suspended.' if code == LexFloatStatusCodes.LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: return 'The grace period for server license is over.' + if code == LexFloatStatusCodes.LF_E_SYSTEM_PERMISSION: + return 'Insufficient system permissions.' + if code == LexFloatStatusCodes.LF_E_INVALID_PERMISSION_FLAG: + return 'Invalid permission flag.' + if code == LexFloatStatusCodes.LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: + return 'Offline floating license is not allowed for per-instance leasing strategy.' + if code == LexFloatStatusCodes.LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: + return 'Maximum offline lease duration exceeded.' + if code == LexFloatStatusCodes.LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: + return 'Allowed offline floating clients limit reached.' + if code == LexFloatStatusCodes.LF_E_WMIC: + return "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only." + if code == LexFloatStatusCodes.LF_E_MACHINE_FINGERPRINT: + return 'Machine fingerprint has changed since activation.' return 'Unknown error!' diff --git a/cryptlex/lexfloatclient/lexfloatstatus_codes.py b/cryptlex/lexfloatclient/lexfloatstatus_codes.py index 067f3e7..f87384c 100644 --- a/cryptlex/lexfloatclient/lexfloatstatus_codes.py +++ b/cryptlex/lexfloatclient/lexfloatstatus_codes.py @@ -1,75 +1,73 @@ class LexFloatStatusCodes: - LF_OK: 0 + LF_OK = 0 - LF_FAIL: 1 + LF_FAIL = 1 - LF_E_PRODUCT_ID: 40 + LF_E_PRODUCT_ID = 40 - LF_E_CALLBACK: 41 + LF_E_CALLBACK = 41 - LF_E_HOST_URL: 42 + LF_E_HOST_URL = 42 - LF_E_TIME: 43 + LF_E_TIME = 43 - LF_E_INET: 44 + LF_E_INET = 44 - LF_E_NO_LICENSE: 45 + LF_E_NO_LICENSE = 45 - LF_E_LICENSE_EXISTS: 46 + LF_E_LICENSE_EXISTS = 46 - LF_E_LICENSE_NOT_FOUND: 47 + LF_E_LICENSE_NOT_FOUND = 47 - LF_E_LICENSE_EXPIRED_INET: 48 + LF_E_LICENSE_EXPIRED_INET = 48 - LF_E_LICENSE_LIMIT_REACHED: 49 + LF_E_LICENSE_LIMIT_REACHED = 49 - LF_E_BUFFER_SIZE: 50 + LF_E_BUFFER_SIZE = 50 - LF_E_METADATA_KEY_NOT_FOUND: 51 + LF_E_METADATA_KEY_NOT_FOUND = 51 - LF_E_METADATA_KEY_LENGTH: 52 + LF_E_METADATA_KEY_LENGTH = 52 - LF_E_METADATA_VALUE_LENGTH: 53 + LF_E_METADATA_VALUE_LENGTH = 53 - LF_E_FLOATING_CLIENT_METADATA_LIMIT: 54 + LF_E_FLOATING_CLIENT_METADATA_LIMIT = 54 - LF_E_METER_ATTRIBUTE_NOT_FOUND: 55 + LF_E_METER_ATTRIBUTE_NOT_FOUND = 55 - LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: 56 + LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56 - LF_E_PRODUCT_VERSION_NOT_LINKED: 57 + LF_E_PRODUCT_VERSION_NOT_LINKED = 57 + + LF_E_FEATURE_FLAG_NOT_FOUND = 58 + + LF_E_SYSTEM_PERMISSION = 59 + + LF_E_IP = 60 + + LF_E_INVALID_PERMISSION_FLAG = 61 + + LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED = 62 + + LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED = 63 + + LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64 + + LF_E_WMIC = 65 - LF_E_FEATURE_FLAG_NOT_FOUND: 58 + LF_E_MACHINE_FINGERPRINT = 66 - LF_E_SYSTEM_PERMISSION: 59 + LF_E_CLIENT = 70 - LF_E_IP: 60 + LF_E_SERVER = 71 - LF_E_INVALID_PERMISSION_FLAG: 61 + LF_E_SERVER_TIME_MODIFIED = 72 - LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: 62 + LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73 - LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: 63 + LF_E_SERVER_LICENSE_EXPIRED = 74 - LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: 64 + LF_E_SERVER_LICENSE_SUSPENDED = 75 - LF_E_WMIC: 65 - - LF_E_MACHINE_FINGERPRINT: 66 - - LF_E_PROXY_NOT_TRUSTED: 67 - - LF_E_CLIENT: 70 - - LF_E_SERVER: 71 - - LF_E_SERVER_TIME_MODIFIED: 72 - - LF_E_SERVER_LICENSE_NOT_ACTIVATED: 73 - - LF_E_SERVER_LICENSE_EXPIRED: 74 - - LF_E_SERVER_LICENSE_SUSPENDED: 75 - - LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: 76 \ No newline at end of file + LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76 From 0cb96099ba2281f71f92cd9880f668f9677f70a6 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Tue, 6 Aug 2024 10:52:23 +0530 Subject: [PATCH 3/3] add: error code 67 --- cryptlex/lexfloatclient/lexfloatclient_exception.py | 2 ++ cryptlex/lexfloatclient/lexfloatstatus_codes.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/cryptlex/lexfloatclient/lexfloatclient_exception.py b/cryptlex/lexfloatclient/lexfloatclient_exception.py index f6207d4..4c15166 100644 --- a/cryptlex/lexfloatclient/lexfloatclient_exception.py +++ b/cryptlex/lexfloatclient/lexfloatclient_exception.py @@ -78,4 +78,6 @@ def get_error_message(code): return "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only." if code == LexFloatStatusCodes.LF_E_MACHINE_FINGERPRINT: return 'Machine fingerprint has changed since activation.' + if code == LexFloatStatusCodes.LF_E_PROXY_NOT_TRUSTED: + return 'Request blocked due to untrusted proxy.' return 'Unknown error!' diff --git a/cryptlex/lexfloatclient/lexfloatstatus_codes.py b/cryptlex/lexfloatclient/lexfloatstatus_codes.py index f87384c..2418b0a 100644 --- a/cryptlex/lexfloatclient/lexfloatstatus_codes.py +++ b/cryptlex/lexfloatclient/lexfloatstatus_codes.py @@ -58,6 +58,8 @@ class LexFloatStatusCodes: LF_E_MACHINE_FINGERPRINT = 66 + LF_E_PROXY_NOT_TRUSTED = 67 + LF_E_CLIENT = 70 LF_E_SERVER = 71