Questions tagged [c]

General purpose programming language that uses the procedural and structured programming paradigm.

Filter by
Sorted by
Tagged with
-1
votes
1answer
242 views

Why does the C compiler generate integer multiplication with large, seemingly random, numbers?

Hi I want to write those instructions in C, I'm having trouble with SAR EDX,6, ASM MOV EDX,8 MOV EDI,1 IMUL EDI,EDX MOV EAX,ED9CE24E IMUL EDI SAR EDX,6 my try int edi=1 int edx=8 edi*=edx; edx=((...
0
votes
0answers
321 views

How to pass Obfuscated Elf binary to gcc optimization end

Currently I have a 2000+Line function to reverse engineer with many redundancies and appears to be obfuscated. It their a way to pass to pass this binary to gcc or clang to reassemble it and optimize ...
-1
votes
1answer
73 views

Is there any windows API to execute thread on atomic mode? [closed]

Is there any windows API (application program interface) to execute thread on atomic mode?
-1
votes
1answer
3k views

How to convert assembly to C code [closed]

Is there an easy to convert assembly (ARM) to C code?
1
vote
1answer
276 views

Does empty enumeration in C structure creates unnamed field?

I was parsing some modified C++ headers with IDA when I come to some strange behavior. Imagine we have a structure like this (stored in a C header): struct S { enum {EN0, EN1}; int m1; } ; ...
1
vote
0answers
207 views

How get a full memory dump of a running specific process from kernel mode by driver?

How can i get a full memory dump of a running specific process from kernel mode by driver on windows operation system?
-1
votes
1answer
229 views

Can a keygen be created for this protection algorithm? [closed]

I reverse engineered a program protection algorithm and got the result in this source file I wrote, but I would know this type of protection. Please tell me what is the type of this protection ? And ...
3
votes
1answer
1k views

How to intercept a call to function with known name from known DLL

