Some info about rockey for who needs to parse usbtrace logs
2 posters
Page 1 of 1
Some info about rockey for who needs to parse usbtrace logs
Decryption routines of R4 series. Reading its SDK is a must for the rest.
Should I write a complete tutorial? A whole parser?
char command[25];
char response[25];
/*command and response arrays are from usb trace logs. You can find them after ** data ** lines. They must be 24 bytes long
char KEY=command[2];
processCommand(command[]);
processResponse(response[])
void processCommand(command[])
{
g(&command[0x9], &command[0x11]); // for r4 smart only
g(&command[0x2], &command[0x11]); // for r4 smart only
for (int i = 2; i < 25; i++) { command[i] ^= KEY; }
for (int i = 0; i < 25; i++) { printf("%02X ", command[i]); }
}
void processResponse(response[])
{
f(&response[0x9], &response[0x11]); // for r4 smart only
f(&response[0x2], &response[0x11]); // for r4 smart only
for (int i = 2; i < 25; i++) { command[i] ^= KEY; }
for (int i = 0; i < 25; i++) { printf("%02X ", command[i]); }
}
int f(BYTE *P, BYTE *Q) // decryption from dongle/encryption in pc
{
__asm
{
pushad
mov edx, P
mov edi, Q
mov ebp, edi
xor ecx, ecx
sub ebp, edx
loop_i :
xor eax, eax
loop_j :
mov bl, cl
or bl, al
add bl, [eax + edi]
inc eax
add[edx], bl
cmp eax, 8
jl short loop_j
xor esi, esi
loop_k :
mov al, [esi + edi]
dec al
imul cl
xor[edx], al
inc esi
cmp esi, 8
jl short loop_k
mov al, [edx + ebp]
shl al, cl
inc ecx
inc edx
xor[edx - 1], al
cmp ecx, 8
jl short loop_i
popad
}
// Return with result in EAX
}
int g(BYTE *P, BYTE *Q) // decryption from pc, encryption in dongle
{
__asm
{
pushad
mov edx, P
mov edi, Q
mov ebp, edi
xor ecx, ecx
sub ebp, edx
loop_i :
mov al, [edx + ebp]
shl al, cl
xor[edx], al
xor esi, esi
loop_k :
mov al, [esi + edi]
dec al
imul cl
xor[edx], al
inc esi
cmp esi, 8
jl short loop_k
xor eax, eax
loop_j :
mov bl, cl
or bl, al
add bl, [eax + edi]
inc eax
sub[edx], bl
cmp eax, 8
jl short loop_j
inc ecx
inc edx
cmp ecx, 8
jl short loop_i
popad
}
// Return with result in EAX
}
Should I write a complete tutorial? A whole parser?
char command[25];
char response[25];
/*command and response arrays are from usb trace logs. You can find them after ** data ** lines. They must be 24 bytes long
char KEY=command[2];
processCommand(command[]);
processResponse(response[])
void processCommand(command[])
{
g(&command[0x9], &command[0x11]); // for r4 smart only
g(&command[0x2], &command[0x11]); // for r4 smart only
for (int i = 2; i < 25; i++) { command[i] ^= KEY; }
for (int i = 0; i < 25; i++) { printf("%02X ", command[i]); }
}
void processResponse(response[])
{
f(&response[0x9], &response[0x11]); // for r4 smart only
f(&response[0x2], &response[0x11]); // for r4 smart only
for (int i = 2; i < 25; i++) { command[i] ^= KEY; }
for (int i = 0; i < 25; i++) { printf("%02X ", command[i]); }
}
int f(BYTE *P, BYTE *Q) // decryption from dongle/encryption in pc
{
__asm
{
pushad
mov edx, P
mov edi, Q
mov ebp, edi
xor ecx, ecx
sub ebp, edx
loop_i :
xor eax, eax
loop_j :
mov bl, cl
or bl, al
add bl, [eax + edi]
inc eax
add[edx], bl
cmp eax, 8
jl short loop_j
xor esi, esi
loop_k :
mov al, [esi + edi]
dec al
imul cl
xor[edx], al
inc esi
cmp esi, 8
jl short loop_k
mov al, [edx + ebp]
shl al, cl
inc ecx
inc edx
xor[edx - 1], al
cmp ecx, 8
jl short loop_i
popad
}
// Return with result in EAX
}
int g(BYTE *P, BYTE *Q) // decryption from pc, encryption in dongle
{
__asm
{
pushad
mov edx, P
mov edi, Q
mov ebp, edi
xor ecx, ecx
sub ebp, edx
loop_i :
mov al, [edx + ebp]
shl al, cl
xor[edx], al
xor esi, esi
loop_k :
mov al, [esi + edi]
dec al
imul cl
xor[edx], al
inc esi
cmp esi, 8
jl short loop_k
xor eax, eax
loop_j :
mov bl, cl
or bl, al
add bl, [eax + edi]
inc eax
sub[edx], bl
cmp eax, 8
jl short loop_j
inc ecx
inc edx
cmp ecx, 8
jl short loop_i
popad
}
// Return with result in EAX
}
mardasmr- Posts : 35
Points : 51
Reputation : -10
Join date : 2017-02-23
Re: Some info about rockey for who needs to parse usbtrace logs
please do, but be careful who you share your work, you might find it for sale, not from you.
ovis25- Posts : 648
Points : 1234
Reputation : 332
Join date : 2014-06-07
Re: Some info about rockey for who needs to parse usbtrace logs
Thanks for warning, I ll do nothing about it. Keep it myself. Thanksovis25 wrote:please do, but be careful who you share your work, you might find it for sale, not from you.
mardasmr- Posts : 35
Points : 51
Reputation : -10
Join date : 2017-02-23
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|