Host Ban

All Helbreath Server Source Discussion here.
Post Reply
sokol
Loyal fan
Posts: 228
Joined: Mon May 02, 2005 7:28 pm
Location: P(r)oland

Post by sokol »

Hi, its possible to ban someone in his host not only ip ? coz its sux if u ban someone for hack he come back with new ip and just laughting coz has dynamic ip. Maybe is other way to ban dynamic ips, anyone know?
Slayer
<3 bd long time
Posts: 947
Joined: Thu Mar 17, 2005 9:08 pm

Post by Slayer »

ban his range, like 123.123.*.*, where * stands for 'all'.
<img src='http://i9.tinypic.com/2vs292h.jpg' border='0' alt='user posted image' />
Jensen
Loyal fan
Posts: 300
Joined: Tue Aug 02, 2005 7:40 am
Location: Illinois, USA
Contact:

Post by Jensen »

well looking at the banned list struct

Code: Select all

struct {
  char m_cBannedIPaddress[21];   // Ŭ¶óÀ̾ðÆ®ÀÇ IP address
	} m_stBannedList[DEF_MAXBANNED];
how its copyed from the file thats a list

Code: Select all

ZeroMemory(m_stBannedList[iIndex].m_cBannedIPaddress, sizeof(m_stBannedList[iIndex].m_cBannedIPaddress));
      memcpy(m_stBannedList[iIndex].m_cBannedIPaddress, token, strlen(token));
and how its compared to the client ip to see if their banned

Code: Select all

for (i = 0; i < DEF_MAXBANNED; i++) {
  if(strlen(m_stBannedList[i].m_cBannedIPaddress) == 0) break; //No more GM's on list
  if ((strlen(m_stBannedList[i].m_cBannedIPaddress)) == (strlen(m_pClientList[iClientH]->m_cIPaddress))) {
  	if(memcmp(m_stBannedList[i].m_cBannedIPaddress, m_pClientList[iClientH]->m_cIPaddress, strlen(m_pClientList[iClientH]->m_cIPaddress)) == 0){
    wsprintf(G_cTxt,"Client Rejected: Banned: (%s)", m_pClientList[iClientH]->m_cIPaddress);
    PutLogList(G_cTxt);
    return FALSE;
  	}
  	else {

  	}
  }
	}
that last part only checks if the ip's are of equivilant length

you might be interested in something sortof like this

Code: Select all

else if(m_stBannedList[i].m_cBannedIPaddress[(strlen(m_stBannedList[i].m_cBannedIPaddress))-1] == '*'){
  	if(memcmp(m_stBannedList[i].m_cBannedIPaddress, m_pClientList[iClientH]->m_cIPaddress, strlen(m_stBannedList[i].m_cBannedIPaddress)-1) == 0){
    wsprintf(G_cTxt,"Client Rejected: Banned: (%s)", m_pClientList[iClientH]->m_cIPaddress);
    PutLogList(G_cTxt);
    return FALSE;
  	}
  }
	}
just incase the lengths arnt equal, and the last char of the ip address string is a * it will compare everything before it then go from there

(not tested but it does compile, assuming im not a noob and wrote it right it should work)
-><-
Post Reply