Пример #1
0
int main(int argc, char *argv[])
{

    byte key[KEY_LEN];
    int i, flag, s;
    t_instance state, state2;

    //Shellcode of /bin//sh
    unsigned char encrypted_shellcode[] = "\xe8\x27\x40\x48\x86\xb8\xd4\x2f\x40\xbf\x78\x0b\x1d\xae\xa4\x34\xad\xda\x8d\xca\xf7\x43\xa5\x3d\x40\x0b";
    int const LEN=sizeof(encrypted_shellcode);

    byte decrypted_shellcode[LEN];

    //Decryption
    check_init_key(argv[1],key);
    key_setup(&state, key);
    cipher(&state, encrypted_shellcode, decrypted_shellcode, sizeof(encrypted_shellcode));


    for (i=0;i<sizeof(encrypted_shellcode);i++)
        printf("\\x%02x", decrypted_shellcode[i]);
    printf("\n");

    int (*ret)() = (int(*)())decrypted_shellcode;
	ret();
}
Пример #2
0
void
desencrypt(uchar data[8], uchar key[7])
{
	ulong ekey[32];

	key_setup(key, ekey);
	block_cipher(ekey, data, 0);
}
Пример #3
0
void x_gui_setup(void)
{
    gfxstub_setup();
    openpanel_setup();
    savepanel_setup();
    key_setup();
    // jsarlo
    magicGlass_setup();
    // end jsarlo
}
Пример #4
0
int
spritz_decrypt(unsigned char *out, const unsigned char *c, size_t clen,
               const unsigned char *nonce, size_t noncelen,
               const unsigned char *key, size_t keylen)
{
    State  state;
    size_t v;

    key_setup(&state, key, keylen);
    absorb_stop(&state);
    absorb(&state, nonce, noncelen);
    for (v = 0; v < clen; v++) {
        out[v] = c[v] - drip(&state);
    }
    memzero(&state, sizeof state);

    return 0;
}
Пример #5
0
Файл: crypt.c Проект: zlxy/plan9
/*
 * destructively encrypt the buffer, which
 * must be at least 8 characters long.
 */
int
encrypt(void *key, void *vbuf, int n)
{
    ulong ekey[32];
    uchar *buf;
    int i, r;

    if(n < 8)
        return 0;
    key_setup(key, ekey);
    buf = vbuf;
    n--;
    r = n % 7;
    n /= 7;
    for(i = 0; i < n; i++) {
        block_cipher(ekey, buf, 0);
        buf += 7;
    }
    if(r)
        block_cipher(ekey, buf - 7 + r, 0);
    return 1;
}
Пример #6
0
int
spritz_auth(unsigned char *out, size_t outlen,
            const unsigned char *msg, size_t msglen,
            const unsigned char *key, size_t keylen)
{
    State         state;
    unsigned char r;

    if (outlen > 255) {
        return -1;
    }
    r = (unsigned char) outlen;
    key_setup(&state, key, keylen);
    absorb_stop(&state);
    absorb(&state, msg, msglen);
    absorb_stop(&state);
    absorb(&state, &r, 1U);
    squeeze(&state, out, outlen);
    memzero(&state, sizeof state);

    return 0;
}
Пример #7
0
Файл: crypt.c Проект: zlxy/plan9
/*
 * destructively decrypt the buffer, which
 * must be at least 8 characters long.
 */
int
decrypt(void *key, void *vbuf, int n)
{
    ulong ekey[128];
    uchar *buf;
    int i, r;

    if(n < 8)
        return 0;
    key_setup(key, ekey);
    buf = vbuf;
    n--;
    r = n % 7;
    n /= 7;
    buf += n * 7;
    if(r)
        block_cipher(ekey, buf - 7 + r, 1);
    for(i = 0; i < n; i++) {
        buf -= 7;
        block_cipher(ekey, buf, 1);
    }
    return 1;
}