Raised This Month: $ Target: $400
 0% 

Sending Packets... help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 11-16-2009 , 21:05   Sending Packets... help
Reply With Quote #1

Hi, I am creating some aplications for HLDS... Ej: Ftpd Server, A Remote chat for every one.., etc...
Well. So I send all the information by sockets.
I create this easy way to pack the info and send it....

Well the simple question...
Is a better options??

PHP Code:
#define _CRT_SECURE_NO_WARNINGS

#include< stdio.h >
#include< stdlib.h >
#include< string.h >

#include "md5.h"

char *createPacket( const char *sender, const char *password, const char *msg );
void uncreatePacket( const char *packetchar *senderchar *md5passwordchar *msg );

int main()
{
    
char *print = createPacket("ReymonARG""micontraseņa""Hola este es un mensaje feliz..");

    for( 
size_t i 0strlen(print) ; i++ )
        
printf("%c", print[i] );
    
    
printf("\n\n");

    
char user[32];
    
char password[33];
    
char msg[160];

    
uncreatePacket(print, userpasswordmsg);

    
printf("User: %s Pass: %s Msg: %s\n\n"userpasswordmsg);

    
system("pause");
    return 
0;
}

char *createPacket( const char *sender, const char *password, const char *msg )
{
    static 
char buffer[200]; // Max msg is 192. - md5 - stupids byts..
    
char md5password[33];

    
char *msgsend = new char[strlen(msg)];

    
int klen _snprintf(msgsend160"%s"msg);
    
msgsend[klen] = '\0';

    
MD5 md5;
    
md5.update((unsigned char *)passwordstrlen(password));
    
md5.finalize();
    
md5.hex_digest(md5password);

    
int len _snprintf(buffersizeof(buffer), "%c%c%c%c%c%c%s%c%c%s%c%c%s%c%c%s%c", -1,strlen(sender), -1strlen(msgsend), -1, -1sender, -1,-1md5password, -1, -1msgsend, -1);

    
buffer[len] = '\0';
    return 
buffer;
}

void uncreatePacket( const char *packetchar *senderchar *md5passwordchar *msg )
{
    
size_t senderlen static_castint >( packet[1] );
    
size_t msglen static_castint >( packet[3] );

    for( 
size_t i 0senderleni++ )
    {
        
sender[i] = packet[i+6];
    }
    
sender[senderlen] = '\0';

    for( 
size_t i 033i++ )
    {
        
md5password[i] = packet[i+8+senderlen];
    }
    
md5password[32] = '\0';

    for( 
size_t i 0msgleni++ )
    {
        
msg[i] = packet[i+42+senderlen];
    }
    
msg[msglen] = '\0';

    return;

md5.h is the same that is in amxmodx module....


Thanks...
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-16-2009 , 21:27   Re: Sending Packets... help
Reply With Quote #2

You could look at RC4ing it, xoring it, using named pipes.. ect..

I must ask, what is this "Advanced Chat Program" exactly? heh.
Styles is offline
Send a message via AIM to Styles
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 11-16-2009 , 21:36   Re: Sending Packets... help
Reply With Quote #3

Quote:
Originally Posted by Styles View Post
I must ask, what is this "Advanced Chat Program" exactly? heh.
Register users can conect to a listen port in the HLDS Server.
I Create a Little Program in VC++ that is like HLSW Rcon Chat, but for many users...

Thanks for you information..
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-16-2009 , 22:40   Re: Sending Packets... help
Reply With Quote #4

heh, be careful with what information your compiling into your application.. Also, for future reference. I'd try making the client in C# and then the server in C++.

Why? C++ You can make it cross-platform compatible. And with C# it's much faster to create GUI's and do this in general.. Downfall is you can reverse it very easy. I'd obfuscate it if I were you but still can be reversed.
Styles is offline
Send a message via AIM to Styles
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 11-17-2009 , 11:03   Re: Sending Packets... help
Reply With Quote #5

Quote:
Originally Posted by Styles View Post
heh, be careful with what information your compiling into your application.. Also, for future reference. I'd try making the client in C# and then the server in C++.

Why? C++ You can make it cross-platform compatible. And with C# it's much faster to create GUI's and do this in general.. Downfall is you can reverse it very easy. I'd obfuscate it if I were you but still can be reversed.
Is I am leaning C# with .NET...
If I have to make GUI Aplicattions that new many thinks I do with VB and a .dll in C++.

But now I start to read some books that I have from C#...

Again. Thanks
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode