what does this attempted trojan horse code do?

Posted by bstullkid on Stack Overflow See other posts from Stack Overflow or by bstullkid
Published on 2010-05-22T16:52:19Z Indexed on 2010/05/22 17:30 UTC
Read the original article Hit count: 271

Filed under:
|

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;
}

© Stack Overflow or respective owner

Related posts about c

    Related posts about malware