I took this C function from the decompiling (F5) option on IDA.
I want to use it in my Python program, how can I do this in the easiest way?
__int64 __fastcall manipulateBeforSend(__int64 a1, int a2)
{
int v2; // w0
__int64 result; // x0
int i; // [xsp+1Ch] [xbp-4h]
for ( i = 0; i < a2 - 3; i += 4 )
*(_DWORD *)(a1 + 4LL * (i / 4)) ^= 0xDEAD1337;// leet? XOR
while ( 1 )
{
result = (unsigned int)a2;
if ( i >= a2 )
break;
LOBYTE(v2) = i & 3;
if ( i <= 0 )
v2 = -(-i & 3);
*(_BYTE *)(a1 + i++) ^= 0xDEAD1337 >> 8 * v2;
}
return result;
}
@Marco Bonelli, you help me a lot, Thanks! But I keep get those errors:
manipulate.c:1:0: warning: -fPIC ignored for target (all code is position independent)
#include <stdint.h>
^
In file included from C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:10:0,
from C:/TDM-GCC-64/x86_64-w64-mingw32/include/stdint.h:28,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/stdint.h:9,
from manipulate.c:1:
manipulate.c:4:17: error: two or more data types in declaration specifiers
typedef int64_t __int64;
^
manipulate.c:4:17: error: two or more data types in declaration specifiers
typedef int64_t __int64;
^
manipulate.c:4:1: warning: useless type name in empty declaration
typedef int64_t __int64;
^