disassembly

x86 Assembly: How do Disassemblers know how to break up instructions?

时间秒杀一切 提交于 2019-11-30 17:27:05
问题 How does a x86 disassembler know where to break up the instructions? I am looking at the 8088 instruction set. For example the move instruction has 7 variations that range from 2 to 4 bytes. The instructions themselves seem to follow no particular order. Another reason for Why is x86 ugly?. For example: 76543210 76543210 76543210 76543210 reg/mem to/from reg 100010dw ||regr/m imm to reg/mem 1100011w ||000r/m dat dat w=1 imm to reg 1011wreg data dat w=1 imm to accum 1010000w addr-low addrhigh

What does “short” jump mean in assembly language?

我的梦境 提交于 2019-11-30 08:38:01
What does the "SHORT" mean in this code? JE SHORT 00013FB8 Short jumps (and near calls) are jumps whos target is in the same module(they are intramodular, however it is possible to get intermodular variants from certain hacks), they are most commonly up to 127 bytes of relative displacement(they change the flow of execution forward or backward from the address of the instruction), however there are 16bit variants offering 32k bytes. You don't really need to worry about it much, its really superfluos information, but the intel developer manuals(volumes 2a and 2b, specifically 2a) will cover the

Determining Which Compiler Built a Win32 PE

家住魔仙堡 提交于 2019-11-30 07:03:45
How can one determine which C or C++ compiler was used to build a particular Windows executable or DLL? Some compilers leave behind version strings in the final executable, but this seems to be rarer on Windows than on Linux. Specifically, I'm interested in distinguishing between Visual C++ and the various MinGW compilers (usually fairly easy from the function signatures), and then between Visual C++ versions (6, 2002/2003, 2005, 2008; more difficult to do). Is there a tool out there that can make the distinction in a semi-reliable way? One source of a hint to distinguish among VC versions is

Decompiling EXE to ASM

泪湿孤枕 提交于 2019-11-30 05:44:50
问题 I want to make a basic antivirus for my free time. Basically I learned about the basic structure of the EXE(windows) file. How do I extract the ASM code from the file and the PE header? 回答1: You can install Cygwin and use objdump to decompile an exe into asm. Be sure you select the binutils when installing cygwin. After installing cygwin, you can run the following from a bash shell: objdump -Slx yourpgm.exe 回答2: You can use some free distrubuted disassembler.for example: ollydbg diassembler.

Waste in memory allocation for local variables

和自甴很熟 提交于 2019-11-30 05:40:47
问题 This my program: void test_function(int a, int b, int c, int d){ int flag; char buffer[10]; flag = 31337; buffer[0] = 'A'; } int main() { test_function(1, 2, 3, 4); } I compile this program with the debug option: gcc -g my_program.c I use gdb and I disassemble the test_function with intel syntax: (gdb) disassemble test_function Dump of assembler code for function test_function: 0x08048344 <test_function+0>: push ebp 0x08048345 <test_function+1>: mov ebp,esp 0x08048347 <test_function+3>: sub

Why does 64-bit VC++ compiler add nop instruction after function calls?

丶灬走出姿态 提交于 2019-11-30 04:46:16
I've compiled the following using Visual Studio C++ 2008 SP1, x64 C++ compiler: I'm curious, why did compiler add those nop instructions after those call s? PS1. I would understand that the 2nd and 3rd nop s would be to align the code on a 4 byte margin, but the 1st nop breaks that assumption. PS2. The C++ code that was compiled had no loops or special optimization stuff in it: CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/) : CDialog(CTestDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); //This makes no sense. I used it to set a debugger breakpoint ::GdiFlush(); srand(:

Ida pro gragh output batch mode

点点圈 提交于 2019-11-29 16:27:59
Can anyone let me know how we are going to output all the subroutine's graphs in batch mode suing IDC . i.e. I have 447 subroutine's and wanna be output them all and I would like to make sure I first retrieve all the routines address automatically, cuz by knowing the address I can simply use GenFuncCall . P.S: Is this the only cfg that I can get from Ida Pro given a binary dis-assembled file? If you just want the address of all known functions in the IDB, you could use something like this using IDAPython (just an example): def main(): for count, func_ea in enumerate(Functions()): if func_ea ==

Find a function by it signature in Windows DLL

与世无争的帅哥 提交于 2019-11-29 14:42:01
Have found a function address in a DLL. Have no source code for this DLL, not mine. This DLL is not really changed frequently, but when changed, it is a problem for me to find it by disassembling. Saw some notes in web about making it signature and then find it by this saved signature. Can you, please, give some ideas or working example on how to implement this? You can achieve this by code signature scanning, which is something I have done in the past. The concept mainly works by relying on the fact that functions often do not change too much between updates, but simply relocate because they

Disassembly view of C# 64-bit Release code is 75% longer than 32-bit Debug code?

匆匆过客 提交于 2019-11-29 14:22:53
EDIT I tested release in 32 bit, and the code was compact. Therefore the below is a 64 bit issue. I'm using VS 2012 RC. Debug is 32 bit, and Release is 64 bit. Below is the debug then release disassembly of a line of code: crc = (crc >> 8) ^ crcTable[((val & 0x0000ff00) >> 8) ^ crc & 0xff]; 0000006f mov eax,dword ptr [ebp-40h] 00000072 shr eax,8 00000075 mov edx,dword ptr [ebp-3Ch] 00000078 mov ecx,0FF00h 0000007d and edx,ecx 0000007f shr edx,8 00000082 mov ecx,dword ptr [ebp-40h] 00000085 mov ebx,0FFh 0000008a and ecx,ebx 0000008c xor edx,ecx 0000008e mov ecx,dword ptr ds:[03387F38h] 00000094

Can I give objdump an address and have it disassemble the containing function?

非 Y 不嫁゛ 提交于 2019-11-29 12:00:59
问题 I'm finding it really annoying to have to disassemble large swathes of library code just to get enough context to see what is causing a crash. Is there any way that I can just hand objdump an address, and have it find the boundaries of the containing function for me? EDIT: Better yet, can I have it disassemble an entire stack trace for me? 回答1: Something like this perhaps? $ objdump -S --start-address=0x42 foo.o | awk '{print $0} $3~/retq?/{exit}' It prints the dis-assembly listing starting