First of all I wasn't very much into reversing until now, so excuse me if my question is dumb. I have a windows DLL most likely made with Visual C++. It's been developed in 1998 and has Mfc42.dll (4....
6
votes
2answers
6k views

Question about LEA instruction

i'm learning to reverse engineer. So i'm coding some programs and try to understand their assembly. I stumbled upon a curious case and i think i can't solve it alone. Here's the c code: #include &...
2
votes
4answers
8k views

Basic help for reverse engineering for a newbie

I am a newbie to reverse engineering software. I am familiar x86 asm language, Linux internals, and c language. After going through lots of tutorials, I didn't absorb much knowledge. So, I have ...
-1
votes
1answer
119 views

Computing function offset differences

When I'm trying to compute the difference between two functions loaded into memory: int _start(void) { // code } int _end(void) { // code } DWORD funcSize = (DWORD) _end - (DWORD) _start; ...
1
vote
1answer
1k views

Retrieving the contents of PE file sections

I am trying to get the contents of the .text section of a file (notepad.exe) using the following code: #define SECHDROFFSET(a) ((LPVOID) ( (LPBYTE) a + \ ((...
-2
votes
1answer
420 views

Help Coverting ASM to C [closed]

I need assistance decompiling the following from ASM to pseudo C. Code 1 ... mov edx, Var1 # Move Var1 to edx mov ecx, Var2 # Move Var2 to ecx mov eax, edx # Move EDX (Var1) to EAX ...
5
votes
1answer
2k views

In Ollydbg, how do I change the path to a source code file without recreating entire directory structure?

I am bring a .EXE, a .PDB, and a source code .C file into my computer and attempting to look at my program in Ollydbg. I am compiling C programs on one machine (XP Vm actually) and running them in ...
1
vote
2answers
2k views

Recognizing CLib functions in Ollydbg or IDA

I'm just learning Olly/IDA and writing simple programs in C and looking at the .EXE code in Ollydbg and IDA. Below I have a simple printf Hello World program which I compile in Visual Studio 6. I ...
1
vote
1answer
142 views

Discrepancies in function declarations from decompilers?

An Android application I'm analyzing makes calls to a native library to generate a certain value. Here's an example of the native library function declaration from SMALI (Decompiled Java): .method ...
7
votes
3answers
14k views

How to effectively bypass GCC stack smashing detection

I was solving bof challenge on http://pwnable.kr/play.php it is required to smash the stack of the following code #include <stdio.h> #include <string.h> #include <stdlib.h> void ...
3
votes
1answer
495 views

Does hex-rays support VLA in any way?

I was testing some 'C' code with VLAs. It wasn't that surprising that Hex-Rays was not able to recognize VLA. As with structures there is some way to make it understand (simply making the variable ...
-1
votes
1answer
429 views

Hiding shared library calls from ltrace

I am trying to implement some antidebug methods. Although I have encrypted texts, ltrace reveals them, for example: strstr("Name:\tltrace\n", "ltrace") A solution would be static linking, but I do ...
5
votes
2answers
2k views

What do the 20 lines of executable code in this exploit do?

I stumbled upon this 31 bytes of Linux x86_64 Polymorphic execve Shellcode, posted by the author "d4sh&r": The code seems to be a combination of assembly and C and looks like this: /* ;Title: ...
3
votes
0answers
3k views

Can IDA generate C code for ASM assembly wihtout the binary

Lets say I have this picture of some assembly: Now I know how to manual tranform this assembly into C code because it is small but is it possible for IDA to convert this into C code? Ideally I would ...
1
vote
1answer
498 views

how to find gsharedinfo from current memory?

How would you scann all sections mapped in the local memory context to find gsharedinfo? gsharedinfo is not exported from user32.dll on Windows server 2008 !!! I would be grateful if you could help ...
2
votes
4answers
491 views

Cannot understand var passing to function in code compiled with dev c++ [duplicate]

I'm not understating why the parameters to printf are passed this way. mov [esp+20h+var_1C], eax mov [esp+20h+Format], offset Format ; "%d" Why esp is added with 20h then substracted with 20h ...
1
vote
1answer
617 views

Problem to understand execution of payload (shellcode)

I know that there are lot of (good) tutorials regarding this topic, but after reading them, I really cant follow their thoughts (e.g.: Smashing The Stack For Fun And Profit): The problem is that we ...
5
votes
1answer
3k views

Writing an exploit for sample-application

I understand the principles of exploiting a classical stack-based buffer-overflow, and now I want to practice it. Therefore I wrote the following test-application: #include <stdio.h> #include &...
1
vote
1answer
395 views

How to get the address of KiFastCallEntry from windows wdm driver

Hi i want to hook the KiFastCallEntry function from my Windows Driver , but i dont know how to get the addrres of this function , can someone pls tell me how? Target OS is Windows 7 32 bit
0
votes
1answer
294 views

Mapping a high level statement back in assembly dump

Say, I have compiled a large code base, e.g. gzip/gmp/python/php etc. on Linux. Is there any means to map a high level C construct, e.g. assignment/if-else/for/while/Math expression back in the ...
1
vote
1answer
588 views

What is the difference between these two function prologue instruction sequences?

the test is on 32-bit x86. I compiled the code with gcc 4.2, optimization level o2. I compiled the C code into binary, and then use objdump to disassemble it. Here are two sequences of instructions ...
3
votes
1answer
122k views

Translate ASSEMBLY to C [closed]

How to translate code assembly to C?? I am very poor in assembly code. EG: mov dword ptr [ebp+data], 612E2F47h mov dword ptr [ebp+data+4], 5B2A451Ch mov dword ptr [ebp+data+8], 6E6B5E18h ...
2
votes
1answer
9k views

How does scanf interact with my code in assembly

I have recently started getting into assembly for the purpose of reverse engineering. I started small with understanding basic datatypes, but I want to move on to more complex datatypes and functions. ...
1
vote
1answer
1k views

What knowledge do I need to read "The IDA Pro Book"?

I'm interested in vulnerability research and I want to get started in reading the book mentioned in the title. But the thing is that while I'm fairly confident in Python and PHP, I absolutely have no ...
0
votes
0answers
73 views

dlmalloc free pointers

I was looking at the implementation of "free" in my current dlmalloc(both the source and the disassembly). However, I could not find the code section the inserts the FD and BK into free chunks. What ...
1
vote
2answers
184 views

Globally allocated arrays optimization

I compile C code snippet with VS2010 by two ways: int g_arra[3]; int main() { int idx = 2; g_arra[0] = 10; g_arra[1] = 20; g_arra[2] = 30; g_arra[idx] = 40; return 0; } With /O2 ...
1
vote
3answers
779 views

Dump global datas to disk in assembly code

the experiment is on Linux, x86 32-bit. So suppose in my assembly program, I need to periodically (for instance every time after executing 100000 basic blocks) dump an array in .bss section from ...
-2
votes
1answer
500 views

Assembly analyze C system() function

So I made a very simple C program to study how C works on the inside. It has just 1 line in the main() excluding return 0: system("cls"); If I use ollydebugger to analyze this program It will show ...
1
vote
1answer
178 views

Declaration of a complex C expression

I used IDA Pro and got the following expression from a produced C file: v25 = (*(int (**)(void))(v22 + 464))(); I am trying to figure out the meaning of the above expression with the following links:...
2
votes
1answer
618 views

How do I find a collision for a simple hash algorithm

I have the following hash algorithm: unsigned long specialNum=0x4E67C6A7; unsigned int ch; char inputVal[]=" AAPB2GXG"; for(int i=0;i<strlen(inputVal);i++) ...
1
vote
2answers
641 views

How can I change the a port a program listens on?

I want to change the port number a program listens on. The program is a proprietary linux binary, Plex, that always listens to tcp port 32400 (hard-coded). Since I want to run this on a shared server,...
1
vote
1answer
877 views

Address of loaded driver on memory [closed]

How find address of loaded specific driver on memory by C language in windows os thanks
1
vote
1answer
454 views

How to find status and path of the specific module with C in the windows? [duplicate]

How to find status and path of the specific module with C in the windows? such as windbg lm (list loaded module) kd> lm m cdd start end module name 93ae0000 93afe000 cdd (...
1
vote
2answers
158 views

During debugging, is the process memory the same as the debugger's memory space?

This post might be specific to IDA Pro, so bear that in mind. I'm currently trying to write a plugin for debugging specifically one executable. I know that a certain object in the executable's ...
5
votes
2answers
276 views

Returning a C function to its grandfather

This is a homework assignment, so I'd appreciate it if I would get a hint only, not a full answer. I wrote this program which is supposed to print the following: Executing function_a Executing ...
3
votes
1answer
9k views

64-bit integers on 32-bit machines

Let's say I create a program in C like this and compile it on a regular 64-bit desktop machine: #include <stdint.h> int main(void) { uint64_t a = 0x12345679abcdefULL; uint64_t b = ...
3
votes
0answers
2k views

Reverse Engineering a 8 bit CRC checksum

I am trying to create a communication interface using C Language to an Air conditioning system, after analyzing the data packets I have identified that the data packet is consist of an 8 bit CRC (I am ...
2
votes
1answer
2k views

How to get the information of "how many and which symbols are resolved by linker"?

The test is on 32-bit Linux, x86. With gcc 4.6.3 and GNU ld 2.22. So I am trying to get the information of "how many symbols are resolved by linker" during link time? And how can I list the ...
3
votes
1answer
18k views

what's the function of LODWORD and HIDWORD?

I'm trying to figure out what does this piece of code exactly: LODWORD(fMax) = *(_DWORD *)v12; HIDWORD(fMax) = v13; I was reading on IDA\Plugins\defs.h the definition, but I don't understand ...
0
votes
3answers
391 views

Is it possible to programmatically search a disassembly for functions missing bounds checks?

Suppose I was to search a file for dangerous C functions: Assuming that we can perform a dissassembly, and that we cannot perform dynamic analysis is it possible to definitively identify a lack of ...
1
vote
0answers
562 views

Define new code section in assembly code to compile ELF binary

I defined a new code section in my assembly program, which is going to be compiled into 32-bit ELF binary, on x86. I use the linker scripts to assign a specified address for this new code section, it ...
1
vote
1answer
650 views

How to load library defined symbols to a specified location?

The test is on Ubuntu 12.04, 32-bit, with gcc 4.6.3. Basically I am doing some binary manipulation work on ELF binaries, and what I have to do now is to assemble a assembly program and guarantee the ...
2
votes
2answers
2k views

How can I write my main function as assembly opcodes in an integer array?

My OS is Windows 7 64-bit and my processor is an Intel Core i7-4700MQ running on the x64 architecture. My program is 32-bit. Recently, I read an article here describing how it is possible and legal ...

1
3 4
5
6 7