Thanks for the help after some time I managed to make a working (?) one.
Anyhow, this is what i've made.
Code:
function ventrilo_first_enc(&$data) {
$first = "\xAA\x55\x22\xCC\x69\x7C\x38\x91\x88\xF5\xE1";
$first = str_split($first);
$len = strlen($data);
for($i=0;$i<$len;$i++) {
$data{$i} = chr(ord($data{$i}) + ord($first[$i % 11]) + ($i % 27));
}
}
$buf = "\x00\x00\x00\x00\x32\x2e\x33\x2e\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x62\x42\x51\x36\x4c\x54\x71\x53\x6f\x71\x58\x72\x74\x64\x4f\x6c\x53\x48\x66\x75\x44\x46\x44\x39\x68\x32\x4b\x53\x68\x34\x00\x5a\x73\x6a\x35\x4c\x32\x66\x48\x34\x63\x76\x56\x6d\x7a\x7a\x5a\x52\x38\x6f\x52\x45\x74\x73\x6f\x72\x37\x38\x63\x56\x55\x6f\x00";
ventrilo_first_enc($buf);
When I send $buf to a ventrilo server this is whats sent. (sniffed with ethereal)
Code:
char peer0_0[] = {
0xaa, 0x56, 0x24, 0xcf, 0x9f, 0xaf, 0x71, 0xc6,
0xc0, 0xfe, 0xeb, 0xb5, 0x61, 0x2f, 0xda, 0x78,
0x8c, 0x49, 0xa3, 0x9b, 0x4d, 0x58, 0x02, 0xbd,
0x70, 0x31, 0xd7, 0xed, 0x8c, 0x02, 0xfc, 0x51,
0x58, 0x24, 0xc0, 0x79, 0x41, 0xc6, 0xcf, 0xaa,
0x13, 0xda, 0x4a, 0x35, 0xf4, 0xcf, 0x67, 0x2b,
0xd1, 0xfa, 0x83, 0xa9, 0xfb, 0x82, 0x4b, 0xe0,
0xa3, 0x57, 0x36, 0xb6, 0xb6, 0xa2, 0x0f, 0xe7,
0x6c, 0x66, 0x30, 0xbc, 0x82, 0x13, 0xe8, 0xdf,
0x8f, 0x18, 0x0f, 0x79, 0x69, 0xf8, 0xa5, 0x9e,
0x3c, 0xbe, 0xec, 0x3a };
Im getting no response whatsoever here.
I've also tried to compare the data with your function in C++Code:
void ventrilo_first_enc(char *data, int size) {
const static unsigned char first[] = "\xAA\x55\x22\xCC\x69\x7C\x38\x91\x88\xF5\xE1";
int i;
for(i = 0; i < size; i++) {
*data += first[i % 11] + (i % 27);
data++;
}
}
char buf[] = "\x00\x00\x00\x00\x32\x2e\x33\x2e\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x44\x62\x42\x51\x36\x4c\x54\x71\x53\x6f\x71\x58\x72\x74\x64\x4f\x6c\x53\x48\x66\x75\x44\x46\x44\x39\x68\x32\x4b\x53\x68\x34\x00\x5a\x73\x6a\x35\x4c\x32\x66\x48\x34\x63\x76\x56\x6d\x7a\x7a\x5a\x52\x38\x6f\x52\x45\x74\x73\x6f\x72\x37\x38\x63\x56\x55\x6f\x00";
ventrilo_first_enc(buf,sizeof(buf));
This is what i get when I once again sniff the data sent:
Code:
char peer0_0[] = {
0xaa, 0x56, 0x24, 0xcf, 0x9f, 0xaf, 0x71, 0xc6,
0xc0, 0xfe, 0xeb, 0xb5, 0x61, 0x2f, 0xda, 0x78,
0x8c, 0x49, 0xa3, 0x9b, 0x4d, 0x58, 0x02, 0xbd,
0x70, 0x31, 0xd7, 0xed, 0x8c, 0x02, 0xfc, 0x51,
0x58, 0x24, 0xc0, 0x79, 0x41, 0xc6, 0xcf, 0xaa,
0x13, 0xda, 0x4a, 0x35, 0xf4, 0xcf, 0x67, 0x2b,
0xd1, 0xfa, 0x83, 0xa9, 0xfb, 0x82, 0x4b, 0xe0,
0xa3, 0x57, 0x36, 0xb6, 0xb6, 0xa2, 0x0f, 0xe7,
0x6c, 0x66, 0x30, 0xbc, 0x82, 0x13, 0xe8, 0xdf,
0x8f, 0x18, 0x0f, 0x79, 0x69, 0xf8, 0xa5, 0x9e,
0x3c, 0xbe, 0xec, 0x3a, 0x94 };
Its exactly the same except for that 0x94 in the end (why?) but im still getting no respone whatsoever from the server.
Basically im trying to create a SIMPLE Ventrilo-bot in php for learning purposes. But since my knowledge in C/C++ is very limited its quite hard to follow your source from ventrcon.
Right now im trying to send this piece of code encrypted with the ventrilo protocol and since im running a server with version 2.1.2 im hoping to get an answer back telling me that the server is running a different version.
Code:
00 00 00 00 32 2e 33 2e 30 00 00 00 00 00 00 00 ....2.3.0.......
00 00 00 00 44 62 42 51 36 4c 54 71 53 6f 71 58 ....DbBQ6LTqSoqX
72 74 64 4f 6c 53 48 66 75 44 46 44 39 68 32 4b rtdOlSHfuDFD9h2K
53 68 34 00 5a 73 6a 35 4c 32 66 48 34 63 76 56 Sh4.Zsj5L2fH4cvV
6d 7a 7a 5a 52 38 6f 52 45 74 73 6f 72 37 38 63 mzzZR8oREtsor78c
56 55 6f 00 VUo.
I really appreciate your help!