Example #1
0
int main()
{
	printf("A858 Tools 0.0.1 by gregalerna, 2015. Mode 0 to decrypt given key.\nMode 1 to find out IV given method and key. Select mode (0/1)\n");//intro
	scanf("%s", &character);//select mode
	if (character == '1') { printf("Try to brute force IV? (y/n)\n");scanf("%s", &character);if (character != 'y') { return 0; }	printf("Key: ");scanf("%s", &pass); printf("Method: "); scanf("%s", &variety);decrypt1(); }
	else {//mode 0
		printf("Try to decypt data.bin? (y/n)\n");
		scanf("%s", &character);
		if (character != 'y') { return 0; }
		printf("Key: ");
		scanf("%s", &pass);
		decrypt0();
	}
	fclose(data);//close data.bin
	fclose(output);//close output.bin
	if (success == true && mode1==false) { printf("Decryption successful with %s\n",middleCommand); }
	if (mode1==true){ printf("Possible IV was %s\n", stringiv); }
	if(mode1==false &&success==false) { printf("Decryption failed with OpenSSL\n"); }
	return 0;
}
Example #2
0
static int decrypt(lua_State *L)
{
    //读取第一个参数
    size_t bufferSize = 0;
    const char* buffer = lua_tolstring(L, 1, &bufferSize);

    size_t keySize = 0;
    const char* keys = lua_tolstring(L, 2, &keySize);

    //解码
    byte* out = (byte *)malloc(bufferSize+1);
    int outSize = decrypt0((byte*)buffer, (int)bufferSize, (byte*)keys, (int)keySize, out, 0);
    out[outSize] = '\0';	//写入结束符


    //返回数据
    //lua_pushfstring(L, (const char*)out);
    lua_pushlstring(L, (const char*)out, bufferSize);

    //释放内存
    free(out);
    return 1;
}