diff --git a/.gitignore b/.gitignore deleted file mode 100644 index a9d12c8..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -__pycache__ -temp - -/extractor - -cpp2il.exe - -requirements.txt -venv \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 0d16bfa..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# FGO-VerCode-Extractor - -This version is focused in github action, i will handle all backend part in steps and remove the use of python in process, ill use java. diff --git a/VerCode.json b/VerCode.json deleted file mode 100644 index ce7a65f..0000000 --- a/VerCode.json +++ /dev/null @@ -1 +0,0 @@ -{"appVer": "2.102.1", "verCode": "b151d9994b30a04f3298dcb22e47fd5fddcfa0a7f25834d12f7eb84d4f030038"} \ No newline at end of file diff --git a/app.json b/app.json deleted file mode 100644 index 575506a..0000000 --- a/app.json +++ /dev/null @@ -1 +0,0 @@ -{"verCode":"b151d9994b30a04f3298dcb22e47fd5fddcfa0a7f25834d12f7eb84d4f030038","appVer":"2.102.1"} \ No newline at end of file diff --git a/config.py b/config.py deleted file mode 100644 index f2ed0ce..0000000 --- a/config.py +++ /dev/null @@ -1,12 +0,0 @@ -import os; - -# https://fgo.square.ovh/apk/com.aniplex.fategrandorder.en.apk -url_apk = "https://fgo.bigcereal.com/apk/com.aniplex.fategrandorder.xapk" - -# https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder -url_version = "https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder" - -apk_name = url_apk.split("/")[-1] - -# Temp folder -temp_folder = os.path.join(os.getcwd(), "temp") \ No newline at end of file diff --git a/libs/Il2CppDumper/Il2CppDumper.deps.json b/libs/Il2CppDumper/Il2CppDumper.deps.json deleted file mode 100644 index 08e2fd3..0000000 --- a/libs/Il2CppDumper/Il2CppDumper.deps.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v7.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v7.0": { - "Il2CppDumper/6.7.40": { - "dependencies": { - "Mono.Cecil": "0.11.4" - }, - "runtime": { - "Il2CppDumper.dll": {} - } - }, - "Mono.Cecil/0.11.4": { - "runtime": { - "lib/netstandard2.0/Mono.Cecil.Mdb.dll": { - "assemblyVersion": "0.11.4.0", - "fileVersion": "0.11.4.0" - }, - "lib/netstandard2.0/Mono.Cecil.Pdb.dll": { - "assemblyVersion": "0.11.4.0", - "fileVersion": "0.11.4.0" - }, - "lib/netstandard2.0/Mono.Cecil.Rocks.dll": { - "assemblyVersion": "0.11.4.0", - "fileVersion": "0.11.4.0" - }, - "lib/netstandard2.0/Mono.Cecil.dll": { - "assemblyVersion": "0.11.4.0", - "fileVersion": "0.11.4.0" - } - } - } - } - }, - "libraries": { - "Il2CppDumper/6.7.40": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Mono.Cecil/0.11.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-IC1h5g0NeJGHIUgzM1P82ld57knhP0IcQfrYITDPXlNpMYGUrsG5TxuaWTjaeqDNQMBDNZkB8L0rBnwsY6JHuQ==", - "path": "mono.cecil/0.11.4", - "hashPath": "mono.cecil.0.11.4.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/libs/Il2CppDumper/Il2CppDumper.dll b/libs/Il2CppDumper/Il2CppDumper.dll deleted file mode 100644 index fe88523..0000000 Binary files a/libs/Il2CppDumper/Il2CppDumper.dll and /dev/null differ diff --git a/libs/Il2CppDumper/Il2CppDumper.exe b/libs/Il2CppDumper/Il2CppDumper.exe deleted file mode 100644 index 90ea85e..0000000 Binary files a/libs/Il2CppDumper/Il2CppDumper.exe and /dev/null differ diff --git a/libs/Il2CppDumper/Il2CppDumper.runtimeconfig.json b/libs/Il2CppDumper/Il2CppDumper.runtimeconfig.json deleted file mode 100644 index a8dfa21..0000000 --- a/libs/Il2CppDumper/Il2CppDumper.runtimeconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net7.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "7.0.0" - }, - "configProperties": { - "System.Reflection.Metadata.MetadataUpdater.IsSupported": false, - "System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true - } - } -} \ No newline at end of file diff --git a/libs/Il2CppDumper/Mono.Cecil.Mdb.dll b/libs/Il2CppDumper/Mono.Cecil.Mdb.dll deleted file mode 100644 index c22998b..0000000 Binary files a/libs/Il2CppDumper/Mono.Cecil.Mdb.dll and /dev/null differ diff --git a/libs/Il2CppDumper/Mono.Cecil.Pdb.dll b/libs/Il2CppDumper/Mono.Cecil.Pdb.dll deleted file mode 100644 index 0d396b8..0000000 Binary files a/libs/Il2CppDumper/Mono.Cecil.Pdb.dll and /dev/null differ diff --git a/libs/Il2CppDumper/Mono.Cecil.Rocks.dll b/libs/Il2CppDumper/Mono.Cecil.Rocks.dll deleted file mode 100644 index 785c186..0000000 Binary files a/libs/Il2CppDumper/Mono.Cecil.Rocks.dll and /dev/null differ diff --git a/libs/Il2CppDumper/Mono.Cecil.dll b/libs/Il2CppDumper/Mono.Cecil.dll deleted file mode 100644 index 9b78a39..0000000 Binary files a/libs/Il2CppDumper/Mono.Cecil.dll and /dev/null differ diff --git a/libs/Il2CppDumper/config.json b/libs/Il2CppDumper/config.json deleted file mode 100644 index 093722d..0000000 --- a/libs/Il2CppDumper/config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "DumpMethod": true, - "DumpField": true, - "DumpProperty": true, - "DumpAttribute": true, - "DumpFieldOffset": true, - "DumpMethodOffset": true, - "DumpTypeDefIndex": true, - "GenerateDummyDll": false, - "GenerateStruct": true, - "DummyDllAddToken": true, - "RequireAnyKey": false, - "ForceIl2CppVersion": false, - "ForceVersion": 16, - "ForceDump": false, - "NoRedirectedPointer": false -} \ No newline at end of file diff --git a/libs/Il2CppDumper/ghidra.py b/libs/Il2CppDumper/ghidra.py deleted file mode 100644 index 9e26ded..0000000 --- a/libs/Il2CppDumper/ghidra.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -functionManager = currentProgram.getFunctionManager() -baseAddress = currentProgram.getImageBase() -USER_DEFINED = ghidra.program.model.symbol.SourceType.USER_DEFINED - -def get_addr(addr): - return baseAddress.add(addr) - -def set_name(addr, name): - name = name.replace(' ', '-') - createLabel(addr, name, True, USER_DEFINED) - -def make_function(start): - func = getFunctionAt(start) - if func is None: - createFunction(start, None) - -f = askFile("script.json from Il2cppdumper", "Open") -data = json.loads(open(f.absolutePath, 'rb').read().decode('utf-8')) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - monitor.initialize(len(scriptMethods)) - monitor.setMessage("Methods") - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"].encode("utf-8") - set_name(addr, name) - monitor.incrementProgress(1) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - monitor.initialize(len(scriptStrings)) - monitor.setMessage("Strings") - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"].encode("utf-8") - name = "StringLiteral_" + str(index) - createLabel(addr, name, True, USER_DEFINED) - setEOLComment(addr, value) - index += 1 - monitor.incrementProgress(1) - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - monitor.initialize(len(scriptMetadatas)) - monitor.setMessage("Metadata") - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"].encode("utf-8") - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - monitor.initialize(len(scriptMetadataMethods)) - monitor.setMessage("Metadata Methods") - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"].encode("utf-8") - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - monitor.initialize(len(addresses)) - monitor.setMessage("Addresses") - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - make_function(start) - monitor.incrementProgress(1) - -print 'Script finished!' diff --git a/libs/Il2CppDumper/ghidra_wasm.py b/libs/Il2CppDumper/ghidra_wasm.py deleted file mode 100644 index 254a7d5..0000000 --- a/libs/Il2CppDumper/ghidra_wasm.py +++ /dev/null @@ -1,100 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -from wasm import WasmLoader -from wasm.analysis import WasmAnalysis -from ghidra.util.task import ConsoleTaskMonitor - -monitor = ConsoleTaskMonitor() -WasmLoader.loadElementsToTable(currentProgram, WasmAnalysis.getState(currentProgram).module, 0, 0, 0, monitor) - -runScript("analyze_dyncalls.py") - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -functionManager = currentProgram.getFunctionManager() -progspace = currentProgram.addressFactory.getAddressSpace("ram") -USER_DEFINED = ghidra.program.model.symbol.SourceType.USER_DEFINED - -def get_addr(addr): - return progspace.getAddress(addr) - -def set_name(addr, name): - name = name.replace(' ', '-') - createLabel(addr, name, True, USER_DEFINED) - -def make_function(start): - func = getFunctionAt(start) - if func is None: - createFunction(start, None) - -f = askFile("script.json from Il2cppdumper", "Open") -data = json.loads(open(f.absolutePath, 'rb').read().decode('utf-8')) - - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - dynCallNamespace = currentProgram.symbolTable.getNamespace("dynCall", None) - monitor.initialize(len(scriptMethods)) - monitor.setMessage("Methods") - for scriptMethod in scriptMethods: - offset = scriptMethod["Address"] - sig = scriptMethod["TypeSignature"] - symbolName = "func_%s_%d" % (sig, offset) - symbol = currentProgram.symbolTable.getSymbols(symbolName, dynCallNamespace) - if len(symbol) > 0: - addr = symbol[0].address - name = scriptMethod["Name"].encode("utf-8") - set_name(addr, name) - else: - print "Warning at %s:" % scriptMethod["Name"] - print "Symbol %s not found!" % symbolName - monitor.incrementProgress(1) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - monitor.initialize(len(scriptStrings)) - monitor.setMessage("Strings") - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"].encode("utf-8") - name = "StringLiteral_" + str(index) - createLabel(addr, name, True, USER_DEFINED) - setEOLComment(addr, value) - index += 1 - monitor.incrementProgress(1) - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - monitor.initialize(len(scriptMetadatas)) - monitor.setMessage("Metadata") - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"].encode("utf-8") - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - monitor.initialize(len(scriptMetadataMethods)) - monitor.setMessage("Metadata Methods") - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"].encode("utf-8") - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - -if "Addresses" in data and "Addresses" in processFields: - pass - -print 'Script finished!' diff --git a/libs/Il2CppDumper/ghidra_with_struct.py b/libs/Il2CppDumper/ghidra_with_struct.py deleted file mode 100644 index 5f18892..0000000 --- a/libs/Il2CppDumper/ghidra_with_struct.py +++ /dev/null @@ -1,156 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -from ghidra.app.util.cparser.C import CParserUtils -from ghidra.app.cmd.function import ApplyFunctionSignatureCmd - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -functionManager = currentProgram.getFunctionManager() -baseAddress = currentProgram.getImageBase() -USER_DEFINED = ghidra.program.model.symbol.SourceType.USER_DEFINED - -def get_addr(addr): - return baseAddress.add(addr) - -def set_name(addr, name): - try: - name = name.replace(' ', '-') - createLabel(addr, name, True, USER_DEFINED) - except: - print("set_name() Failed.") - -def set_type(addr, type): - # Requires types (il2cpp.h) to be imported first - newType = type.replace("*"," *").replace(" "," ").strip() - dataTypes = getDataTypes(newType) - addrType = None - if len(dataTypes) == 0: - if newType == newType[:-2] + " *": - baseType = newType[:-2] - dataTypes = getDataTypes(baseType) - if len(dataTypes) == 1: - dtm = currentProgram.getDataTypeManager() - pointerType = dtm.getPointer(dataTypes[0]) - addrType = dtm.addDataType(pointerType, None) - elif len(dataTypes) > 1: - print("Conflicting data types found for type " + type + "(parsed as '" + newType + "')") - return - else: - addrType = dataTypes[0] - if addrType is None: - print("Could not identify type " + type + "(parsed as '" + newType + "')") - else: - try: - createData(addr, addrType) - except ghidra.program.model.util.CodeUnitInsertionException: - print("Warning: unable to set type (CodeUnitInsertionException)") - - -def make_function(start): - func = getFunctionAt(start) - if func is None: - try: - createFunction(start, None) - except: - print("Warning: Unable to create function") - -def set_sig(addr, name, sig): - try: - typeSig = CParserUtils.parseSignature(None, currentProgram, sig, False) - except ghidra.app.util.cparser.C.ParseException: - print("Warning: Unable to parse") - print(sig) - print("Attempting to modify...") - # try to fix by renaming the parameters - try: - newSig = sig.replace(", ","ext, ").replace("\)","ext\)") - typeSig = CParserUtils.parseSignature(None, currentProgram, newSig, False) - except: - print("Warning: also unable to parse") - print(newSig) - print("Skipping.") - return - if typeSig is not None: - try: - typeSig.setName(name) - ApplyFunctionSignatureCmd(addr, typeSig, USER_DEFINED, False, True).applyTo(currentProgram) - except: - print("Warning: unable to set Signature. ApplyFunctionSignatureCmd() Failed.") - -f = askFile("script.json from Il2cppdumper", "Open") -data = json.loads(open(f.absolutePath, 'rb').read().decode('utf-8')) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - monitor.initialize(len(scriptMethods)) - monitor.setMessage("Methods") - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"].encode("utf-8") - set_name(addr, name) - monitor.incrementProgress(1) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - monitor.initialize(len(scriptStrings)) - monitor.setMessage("Strings") - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"].encode("utf-8") - name = "StringLiteral_" + str(index) - createLabel(addr, name, True, USER_DEFINED) - setEOLComment(addr, value) - index += 1 - monitor.incrementProgress(1) - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - monitor.initialize(len(scriptMetadatas)) - monitor.setMessage("Metadata") - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"].encode("utf-8") - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - if scriptMetadata["Signature"]: - set_type(addr, scriptMetadata["Signature"].encode("utf-8")) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - monitor.initialize(len(scriptMetadataMethods)) - monitor.setMessage("Metadata Methods") - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"].encode("utf-8") - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - setEOLComment(addr, name) - monitor.incrementProgress(1) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - monitor.initialize(len(addresses)) - monitor.setMessage("Addresses") - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - make_function(start) - monitor.incrementProgress(1) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - sig = scriptMethod["Signature"][:-1].encode("utf-8") - name = scriptMethod["Name"].encode("utf-8") - set_sig(addr, name, sig) - -print 'Script finished!' diff --git a/libs/Il2CppDumper/ida.py b/libs/Il2CppDumper/ida.py deleted file mode 100644 index e5f55e1..0000000 --- a/libs/Il2CppDumper/ida.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -imageBase = idaapi.get_imagebase() - -def get_addr(addr): - return imageBase + addr - -def set_name(addr, name): - ret = idc.set_name(addr, name, SN_NOWARN | SN_NOCHECK) - if ret == 0: - new_name = name + '_' + str(addr) - ret = idc.set_name(addr, new_name, SN_NOWARN | SN_NOCHECK) - -def make_function(start, end): - next_func = idc.get_next_func(start) - if next_func < end: - end = next_func - if idc.get_func_attr(start, FUNCATTR_START) == start: - ida_funcs.del_func(start) - ida_funcs.add_func(start, end) - -path = idaapi.ask_file(False, '*.json', 'script.json from Il2cppdumper') -data = json.loads(open(path, 'rb').read().decode('utf-8')) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - end = get_addr(addresses[index + 1]) - make_function(start, end) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"].encode("utf-8") - set_name(addr, name) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"].encode("utf-8") - name = "StringLiteral_" + str(index) - idc.set_name(addr, name, SN_NOWARN) - idc.set_cmt(addr, value, 1) - index += 1 - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"].encode("utf-8") - set_name(addr, name) - idc.set_cmt(addr, name, 1) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"].encode("utf-8") - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - idc.set_cmt(addr, name, 1) - idc.set_cmt(addr, '{0:X}'.format(methodAddr), 0) - -print 'Script finished!' - diff --git a/libs/Il2CppDumper/ida_py3.py b/libs/Il2CppDumper/ida_py3.py deleted file mode 100644 index 642c50a..0000000 --- a/libs/Il2CppDumper/ida_py3.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -imageBase = idaapi.get_imagebase() - -def get_addr(addr): - return imageBase + addr - -def set_name(addr, name): - ret = idc.set_name(addr, name, SN_NOWARN | SN_NOCHECK) - if ret == 0: - new_name = name + '_' + str(addr) - ret = idc.set_name(addr, new_name, SN_NOWARN | SN_NOCHECK) - -def make_function(start, end): - next_func = idc.get_next_func(start) - if next_func < end: - end = next_func - if idc.get_func_attr(start, FUNCATTR_START) == start: - ida_funcs.del_func(start) - ida_funcs.add_func(start, end) - -path = idaapi.ask_file(False, '*.json', 'script.json from Il2cppdumper') -data = json.loads(open(path, 'rb').read().decode('utf-8')) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - end = get_addr(addresses[index + 1]) - make_function(start, end) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"] - set_name(addr, name) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"] - name = "StringLiteral_" + str(index) - idc.set_name(addr, name, SN_NOWARN) - idc.set_cmt(addr, value, 1) - index += 1 - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"] - set_name(addr, name) - idc.set_cmt(addr, name, 1) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"] - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - idc.set_cmt(addr, name, 1) - idc.set_cmt(addr, '{0:X}'.format(methodAddr), 0) - -print('Script finished!') - diff --git a/libs/Il2CppDumper/ida_with_struct.py b/libs/Il2CppDumper/ida_with_struct.py deleted file mode 100644 index f007a3b..0000000 --- a/libs/Il2CppDumper/ida_with_struct.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -imageBase = idaapi.get_imagebase() - -def get_addr(addr): - return imageBase + addr - -def set_name(addr, name): - ret = idc.set_name(addr, name, SN_NOWARN | SN_NOCHECK) - if ret == 0: - new_name = name + '_' + str(addr) - ret = idc.set_name(addr, new_name, SN_NOWARN | SN_NOCHECK) - -def make_function(start, end): - next_func = idc.get_next_func(start) - if next_func < end: - end = next_func - if idc.get_func_attr(start, FUNCATTR_START) == start: - ida_funcs.del_func(start) - ida_funcs.add_func(start, end) - -path = idaapi.ask_file(False, '*.json', 'script.json from Il2cppdumper') -hpath = idaapi.ask_file(False, '*.h', 'il2cpp.h from Il2cppdumper') -parse_decls(open(hpath, 'rb').read(), 0) -data = json.loads(open(path, 'rb').read().decode('utf-8')) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - end = get_addr(addresses[index + 1]) - make_function(start, end) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"].encode("utf-8") - set_name(addr, name) - signature = scriptMethod["Signature"].encode("utf-8") - if apply_type(addr, parse_decl(signature, 0), 1) == False: - print "apply_type failed:", hex(addr), signature - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"].encode("utf-8") - name = "StringLiteral_" + str(index) - idc.set_name(addr, name, SN_NOWARN) - idc.set_cmt(addr, value, 1) - index += 1 - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"].encode("utf-8") - set_name(addr, name) - idc.set_cmt(addr, name, 1) - if scriptMetadata["Signature"] is not None: - signature = scriptMetadata["Signature"].encode("utf-8") - if apply_type(addr, parse_decl(signature, 0), 1) == False: - print "apply_type failed:", hex(addr), signature - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"].encode("utf-8") - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - idc.set_cmt(addr, name, 1) - idc.set_cmt(addr, '{0:X}'.format(methodAddr), 0) - -print 'Script finished!' - diff --git a/libs/Il2CppDumper/ida_with_struct_py3.py b/libs/Il2CppDumper/ida_with_struct_py3.py deleted file mode 100644 index ac23f89..0000000 --- a/libs/Il2CppDumper/ida_with_struct_py3.py +++ /dev/null @@ -1,87 +0,0 @@ -# -*- coding: utf-8 -*- -import json - -processFields = [ - "ScriptMethod", - "ScriptString", - "ScriptMetadata", - "ScriptMetadataMethod", - "Addresses", -] - -imageBase = idaapi.get_imagebase() - -def get_addr(addr): - return imageBase + addr - -def set_name(addr, name): - ret = idc.set_name(addr, name, SN_NOWARN | SN_NOCHECK) - if ret == 0: - new_name = name + '_' + str(addr) - ret = idc.set_name(addr, new_name, SN_NOWARN | SN_NOCHECK) - -def make_function(start, end): - next_func = idc.get_next_func(start) - if next_func < end: - end = next_func - if idc.get_func_attr(start, FUNCATTR_START) == start: - ida_funcs.del_func(start) - ida_funcs.add_func(start, end) - -path = idaapi.ask_file(False, '*.json', 'script.json from Il2cppdumper') -hpath = idaapi.ask_file(False, '*.h', 'il2cpp.h from Il2cppdumper') -parse_decls(open(hpath, 'r').read(), 0) -data = json.loads(open(path, 'rb').read().decode('utf-8')) - -if "Addresses" in data and "Addresses" in processFields: - addresses = data["Addresses"] - for index in range(len(addresses) - 1): - start = get_addr(addresses[index]) - end = get_addr(addresses[index + 1]) - make_function(start, end) - -if "ScriptMethod" in data and "ScriptMethod" in processFields: - scriptMethods = data["ScriptMethod"] - for scriptMethod in scriptMethods: - addr = get_addr(scriptMethod["Address"]) - name = scriptMethod["Name"] - set_name(addr, name) - signature = scriptMethod["Signature"] - if apply_type(addr, parse_decl(signature, 0), 1) == False: - print("apply_type failed:", hex(addr), signature) - -if "ScriptString" in data and "ScriptString" in processFields: - index = 1 - scriptStrings = data["ScriptString"] - for scriptString in scriptStrings: - addr = get_addr(scriptString["Address"]) - value = scriptString["Value"] - name = "StringLiteral_" + str(index) - idc.set_name(addr, name, SN_NOWARN) - idc.set_cmt(addr, value, 1) - index += 1 - -if "ScriptMetadata" in data and "ScriptMetadata" in processFields: - scriptMetadatas = data["ScriptMetadata"] - for scriptMetadata in scriptMetadatas: - addr = get_addr(scriptMetadata["Address"]) - name = scriptMetadata["Name"] - set_name(addr, name) - idc.set_cmt(addr, name, 1) - if scriptMetadata["Signature"] is not None: - signature = scriptMetadata["Signature"] - if apply_type(addr, parse_decl(signature, 0), 1) == False: - print("apply_type failed:", hex(addr), signature) - -if "ScriptMetadataMethod" in data and "ScriptMetadataMethod" in processFields: - scriptMetadataMethods = data["ScriptMetadataMethod"] - for scriptMetadataMethod in scriptMetadataMethods: - addr = get_addr(scriptMetadataMethod["Address"]) - name = scriptMetadataMethod["Name"] - methodAddr = get_addr(scriptMetadataMethod["MethodAddress"]) - set_name(addr, name) - idc.set_cmt(addr, name, 1) - idc.set_cmt(addr, '{0:X}'.format(methodAddr), 0) - -print('Script finished!') - diff --git a/libs/Il2CppDumper/il2cpp_header_to_ghidra.py b/libs/Il2CppDumper/il2cpp_header_to_ghidra.py deleted file mode 100644 index 47422db..0000000 --- a/libs/Il2CppDumper/il2cpp_header_to_ghidra.py +++ /dev/null @@ -1,37 +0,0 @@ -import re - -header = "typedef unsigned __int8 uint8_t;\n" \ - "typedef unsigned __int16 uint16_t;\n" \ - "typedef unsigned __int32 uint32_t;\n" \ - "typedef unsigned __int64 uint64_t;\n" \ - "typedef __int8 int8_t;\n" \ - "typedef __int16 int16_t;\n" \ - "typedef __int32 int32_t;\n" \ - "typedef __int64 int64_t;\n" \ - "typedef __int64 intptr_t;\n" \ - "typedef __int64 uintptr_t;\n" \ - "typedef unsigned __int64 size_t;\n" \ - "typedef _Bool bool;\n" - - -def main(): - fixed_header_data = "" - with open("il2cpp.h", 'r') as f: - print("il2cpp.h opened...") - original_header_data = f.read() - print("il2cpp.h read...") - fixed_header_data = re.sub(r": (\w+) {", r"{\n \1 super;", original_header_data) - print("il2cpp.h data fixed...") - print("il2cpp.h closed.") - with open("il2cpp_ghidra.h", 'w') as f: - print("il2cpp_ghidra.h opened...") - f.write(header) - print("header written...") - f.write(fixed_header_data) - print("fixed data written...") - print("il2cpp_ghidra.h closed.") - - -if __name__ == '__main__': - print("Script started...") - main() diff --git a/libs/java/apkeditor.jar b/libs/java/apkeditor.jar deleted file mode 100644 index e65f6eb..0000000 Binary files a/libs/java/apkeditor.jar and /dev/null differ diff --git a/libs/java/apktool.jar b/libs/java/apktool.jar deleted file mode 100644 index 9706648..0000000 Binary files a/libs/java/apktool.jar and /dev/null differ diff --git a/libs/python/decompile.py b/libs/python/decompile.py deleted file mode 100644 index d363cf1..0000000 --- a/libs/python/decompile.py +++ /dev/null @@ -1,62 +0,0 @@ - -import os -import subprocess; -import config - -from libs.python.logger import logger - -# java -jar .\apktool.jar d .\fate.apk --output '.\temp\' -f -def decompile_apk(): - apktool = os.path.join(os.getcwd(), "libs", "java", "apktool.jar") - apkeditor = os.path.join(os.getcwd(), "libs", "java", "apkeditor.jar") - apk = os.path.join(config.temp_folder, config.apk_name) - - if config.apk_name.endswith("xapk"): - logger.info("XAPK detected. Merging into APK files.") - result = subprocess.run(["java", "-jar", apkeditor, "m", "-i", apk, "-o", apk.replace("xapk", "apk")], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True - ) - - # All data is sterr maybe is a error of apkeditor is reported - for line in result.stderr.splitlines(): - if line.strip(): - logger.info(line) - - apk = apk.replace("xapk", "apk") - - logger.info("Decompiling apk...") - - result = subprocess.run(["java", "-jar", apktool, "d", apk, "--output", "./temp/files/", "-f"], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True - ) - - for line in result.stdout.splitlines(): - if line.strip(): - logger.info(line) - - logger.info("Decompile apk succesfully!") - - -def decrypt(): - il2cpp = os.path.join(os.getcwd(), "libs", "Il2CppDumper", "Il2CppDumper.exe") - global_metadata = os.path.join(config.temp_folder, "files", "assets", "bin", "Data", "Managed", "Metadata", "global-metadata.dat") - decrypt = os.path.join(config.temp_folder, "decrypt"); - - logger.info("Getting available libraries directories from apk") - lib_dir_path = os.path.join(config.temp_folder, "files", "lib") - lib_folders = os.listdir(lib_dir_path) - - logger.info(f"ArchLibs avalibles {lib_folders}") - logger.info(f"Getting libil2cpp from {lib_folders[0]}") - lib_dir_name = lib_folders[0] - libil2cpp = os.path.join(config.temp_folder, "files", "lib", lib_dir_name, "libil2cpp.so") - - logger.info('Decrypting Files!') - result = subprocess.run( - [il2cpp, libil2cpp, global_metadata, decrypt], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True - ) - - for line in result.stdout.splitlines(): - if line.strip(): - logger.info(line) \ No newline at end of file diff --git a/libs/python/download.py b/libs/python/download.py deleted file mode 100644 index 2cfd58b..0000000 --- a/libs/python/download.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -import httpx -import config -from libs.python.logger import logger - -def download_latest(): - logger.info('Creating folder...') - - os.mkdir(config.temp_folder) - os.mkdir(os.path.join(config.temp_folder, "decrypt")) - - logger.info('Downloading latest apk...!') - - with httpx.stream("GET", config.url_apk, follow_redirects=True) as response: - response.raise_for_status() - - with open(os.path.join(config.temp_folder, config.apk_name), "wb") as file: - for chunk in response.iter_bytes(): - file.write(chunk) - - logger.info('Apk downloaded!') \ No newline at end of file diff --git a/libs/python/logger.py b/libs/python/logger.py deleted file mode 100644 index 57d4f3e..0000000 --- a/libs/python/logger.py +++ /dev/null @@ -1,11 +0,0 @@ -import logging - -logging.basicConfig( - filemode="w", - filename="run.log", - format="%(levelname)s | %(module)s | L%(lineno)d | %(asctime)s: %(message)s", - datefmt="%Y-%m-%dT%H:%M:%S%z", - level=logging.INFO -) - -logger = logging.getLogger("VerCode (Extractor)") \ No newline at end of file diff --git a/libs/python/update.py b/libs/python/update.py deleted file mode 100644 index ffe03b1..0000000 --- a/libs/python/update.py +++ /dev/null @@ -1,27 +0,0 @@ -import json -import os -import config -import httpx - -from libs.python.logger import logger - -pathRoot = os.getcwd() -pathVerCode = os.path.join(pathRoot, "VerCode.json") - -def get_version(): - return httpx.get(config.url_version).text - -def is_necesary_update(current, latest): - return current != latest - -def check_update(): - if os.path.exists(pathVerCode): - with open(pathVerCode) as fVerCode: - dataVerCode = json.load(fVerCode) - versionVerCode = dataVerCode["appVer"] - versionAtlas = get_version() - logger.info(f"Current installed version: {versionVerCode}, up-to-date with the latest available version: {versionAtlas}.") - return is_necesary_update(versionVerCode, versionAtlas) - else: - - return True diff --git a/libs/python/verCode.py b/libs/python/verCode.py deleted file mode 100644 index 3f93552..0000000 --- a/libs/python/verCode.py +++ /dev/null @@ -1,42 +0,0 @@ -import json -import os -import re -import config - -from libs.python.update import get_version -from libs.python.logger import logger - -isNotVerCode = [ - "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", - "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", - "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", - "ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551", - "ffffffff00000001000000000000000000000000fffffffffffffffffffffffc" -] - -def write_verCode_data(): - stringLiteral = open(os.path.join(config.temp_folder, "decrypt", "stringliteral.json"), encoding="utf8"); - json_data = json.load(stringLiteral) - - logger.info("Writing verCode...") - - for data in json_data: - Value = data['value'] - - if len(Value) == 64: - isHash = len(re.findall("^[a-fA-F0-9]{64}$", Value)) > 0 - - if isHash and Value.islower() and not Value in isNotVerCode: - - # Create JSON - with open(os.path.join(os.getcwd(), "VerCode.json"), "w") as file: - version_latest = get_version() - - dataVerCode = {} - dataVerCode["appVer"] = version_latest; - dataVerCode["verCode"] = Value; - - json.dump(dataVerCode, file) - return logger.info(f"VerCode {Value} exported succefully!") - - diff --git a/main.py b/main.py deleted file mode 100644 index 1899ccc..0000000 --- a/main.py +++ /dev/null @@ -1,14 +0,0 @@ -from libs.python.update import check_update -from libs.python.download import download_latest -from libs.python.decompile import decompile_apk, decrypt -from libs.python.verCode import write_verCode_data -from libs.python.logger import logger - - -if check_update(): - download_latest() - decompile_apk() - decrypt() - write_verCode_data(); -else: - logger.info("No export needed, the latest version is already exported.") \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index cdf8791..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -httpx==0.27.0 \ No newline at end of file diff --git a/run.log b/run.log deleted file mode 100644 index 30035f5..0000000 --- a/run.log +++ /dev/null @@ -1,3 +0,0 @@ -INFO | _client | L1026 | 2024-11-18T08:01:22+0000: HTTP Request: GET https://gplay-ver.atlasacademy.workers.dev/?id=com.aniplex.fategrandorder "HTTP/1.1 200 OK" -INFO | update | L23 | 2024-11-18T08:01:22+0000: Current installed version: 2.102.1, up-to-date with the latest available version: 2.102.1. -INFO | main | L14 | 2024-11-18T08:01:22+0000: No export needed, the latest version is already exported.