[DiscordArchive] so something wrong with memory layout again?
[DiscordArchive] so something wrong with memory layout again?
Archived author: Aleist3r • Posted: 2025-03-12T17:10:24.166000+00:00
Original source
i've made chatgpt do that for me
Archived author: Aleist3r • Posted: 2025-03-12T17:10:37.644000+00:00
Original source
gimme a sec
Archived author: Aleist3r • Posted: 2025-03-12T17:11:31.027000+00:00
Original source
```python
import idaapi
import idc
def import_function_names(file_path):
"""
Imports function names from a text file.
Each line in the file should contain:
- Address in hex (e.g., 0x401000)
- Function name (e.g., MyFunction1)
"""
with open(file_path, "r") as file:
for line in file:
line = line.strip() # Remove any leading/trailing whitespace
if not line:
continue # Skip empty lines
# Split each line into address and function name
parts = line.split()
if len(parts) != 2:
print(f"Skipping invalid line: {line}")
continue
try:
# Convert the address to an integer (from hex to decimal)
addr = int(parts[0], 16) # Convert address from hex to integer
func_name = parts[1] # Get function name
# Check if there's already a function at this address
if idaapi.get_func(addr) is None:
# If no function exists, create one at the address
idaapi.add_func(addr)
# Rename the function at the given address
idc.set_name(addr, func_name)
print(f"Function '{func_name}' imported at address {hex(addr)}")
except ValueError as e:
print(f"Error processing line: {line}. Error: {e}")
# Example usage
file_path = "D:\\Clients\\3.3.5a_IDB\\function_list.txt"
import_function_names(file_path)```
Archived author: Aleist3r • Posted: 2025-03-12T17:13:00.994000+00:00
Original source
and the function txt basically looks like this
```0x401010 CDataStore__Alloc
0x401030 CDataStore__Free```
Archived author: Aleist3r • Posted: 2025-03-12T17:13:16.737000+00:00
Original source
and so on, addresses can be grabbed from threads on ownedcore for example
Archived author: Aleist3r • Posted: 2025-03-12T17:13:50.757000+00:00
Original source
(just be sure to check if they're correctly offset ;])
Archived author: robinsch • Posted: 2025-03-12T17:16:31.898000+00:00
Original source
I can just recommend going the C++ to IDA route with your own parser. Saved me atleast 100h
Archived author: robinsch • Posted: 2025-03-12T17:17:04.418000+00:00
Original source
And you can just wipe your IDB in case you might fuck up calling conventions or other things and just reimport it from C++
Archived author: Aleist3r • Posted: 2025-03-12T17:18:16.807000+00:00
Original source
well yeah it's a good advice
Archived author: Peacy • Posted: 2025-03-12T17:25:50.312000+00:00
Original source
sounds good, thanks!