小编Nee*_*fra的帖子

找到变量Buf的确切地址

作为参考,我使用以下代码:

#include <stdio.h>
#include <string.h>

int main (void) {
    char buf[100]; // ------> How do I find the address in gdb?

    printf ("Buffer is at memory location: %08x\n", &buf);
    strcpy (buf, "some random text");
    printf ("Text is [%s]\n", buf);

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能gdb告诉我buf变量的地址?

stack-overflow buffer gdb

24
推荐指数
3
解决办法
6万
查看次数

如何从机器代码中删除 NULL (00)?

我需要知道如何从机器代码中删除空值 (00)。我用汇编语言编写了代码。它运行成功。我需要没有 NULL 的输出

.data
  Bash:
      .asciz "/bin/hostname"
  Null1:
      .int 0
  AddrToBash:
      .int 0
  NULL2:
      .int 0

  .text
      .globl _start

_start:
       #execute routine

       xor  %eax,%eax
       movl $Bash, AddrToBash
       movl $11,%eax
       movl $Bash,%ebx
       movl $AddrToBash,%ecx
       movl $NULL2,%edx
       int  $0x80

       #exit routine


     Exit:
       movl $10,%ebx
       movl $1,%eax
       int $0x80 
Run Code Online (Sandbox Code Playgroud)

以下输出是

4000b0: 31 c0                   xor    %eax,%eax
  4000b2:   c7 04 25 f2 00 60 00    movl   $0x6000e0,0x6000f2
  4000b9:   e0 00 60 00 
  4000bd:   b8 0b 00 00 00          mov    $0xb,%eax
  4000c2:   bb e0 00 …
Run Code Online (Sandbox Code Playgroud)

assembly shellcode

-3
推荐指数
1
解决办法
3953
查看次数

标签 统计

assembly ×1

buffer ×1

gdb ×1

shellcode ×1

stack-overflow ×1