The machine code of the file (executable file)?

How can I access the machine codes (binary files) of the executable?

More details

  • I'm on Ubuntu (Linux)
  • I want to access machine codes (binary files) of .exe files (files are in PE format)
  • I use C to implement
+4
source share
2 answers

objdump -d . -s, . - -d , -d, objdump , . . objdump. , PE foo.exe:

objdump -sd foo.exe

. :

Contents of section .text:
 401000 33c03905 28944200 0f9fc0c3 558bec51  3.9.(.B.....U..Q
 401010 568bf16a 01684410 4000c706 30024200  V..j.hD.@...0.B.
 401020 ff15b000 420085c0 75158d45 fc68c00e  ....B...u..E.h..
 401030 420050c7 45fc9070 4200e8cd bc01008b  B.P.E..pB.......
 401040 c65ec9c3 837c2404 0575056a 0158eb12  .^...|$..u.j.X..
 401050 ff052894 420033c0 833d2894 4200020f  ..(.B.3..=(.B...
 401060 9cc0c204 00568bf1 e8140000 00f64424  .....V........D$
 401070 08017407 56e88b6f 0000598b c65ec204  ..t.V..o..Y..^..
 401080 00558bec 516a0068 44104000 c7013002  .U..Qj.hD.@...0.
 401090 4200ff15 b0004200 85c07515 8d45fc68  B.....B...u..E.h
 4010a0 c00e4200 50c745fc 90704200 e85bbc01  ..B.P.E..pB..[..
 4010b0 00c9c3e8 48ffffff f6d81bc0 25044000  ....H.......%.@.
 4010c0 80c20c00 e837ffff fff6d81b c0250440  .....7.......%.@
 4010d0 0080c208 00558bec 568b7508 68c58240  .....U..V.u.h..@
 4010e0 00682072 4200ff75 0c8b4e40 68187242  .h rB..u..N@h.rB
 4010f0 00e8d771 00008bc8 e8e87100 008bc8e8  ...q......q.....

. - , , ASCII ., .

:

00401000 <.text>:
  401000:   33 c0                   xor    %eax,%eax
  401002:   39 05 28 94 42 00       cmp    %eax,0x429428
  401008:   0f 9f c0                setg   %al
  40100b:   c3                      ret    
  40100c:   55                      push   %ebp
  40100d:   8b ec                   mov    %esp,%ebp
  40100f:   51                      push   %ecx
  401010:   56                      push   %esi
  401011:   8b f1                   mov    %ecx,%esi
  401013:   6a 01                   push   $0x1
  401015:   68 44 10 40 00          push   $0x401044
  40101a:   c7 06 30 02 42 00       movl   $0x420230,(%esi)
  401020:   ff 15 b0 00 42 00       call   *0x4200b0

. , , , . , , " " ( PE ). ( AT & T), -Mintel Intel:

00401000 <.text>:
  401000:   33 c0                   xor    eax,eax
  401002:   39 05 28 94 42 00       cmp    DWORD PTR ds:0x429428,eax
  401008:   0f 9f c0                setg   al
  40100b:   c3                      ret    
  40100c:   55                      push   ebp
  40100d:   8b ec                   mov    ebp,esp
  40100f:   51                      push   ecx
  401010:   56                      push   esi
  401011:   8b f1                   mov    esi,ecx
  401013:   6a 01                   push   0x1
  401015:   68 44 10 40 00          push   0x401044
  40101a:   c7 06 30 02 42 00       mov    DWORD PTR [esi],0x420230
  401020:   ff 15 b0 00 42 00       call   DWORD PTR ds:0x4200b0

Agner Fog objconv, , Windows objdump.

+6

.

"binutils", objdump:

$ objdump --disassemble my-fantastic-program > my-fantastic-program.asm

my-fantastic-program, , , , .

> .

+5

Source: https://habr.com/ru/post/1613830/


All Articles