Formatting

This commit is contained in:
Catatonic Prime 2016-11-13 20:37:35 +00:00
commit 0c2e02135d

View file

@ -15,7 +15,7 @@ extern int blockDecrypt(cipherInstance *cipher, keyInstance *key,CONST BYTE *inp
//RAdmin 2.x
struct rmessage{
struct rmessage {
char magic; //Indicates version, probably?
unsigned int length; //Total message size of data.
unsigned int checksum; //Checksum from type to end of data.
@ -24,12 +24,12 @@ struct rmessage{
};
/*
* Usage: sum = checksum(message);
* Function: Returns a 4 byte little endian sum of the messages typecode+data. This data is zero padded for alignment.
* Example message (big endian):
* [01][00000021][0f43d461] sum([1b6e779a f37189bb c1b22982 c80d1f4d 66678ff9 4b10f0ce eabff6e8 f4fb8338 3b] + zeropad(3)])
* Sum: is 0f43d461 (big endian)
*/
* Usage: sum = checksum(message);
* Function: Returns a 4 byte little endian sum of the messages typecode+data. This data is zero padded for alignment.
* Example message (big endian):
* [01][00000021][0f43d461] sum([1b6e779a f37189bb c1b22982 c80d1f4d 66678ff9 4b10f0ce eabff6e8 f4fb8338 3b] + zeropad(3)])
* Sum: is 0f43d461 (big endian)
*/
unsigned int checksum(struct rmessage *msg) {
int blen;
unsigned char *stream;
@ -55,9 +55,9 @@ unsigned int checksum(struct rmessage *msg) {
}
/*
* Usage: challenge_request(message);
* Function: Modifies message to reflect a request for a challenge. Updates the checksum as appropriate.
*/
* Usage: challenge_request(message);
* Function: Modifies message to reflect a request for a challenge. Updates the checksum as appropriate.
*/
void challenge_request(struct rmessage *msg) {
msg->magic = 0x01;
msg->length = 0x01;
@ -66,9 +66,9 @@ void challenge_request(struct rmessage *msg) {
}
/*
* Usage: challenge_request(message);
* Function: Modifies message to reflect a response to a challenge. Updates the checksum as appropriate.
*/
* Usage: challenge_request(message);
* Function: Modifies message to reflect a response to a challenge. Updates the checksum as appropriate.
*/
void challenge_response(struct rmessage *msg, unsigned char *solution) {
msg->magic = 0x01;
msg->length = 0x21;
@ -78,9 +78,9 @@ void challenge_response(struct rmessage *msg, unsigned char *solution) {
}
/*
* Usage: buffer = message2buffer(message); send(buffer, message->length + 10); free(buffer)
* Function: Allocates a buffer for transmission and fills the buffer with message data such that it is ready to transmit.
*/
* Usage: buffer = message2buffer(message); send(buffer, message->length + 10); free(buffer)
* Function: Allocates a buffer for transmission and fills the buffer with message data such that it is ready to transmit.
*/
//TODO: conver to a sendMessage() function?
char *message2buffer(struct rmessage *msg) {
char *data;
@ -208,6 +208,7 @@ void service_radmin2(char *ip, int sp, unsigned char options, char *miscptr, FIL
return;
}
while(1) {
// Get a password to work with.
strncpy(password, hydra_get_next_password(), 101);
MD5_Init(&md5c);
@ -319,11 +320,20 @@ void service_radmin2(char *ip, int sp, unsigned char options, char *miscptr, FIL
}
}
msg = buffer2message(buffer);
if(msg->type == 0x0a) {
switch(msg->type) {
case 0x0a:
hydra_completed_pair_found();
}
//5) Disconnect
break;
case 0x0b:
hydra_completed_pair();
hydra_disconnect(sock);
break;
default:
hydra_report(stderr, "Error: Child with pid %d terminating, protocol error\n", (int)getpid());
hydra_child_exit(2);
}
}
}
int service_radmin2_init(char *ip, int sp, unsigned char options, char *miscptr, FILE * fp, int port, char *hostname) {