写一段vmp3.0脱壳的程序(来自AI)

// 写一段vmp3.0脱壳的程序
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>

int main(int argc, char *argv[])
{
    int fd;
    int ret;
    int i;
    int count;
    int offset;
    int size;
    int *p;
    int *q;
    int *r;
    int *s;
    int *t;

    fd = open("/dev/vmp3", O_RDWR);
    if (fd < 0)
    {
        perror("open");
        return -1;
    }
    printf("open success\n");
    printf("fd = %d\n", fd);

    p = (int *)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
    if (p == MAP_FAILED)
    {
        perror("mmap");
        return -1;
    }
    printf("mmap success\n");
    printf("p = %d\n", p);
    printf("p = %d\n", *p);
    printf("p = %d\n", *(p + 1));
    printf("p = %d\n", *(p + 2));
    printf("p = %d\n", *(p + 3));
    printf("p = %d\n", *(p + 4));
    printf("p = %d\n", *(p + 5));
    printf("p = %d\n", *(p + 6));
    printf("p = %d\n", *(p + 7));
    printf("p = %d\n", *(p + 8));
    printf("p = %d\n", *(p + 9));
    printf("p = %d\n", *(p + 10));
    printf("p = %d\n", *(p + 11));
    printf("p = %d\n", *(p + 12));
    printf("p = %d\n", *(p + 13));
    printf("p = %d\n", *(p + 14));
    printf("p = %d\n", *(p + 15));
    printf("p = %d\n", *(p + 16));
    printf("p = %d\n", *(p + 17));
    printf("p = %d\n", *(p + 18));
    printf("p = %d\n", *(p + 19));
    printf("p = %d\n", *(p + 20));
    printf("p = %d\n", *(p + 21));
    printf("p = %d\n", *(p + 22));
    printf("p = %d\n", *(p + 23));
    printf("p = %d\n", *(p + 24));
    printf("p = %d\n", *(p + 25));
    printf("p = %d\n", *(p + 26));
    printf("p = %d\n", *(p + 27));
    printf("p = %d\n", *(p + 28));
    printf("p = %d\n", *(p + 29));
    printf("p = %d\n", *(p + 30));
    printf("p = %d\n", *(p + 31));
    printf("p = %d\n", *(p + 32));

    q = (int *)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 4096);
    if (q == MAP_FAILED)
    {
        perror("mmap");
        return -1;
    }
    printf("mmap success\n");
    printf("q = %d\n", q);
    printf("q = %d\n", *q);
    printf("q = %d\n", *(q + 1));
    printf("q = %d\n", *(q + 2));
    printf("p = %d\n", *(q + 3));
    printf("p = %d\n", *(q + 4));
    printf("p = %d\n", *(q + 5));
    printf("p = %d\n", *(q + 6));
    printf("p = %d\n", *(q + 7));
    printf("p = %d\n", *(q + 8));
    printf("p = %d\n", *(q + 9));
    printf("p = %d\n", *(q + 10));
    printf("p = %d\n", *(q + 11));
    printf("p = %d\n", *(q + 12));
    printf("p = %d\n", *(q + 13));
    printf("p = %d\n", *(q + 14));
    printf("p = %d\n", *(q + 15));
    printf("p = %d\n", *(q + 16));
    printf("p = %d\n", *(q + 17));
    printf("p = %d\n", *(q + 18));
    printf("p = %d\n", *(q + 19));
    printf("p = %d\n", *(q + 20));
    printf("p = %d\n", *(q + 21));
    printf("p = %d\n", *(q + 22));
    printf("p = %d\n", *(q + 23));
    printf("p = %d\n", *(q + 24));
    printf("p = %d\n", *(q + 25));
    printf("p = %d\n", *(q + 26));
    printf("p = %d\n", *(q + 27));
    printf("s = %d\n", *(s + 34));
    printf("p = %d\n", *(q + 28));
    printf("p = %d\n", *(q + 29));
    printf("p = %d\n", *(q + 30));
    printf("p = %d\n", *(q + 31));
    printf("p = %d\n", *(q + 32));

    r = (int *)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 8192);
    if (r == MAP_FAILED)
    {
        perror("mmap");
        return -1;
    }
    printf("mmap success\n");
    printf("r = %d\n", r);
    printf("r = %d\n", *r);
    printf("r = %d\n", *(r + 1));
    printf("r = %d\n", *(r + 2));
    printf("r = %d\n", *(r + 3));
    printf("r = %d\n", *(r + 4));
    printf("r = %d\n", *(r + 5));
    printf("r = %d\n", *(r + 6));
    printf("r = %d\n", *(r + 7));
    printf("r = %d\n", *(r + 8));
    printf("r = %d\n", *(r + 9));
    printf("r = %d\n", *(r + 10));
    printf("r = %d\n", *(r + 11));
    printf("r = %d\n", *(r + 12));
    printf("r = %d\n", *(r + 13));
    printf("r = %d\n", *(r + 14));
    printf("r = %d\n", *(r + 15));
    printf("r = %d\n", *(r + 16));
    printf("r = %d\n", *(r + 17));
    printf("r = %d\n", *(r + 18));
    printf("r = %d\n", *(r + 19));
    printf("r = %d\n", *(r + 20));
    printf("r = %d\n", *(r + 21));
    printf("r = %d\n", *(r + 22));
    printf("r = %d\n", *(r + 23));
    printf("r = %d\n", *(r + 24));
    printf("r = %d\n", *(r + 25));
    printf("r = %d\n", *(r + 26));
    printf("r = %d\n", *(r + 27));
    printf("r = %d\n", *(r + 28));
    printf("r = %d\n", *(r + 29));
    printf("r = %d\n", *(r + 30));
    printf("r = %d\n", *(r + 31));
    printf("r = %d\n", *(r + 32));

    s = (int *)mmap(NULL, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 12288);
    if (s == MAP_FAILED)
    {
        perror("mmap");
        return -1;
    }
    printf("mmap success\n");
    printf("s = %d\n", s);
    printf("s = %d\n", *s);
    printf("s = %d\n", *(s + 1));
    printf("s = %d\n", *(s + 2));
    printf("s = %d\n", *(s + 3));
    printf("s = %d\n", *(s + 4));
    printf("s = %d\n", *(s + 5));
    printf("s = %d\n", *(s + 6));
    printf("s = %d\n", *(s + 7));
    printf("s = %d\n", *(s + 8));
    printf("s = %d\n", *(s + 9));
    printf("s = %d\n", *(s + 34));
    printf("s = %d\n", *(s + 10));
    printf("s = %d\n", *(s + 11));
    printf("s = %d\n", *(s + 12));
    printf("s = %d\n", *(s + 13));
    printf("s = %d\n", *(s + 14));
    printf("s = %d\n", *(s + 15));
    printf("s = %d\n", *(s + 16));
    printf("s = %d\n", *(s + 17));
    printf("s = %d\n", *(s + 18));
    printf("s = %d\n", *(s + 19));
    printf("s = %d\n", *(s + 20));
    printf("s = %d\n", *(s + 21));
    printf("s = %d\n", *(s + 22));
    printf("s = %d\n", *(s + 23));
    printf("s = %d\n", *(s + 24));
    printf("s = %d\n", *(s + 25));
    printf("s = %d\n", *(s + 26));
    printf("s = %d\n", *(s + 27));
    printf("s = %d\n", *(s + 28));
    printf("s = %d\n", *(s + 29));
    printf("s = %d\n", *(s + 30));
    printf("s = %d\n", *(s + 31));
    printf("s = %d\n", *(s + 32));

    close(fd);
    munmap(p, 4096);
    munmap(q, 4096);
    munmap(r, 4096);
    munmap(s, 4096);
    printf("munmap success\n");
    printf("p = %d\n", p);
    printf("q = %d\n", q);
    printf("r = %d\n", r);
    printf("s = %d\n", s);
    printf("p = %d\n", *p);
    printf("q = %d\n", *q);
    printf("r = %d\n", *r);
    printf("s = %d\n", *s);
    printf("p = %d\n", *(p + 1));
    printf("q = %d\n", *(q + 1));
    printf("r = %d\n", *(r + 1));
    printf("s = %d\n", *(s + 1));
    printf("p = %d\n", *(p + 2));
    printf("q = %d\n", *(q + 2));
    printf("r = %d\n", *(r + 2));
    printf("s = %d\n", *(s + 2));
    printf("p = %d\n", *(p + 3));
    printf("q = %d\n", *(q + 3));
    printf("r = %d\n", *(r + 3));
    printf("s = %d\n", *(s + 3));
    printf("p = %d\n", *(p + 4));
    printf("q = %d\n", *(q + 4));
    printf("r = %d\n", *(r + 4));
    printf("s = %d\n", *(s + 4));
    printf("p = %d\n", *(p + 5));
    printf("q = %d\n", *(q + 5));
    printf("r = %d\n", *(r + 5));
    printf("s = %d\n", *(s + 5));
    printf("p = %d\n", *(p + 6));
    printf("q = %d\n", *(q + 6));
    printf("r = %d\n", *(r + 6));
    printf("s = %d\n", *(s + 6));
    printf("p = %d\n", *(p + 7));
    printf("q = %d\n", *(q + 7));
    printf("r = %d\n", *(r + 7));
    printf("s = %d\n", *(s + 7));
    printf("p = %d\n", *(p + 8));
    printf("q = %d\n", *(q + 8));
    printf("r = %d\n", *(r + 8));
    printf("s = %d\n", *(s + 8));
    printf("p = %d\n", *(p + 9));
    printf("q = %d\n", *(q + 9));
    printf("r = %d\n", *(r + 9));
    printf("s = %d\n", *(s + 9));
    printf("p = %d\n", *(p + 10));
    printf("q = %d\n", *(q + 10));
    printf("r = %d\n", *(r + 10));
    printf("s = %d\n", *(s + 10));
    printf("p = %d\n", *(p + 11));
    printf("q = %d\n", *(q + 11));
    printf("r = %d\n", *(r + 11));
    printf("s = %d\n", *(s + 11));
    printf("p = %d\n", *(p + 12));
    printf("q = %d\n", *(q + 12));
    printf("r = %d\n", *(r + 12));
    printf("s = %d\n", *(s + 12));
    printf("p = %d\n", *(p + 13));
    printf("q = %d\n", *(q + 13));
    printf("r = %d\n", *(r + 13));
    printf("s = %d\n", *(s + 13));
    printf("p = %d\n", *(p + 14));
    printf("q = %d\n", *(q + 14));
    printf("r = %d\n", *(r + 14));
    printf("s = %d\n", *(s + 14));
    printf("p = %d\n", *(p + 15));
    printf("q = %d\n", *(q + 15));
    printf("r = %d\n", *(r + 15));
    printf("s = %d\n", *(s + 15));
    printf("p = %d\n", *(p + 16));
    printf("q = %d\n", *(q + 16));
    printf("r = %d\n", *(r + 16));
    printf("s = %d\n", *(s + 16));

    printf("end\n");

    return 0;
}

 

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称常用语 夸夸
夸夸
还有吗!没看够!
表情代码图片

    暂无评论内容