Gnutella Forums  

Go Back   Gnutella Forums > Current Gnutella Client Forums > GnucDNA Based Clients > Gnucleus (Windows)
Register FAQ The Twelve Commandments Members List Calendar Arcade Find the Best VPN Today's Posts

Gnucleus (Windows) For assistance for users with the Gnucleus program. Important links: Updated Gnucleus 2.2.0.0 Installer! and also Updated Connection Caches for Gnucleus!


 
 
LinkBack Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2 (permalink)  
Old March 12th, 2002
Unregistered
Guest
 
Posts: n/a
Default

Here it is, simply replace CGnuNode::ParseHandshake in the file "GnuNode.cpp" with the following and recompile! Add as many checks as you like for each $$$ client you would like to block. (4 total lines, two places to check the connect strings, added to the original code, see below)

Code:
/////////////////////////////////////////////////////////////////////////////
// New connections

bool CGnuNode::ParseHandshake(CString Data, byte* Stream, int StreamLength)
{
	int i;
	CString Handshake;
	CString NetworkName = m_pDoc->ModeNetwork;
	bool	Guerilla = false;

	// Making an inbound connect
	if(m_Inbound)
	{
		// Version 6
		if(Data.Find("\r\n\r\n") != -1)
		{
			Handshake = Data.Mid(0, Data.Find("\r\n\r\n") + 4);
			m_Handshake += Handshake;

			if(m_Handshake.Find("GUERILLA ") != -1)
			{
				NetworkName = "GUERILLA";
				Guerilla    = true;
			}

			// keep any BS off my screen
			if(Handshake.Find("BearShare") != -1) { Close(); return true; }


			// Connect string, GNUTELLA CONNECT/0.6\r\n
			if(Handshake.Find(NetworkName + " CONNECT/") != -1)
			{
				if(m_pPrefs->m_NetworkModel == NETWORK_PRIVATE && m_pPrefs->m_Lan)
					if(Handshake.Find("LAN: " + m_pPrefs->m_LanName + "\r\n") == -1)
					{
						Close();
						return true;
					}

				Send_ConnectOK(true, false, Guerilla);

				return true;
			}

			// Ok string, GNUTELLA/0.6 200 OK\r\n
			else if(Handshake.Find(" 200 OK\r\n") != -1)
			{
				SetConnected();

				// Stream begins
				for(i = 0; i < StreamLength - 4; i++)
					if(strncmp((char*) &Stream[i], "\r\n\r\n", 4) == 0)
					{
						m_dwExtraLength = StreamLength - (i + 4);
						memcpy(m_pExtra, &Stream[i + 4], m_dwExtraLength);
					}

				return true;
			}
		}

		// Version 4
		else if(Data.Find(VERSION_4_CONNECT) != -1 && !m_pPrefs->m_Lan)
		{
			m_Handshake += "GNUTELLA CONNECT/0.4\r\n";

			Send_ConnectOK(false, false, false);
			SetConnected();

			return true;
		}
	}

	// Making an outbound connect
	else
	{
		if((m_pDoc->ModeVersion6 || m_pPrefs->m_NetworkModel == NETWORK_PRIVATE) && Data.Find("\r\n\r\n") != -1)
		{
			Handshake = Data.Mid(0, Data.Find("\r\n\r\n") + 4);
			m_Handshake += Handshake;

			// Ok string, GNUTELLA/0.6 200 OK\r\n
			if(Handshake.Find(" 200 OK\r\n") != -1)
			{

			// keep any BS off my screen
			if(Handshake.Find("BearShare") != -1) { Close(); return true; }


				// Check if remote host has our IP
				int ipPos = Handshake.Find("Remote-IP: ");
				if(ipPos != -1)
				{
					ipPos  += 11;
					int ipBack = Handshake.Find("\r\n", ipPos);

					m_pPrefs->m_LocalHost = StrtoIP( Handshake.Mid(ipPos, ipBack - ipPos));
				}


				if(m_pPrefs->m_NetworkModel == NETWORK_PRIVATE && m_pPrefs->m_Lan)
					if(Handshake.Find("LAN: " + m_pPrefs->m_LanName + "\r\n") == -1)
					{
						Close();
						return true;
					}

				Send_ConnectOK(true, true, false);

				SetConnected();
			}
			else
				Close();

			return true;
		}
		else if(Data.Find(VERSION_4_CONNECT_OK) != -1)
		{
			m_Handshake += "GNUTELLA OK\r\n";

			// Stream begins
			for(i = 0; i < StreamLength - 2; i++)
				if(strncmp((char*) &Stream[i], "\n\n", 2) == 0)
				{
					m_dwExtraLength = StreamLength - (i + 2);
					memcpy(m_pExtra, &Stream[i + 2], m_dwExtraLength);
				}

			SetConnected();

			return true;
		}
	}

	return false;
}
Reply With Quote
 


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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Re: Vinnie, You have no excuse Unregistered Site Feedback 0 July 6th, 2002 11:23 AM
Vinnie vs. Morgwen??? Morgwen General Gnutella / Gnutella Network Discussion 21 December 30th, 2001 06:22 AM
Vinnie kills Phex, mad as hell Unregistered Gnucleus (Windows) 0 July 16th, 2001 11:17 AM
*Vinnie... Unregistered BearShare Open Discussion 2 May 25th, 2001 11:09 AM


All times are GMT -7. The time now is 03:52 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright Đ 2020 Gnutella Forums.
All Rights Reserved.