Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Telnet strings?


ghost's Avatar
0 0

I'm trying to make a basic telnet login just to test out my socket programming, which I just started today…

And the problem I'm having is comparing the entered password to a password I'm checking for…

The code (some of it anyway) is:

	len = strlen(msg);
	bytes_sent = send( new_fd, msg, len, 0 );

	len = 20;
	bytes_recv = recv( new_fd, buf, len, 0 );
	
	if ( !strcmp( buf, "Pass123" ) )
	{
		msg = "\n\nCongratulations!";
		bytes_sent = send( new_fd, msg, len, 0 );
	}
	else
	{
		msg = "\n\nWrong :P";
		bytes_sent = send( new_fd, msg, len, 0 );
	}

And the problem is that when I type "Pass123" into telnet it's length is 9 characters, where the string itself is only 7, so it fails…

What are these extra characters and how to get around them ( or do I just add them to my password string? )


ghost's Avatar
0 0

Never mind I got it… But since I can't delete the post I'll just add this…

And the solution was that there was a carriage return and then newline at the end of the string.