这是什么企图木马code呢? [英] what does this attempted trojan horse code do?

查看:129
本文介绍了这是什么企图木马code呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它看起来像这样只是发送一条平,但什么的地步时,你可以用ping?

  / *警告:这是在写一个恶意木马别人的企图。不要
   编译和* *绝对不要安装。我增加了一个退出的
   第一行,以避免事故 - MSW * /
INT主(INT ARGC,CHAR *的argv [])
{
    出口(1);
    unsigned int类型的pid = 0;
    炭缓冲液[2];
    字符* ARGS [] = {
        /斌/平,
        -C,
        5,
        空值,
        空值
    };    如果(的argc!= 2)
        返回0;    ARGS [3] =的strdup(的argv [1]);
    为(;;)
    {
        得到(缓冲); / * * FTW /        如果(缓冲[0] == 0x6e)
            打破;        开关(PID =叉())
        {
            情况1:
                的printf(错误分叉\\ n);
                出口(255);
            情况下0:
                execvp(参数[0],参数);
                出口(1);
            默认:
                打破;
        }
    }
    返回255;
}


解决方案

这确保了被调用的参数 -c 5 。这是愚蠢的,因为一个shell脚本或别名会更容易阅读和快写。

It looks like this just sends a ping, but whats the point of that when you can just use ping?

/* WARNING: this is someone's attempt at writing a malware trojan. Do not
   compile and *definitely* don't install. I added an exit as the
   first line to avoid mishaps - msw */
int main (int argc, char *argv[])
{
    exit(1);
    unsigned int pid = 0;
    char buffer[2];
    char *args[] = {
        "/bin/ping",
        "-c",
        "5",
        NULL,
        NULL
    };

    if (argc != 2)
        return 0;

    args[3] = strdup(argv[1]);
    for (;;)
    {
        gets(buffer); /* FTW */

        if (buffer[0] == 0x6e)
            break;

        switch (pid = fork())
        {
            case -1:
                printf("Error Forking\n");
                exit(255);
            case 0:
                execvp(args[0], args);
                exit(1);
            default:
                break;
        }
    }
    return 255;
}

解决方案

It makes sure that ping is called with the arguments -c 5. Which is stupid, because a shell script or alias would be easier to read and faster to write.

这篇关于这是什么企图木马code呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