Questions tagged [python]

General-purpose and high-level programming language. Python supports multiple programming paradigms, including object-oriented, imperative and functional programming styles.

Filter by
Sorted by
Tagged with
3
votes
1answer
66 views

Sharing variable between scripts

I wrote some Python scripts to help me disassemble one given file (only one), and I'd like to share some variables between differents scripts (or between 2 different executions of the same script). Is ...
0
votes
0answers
45 views

Reversing PYARMOR (?)

I have already decompiled an .exe file and reached to a .py but it is obfuscated using PyArmor. I have already used ''https://github.com/nlscc/unpyarmor'' to try it, but could not figure it out how to ...
2
votes
1answer
42 views

Printing all strings in a Ghidra project with python

I got the string objects from a Ghidra project using this code: l = list() def callback(s): l.append(s) ss = StringSearcher(currentProgram, 5, 1, False, True) ss.search(None, callback, True, ...
0
votes
0answers
54 views

Decompiling exe to python source code

I've recently tried to decompile a .exe to .py source code. It partly went well as the majority of the .pyc got translated into python code but partly also failed. Like the following part: --- This ...
-1
votes
0answers
33 views

How to decompile .pyc files,using uncompyle6

This file cannot be decompiled using uncompyle6. The generated file is 0KB. Did I do something wrong? Can you help decompile this file, thank you If you can tell me the way, I would be very grateful ...
0
votes
1answer
70 views

How can I reverse this python code (obfuscated by b64, gzip and many more)

How can I Deobfuscate this python code Link to code I tried to replace eval places by print. but it won't work and output is also obfuscated Head of the code looks like this can anyone please help me
0
votes
0answers
87 views

Help me please decode the string (looks like gzip but it is not)

The software sends to the main server such string: \x1f\xe2\x80\xb9\x08\x00\x00\x00\x00\x00\x04\x00E...\x03\x00\x00" decode_gzip(body) Later I've tried to decode it through different online ...
2
votes
0answers
81 views

How to decompile python ELF file (Compiled with Nuitka)?

I have some files that compiled with nuitka. formats are .bin. I could get shell access to running process with pyrasite same as this guide. but I cannot decompile function codes or anything else, and ...
0
votes
2answers
117 views

convert code to python

i have snippet code that i want to convert to python to understand the types that ghidra use such *(byte *) and *(code *) and *(uchar *) etc.. the first code: void one(int param_1,int param_2) { int ...
2
votes
0answers
48 views

Twitter scraping using Python

I've been working on a project to reverse-enginner twitter's app to scrape public posts from Twitter using an unofficial API, with Python. (I want to create an "alternative" app, which is ...
3
votes
1answer
74 views

On reverse engineering an udp protocol to control a drone

My goal is to control my drone with my raspberry pi using python and not the app that is being delivered together with it. First I connected the app to the drone, flew and used aircrack-ng to get the ...
-1
votes
1answer
144 views

Reversing a TXT obfuscated with pyArmor

Ok, so. PyArmor. Apparently, my friend used it to protect some script, except it's not a python script, it's a few TXT files. Is it possible to reverse engineer it so I can see whats in the actual TXT ...
0
votes
0answers
28 views

Decompiling PYC file gives “Embedded file name”

I have a PYC file (https://pastebin.com/raw/dcWfYZSV) and when I decompile using uncompyle6 I get https://pastebin.com/JqL7ZB0W It says "Embedded file name" - stupid question but is that the ...
0
votes
1answer
41 views

How to use two commands in python -c?

I am wanting to execute python command by using python -c but it contain in string library so i need import it. While reading man i find this: when called with -c command, it executes the ...
0
votes
1answer
104 views

Need starter-help on reverse-engineering a game algorithm

I've got a dataset of about 1700 attacks in this game. Subset of the data is provided here. It comprises of 9 columns: modifier Astr Aspd Adex Adef Dstr Dspd Ddex Ddef The ...
2
votes
1answer
109 views

How do I get the all the basic binary blocks containing a special instruction like 'CALL' or 'RET' using python in Ghidra?

I am using Ghidra to do reverse engineering of an ARM binary. I want to print the disassembly of all blocks across all functions containing a specific instruction like 'CALL' or 'RET'. How do I do ...
1
vote
0answers
47 views

Automating binary patching in Hopper Disassembler using python

I am curious to know if anyone has done anything similar to what I am looking to achieve... I have a .ipa file (iOS application) that I load into to Hopper Disassembler. I search for a string to ...
-1
votes
1answer
25 views

can a stdout captured at a parameter to python script

I'm working on a CTF challenge that is find a secret password.This secret password base on the username and password that i input and the hash value had print out after hash calculation and i want to ...
1
vote
1answer
226 views

Ghidra python - get string x-refs in a binary

In Ghidra, there is Defined Strings window, that lists all the strings in the binary and their location. I want to access the strings from Ghidra Python, and to get all the x-refs to those strings. ...
2
votes
1answer
119 views

How to reverse engineer cx_Freeze exe's?

How to reverse engineer Python scripts turned into binaries with cx_Freeze?
1
vote
1answer
2k views

How to turn .pyd files generated by pyinstaller into source?

I have decompiled a pyinstaller exe and then decompiled the .pyc source inside it. only problem is the source is this import secretmodule secretmodule.main() Annoying, I know. i found secretmodule ...
0
votes
0answers
207 views

Decoding messages sent/received by Python websocket client

I am using the websocket module for my client in python3, and I am trying to troubleshoot some errors I am getting that lead to the client disconnecting after seemingly random intervals. When I ...
1
vote
1answer
534 views

How can I debug Ghidra plugin Python scripts in IDE?

I'd like to debug Ghidra plugin scripts written in python using an IDE such as Eclipse. I have installed Pydev and the GhidraDev plugin (from Ghidra open a script in Eclipse to autoinstall the plugin)...
0
votes
0answers
536 views

Reverse exe file compiled by pyinstaller

I am trying to get python source code from only exe file compiled by pyinstaller. I used the pyinstxtractor.py and got extracted folder. And then what or how should I do? Or could you explain other ...
1
vote
1answer
545 views

Buffer overflow: pwntools does not give me a shell, despite exploit working without pwntools

Recently, I've been trying to learn how to use the pwntools library. I am trying to exploit the following program using pwntools: #include <stdio.h> #include <stdlib.h> int main(void) { ...
0
votes
1answer
334 views

Extract PYZ Error

I successfully recovered some PYC files from an ELF built by PyInstaller (https://github.com/extremecoders-re/pyinstxtractor/wiki/Extracting-Linux-ELF-binaries). There is a PYZ archive in the dump. I ...
0
votes
1answer
61 views

Is command injection using a valid file path possible?

My question is theoretical, and not bound to python - but for the sake of simplicity, I'll use Python code snippet. Let's assume I have the following code: import os import sys if os.path.exist(sys....
2
votes
1answer
210 views

How to start out in reversing?

I'm new in reversing and I'd like a lot to learn about it. I have little to no knowledge about it. Is still worth to learn x86 Assembly? Since almost everything these days work on x64 architecture. ...
0
votes
0answers
30 views

How can I have an interactive r2pipe session?

I am trying to make an interactive tutorial. It uses radare2 with r2pipe as its reverse engineering toolkit. I want my users to be able to use the visual mode through r2pipe. In order for the visual ...
1
vote
1answer
73 views

Using angr/radare2 to estimate values given chunks of assembly

I'm currently using radare2 in order to construct a simple CFG, each block/node in that graph is composed of one or more assembly instructions, I wish to estimate the value of specific register or ...
0
votes
1answer
82 views

Python decompilation seems to return gibberish (partly)

I decompiled a pyc file with uncompyle6, and this is the result: # uncompyle6 version 3.7.3 # Python bytecode 3.6 (3379) # Decompiled from: Python 3.6.9 (default, Aug 24 2020, 10:24:35) # [GCC 9.3.0] ...
3
votes
1answer
84 views

reason of padding in exploit

I was doing vulnserver bufferflow exploit. I saw a tutorial where the he makes a payload to exploit the server. Take a look at the exploit: #!/usr/bin/python import socket target_ip = "10.0.2....
0
votes
0answers
49 views

Debug dll file used in python script IDA

I am fairly new to RE on windows. I have a python script which via ctypes uses functions from a dll. I don't know if it's possible, but I would like to debug the dll used in the python script (the dll ...
1
vote
0answers
1k views

Reversing PyArmor + Pyinstaller

Created an application, protected by PyArmor and used pyinstaller. I'm trying to reverse engineer it. So far I've decompiled the exe into pyc files but it's still pyarmor encrypted I can only see the ...
2
votes
1answer
77 views

Ghidra Python - cancel decompilation task

The way to decompile a function in Ghidra Python is: decomp = DecompInterface() decomp.openProgram(currentProgram) decompile = decomp.decompileFunction(func, 1000, monitor) However, in ...
0
votes
0answers
36 views

help about methodology

I am a beginner in reverse engineering. For a challenge I need to reverse a code in python this code use enigma algorithm : To found the good configuration to decode the enigma code received. The ...
2
votes
1answer
2k views

Decompiling .pyc file to 0 byte .py file

i am doing the CTF-like challenges. One of these tasks need us to decompiling Python bytecode 3.8 (.pyc file) into py file. However, the py file that generated by pyc file is 0 byte The original file'...
1
vote
1answer
96 views

Ida python No module named tempo

I tried to run tempo.py from ida python github , but I got error No module named tempo According to Igor Skochinsky answer , this script is wrong Apparently, tempo was an internal module used ...
0
votes
1answer
316 views

Ghidra Python - Get Decompile Line Text by RVA

Is there a way in Ghidra Python to get the corresponding decompile line by RVA? Or the opposite - get the corresponding RVA from a given line in a decompile?
1
vote
3answers
539 views

Ghidra Python - Get x-refs of a specific function

What is the best way to get calling x-refs for a specific function? I am aware of the following method: func = getFirstFunction() while func is not None: func_name = func.getName() if ...
0
votes
1answer
387 views

GDB - Send Python output to the program after SIGINT

I am trying to learn GDB to better understand buffer overflows but I can't find an answer to my problem which is how can I send a Python-generated output to the program when the program asks for user ...
1
vote
1answer
2k views

Using Python 3.7 and 2.x in same IDA

I have IDA Pro 7.4 that use with Python 3.7 and I have some IDA-plugin that works only with Python 2.7. Is there any way to run that Python 2.7 based plugin?
1
vote
1answer
2k views

Decompiling Python Files: ValueError

So I have this python file and I successfully unpacked its content inside of it we have our file.pyc I appended the magic bytes to it so it went from: E3 00 00 00 00 00 00 00 00 00 00 00 00 to ...
0
votes
0answers
47 views

Python based static c analysis tools

I want to analyze some open-source C code, and I'm looking for a static analysis python library for C, preferably open-source. Any ideas/suggestions, based on your experience?
3
votes
1answer
638 views

ghidra-python: create struct with big endian field

Using ghidra's python scripting engine, I'd like to create a struct which contains a big endian, unsigned integer. This field is always big endian, no matter what the endainess of the binary CPU is. ...
-2
votes
1answer
3k views

How to decompile obfuscated Python code?

I have an executable file, which I am trying to decompile. I have already deduced that it was originally programmed in Python. I know that it was obfuscated with PyArmor and possibly compiled with ...
-1
votes
1answer
131 views

Help to understand what's inside base64 string

While performing a file upload, a template parameter is sent together with file. Service acts differently when different parameters are passed. I need help to figure out what this parameter contains. ...
1
vote
1answer
244 views

Python self decryption script, as mean of obfuscation

I have a software with an embedded python interpreter. The software can open upon startup a given .py script and execute it. Let's assume that in my python environment I can't open other files, and I ...
4
votes
1answer
480 views

Ghidra Headless Analyzer - Create Functions

I'm interested in open a binary file (.bin, without arch info), and analyze it with analyzeHeadless.bat (Ghidra version without GUI). I know what is the architecture of the file, so I pass it as a ...
1
vote
3answers
89 views

How to input ascii control character into program?

I am working on a CTF where I need to pass an address as input to a program. This address contains the value 0x09 (the tab character). This is causing me problems, because it seems that bash is ...