Skip to content

Commit 1e54ad3

Browse files
author
user
committed
fixing a issue on linux about the compiled library extension fixes #1
1 parent 43d5721 commit 1e54ad3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

js_xxtea_decrypt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ctypes, argparse, os, gzip, jsbeautifier, zlib, binascii
1+
import ctypes, argparse, os, gzip, jsbeautifier, zlib, binascii, platform
22
from ctypes import c_char_p, c_ulong
33
from io import BytesIO
44
import zipfile
@@ -98,7 +98,8 @@ def main():
9898
parser.add_argument("-bs", '--beautify', action="store_true", required=False, help="Enables beautifying!")
9999

100100
args = parser.parse_args()
101-
my_lib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib/libext_xxtea.dylib'))
101+
my_lib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib/libext_xxtea'\
102+
+".so" if platform.system() == "Linux" else ".dynlib" if platform.system()== 'Darwin' else ".so"))
102103
xxtea_decrypt = my_lib.xxtea_decrypt
103104
xxtea_decrypt.argtypes = [c_char_p, c_ulong, c_char_p, c_ulong, ctypes.POINTER(c_ulong)]
104105
xxtea_decrypt.restype = ctypes.POINTER(ctypes.c_ubyte)

lua_xxtea_decrypt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ctypes, argparse, os
1+
import ctypes, argparse, os, platform
22
from ctypes import c_char_p, c_ulong
33

44

@@ -42,7 +42,8 @@ def main():
4242
parser.add_argument("-k", '--key',metavar='key', type=str, required=True, help="XXTEA Key")
4343
parser.add_argument("-s", '--signature', metavar='signature', type=str, required=True, help="Signature")
4444
args = parser.parse_args()
45-
my_lib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib/libext_xxtea.dylib'))
45+
my_lib = ctypes.CDLL(os.path.join(os.path.dirname(os.path.abspath(__file__)),'lib/libext_xxtea'\
46+
+".so" if platform.system() == "Linux" else ".dynlib" if platform.system()== 'Darwin' else ".so"))
4647
xxtea_decrypt = my_lib.xxtea_decrypt
4748
xxtea_decrypt.argtypes = [c_char_p, c_ulong, c_char_p, c_ulong, ctypes.POINTER(c_ulong)]
4849
xxtea_decrypt.restype = ctypes.POINTER(ctypes.c_ubyte)

0 commit comments

Comments
 (0)