Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 05:32

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[How2] Ip to Country Function Using (Blocking IP Blocks)(With C++ Codes.)

Discussion on [How2] Ip to Country Function Using (Blocking IP Blocks)(With C++ Codes.) within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
-TÜRK-'s Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 328
Received Thanks: 434
[How2] Ip to Country Function Using (Blocking IP Blocks)(With C++ Codes.)

This function makes, block by ip by country (With MySQL Table.). With this function, you can blocking country ip's.

OK, Now lets see.

--------------------------------------

First run this query in account database.

PHP Code:
DROP TABLE IF EXISTS `iptocountry`;
CREATE TABLE `iptocountry` (
  `
IP_FROMvarchar(30NOT NULL default '',
  `
IP_TOvarchar(30NOT NULL,
  `
COUNTRY_NAMEvarchar(30NOT NULL,
  
PRIMARY KEY  (`IP_FROM`)
ENGINE=MyISAM DEFAULT CHARSET=latin1
And then, open queried table (iptocountry)

OK now lets add some ip's.

IP_FROM: Beginning of the ip block.
IP_TO: Ending of the ip block.
COUNTRY_NAME: You need add some name... Country name etc.

Here is the example image by me:



### This function tested by me and %100 working. ###

Here is the C++ code (All of this function.)

PHP Code:
int __cdecl add_blocked_country_ip(int a1)
{
  
int v1// eax@1
  
int v2// edx@1
  
char *v3// ecx@1
  
char v4// zf@1
  
int v6// [sp+20h] [bp-8h]@1

  
v1 operator new(8);
  
v6 v1;
  
v2 v1;
  
v3 = *(char **)&s_blocked_ip[4];
  
v4 = *(_DWORD *)&s_blocked_ip[4] == *(_DWORD *)&s_blocked_ip[8];
  *(
_DWORD *)v1 = *(_DWORD *)a1;
  *(
_DWORD *)(v1 4) = *(_DWORD *)(a1 4);
  if ( 
v4 )
  {
    
std__vector_T_BLOCK_IP___std__allocator_T_BLOCK_IP_______M_insert_aux((int)s_blocked_ipv3, (int)&v6);
    
v2 v6;
  }
  else
  {
    if ( 
v3 )
    {
      *(
_DWORD *)v3 v1;
      
v2 v6;
    }
    *(
_DWORD *)&s_blocked_ip[4] = v3 4;
  }
  return 
dev_log(
           (int)
"block_country.cpp",
           
86,
           (int)
"add_blocked_country_ip",
           
2048,
           
"BLOCKED_IP = %u - %u",
           *(
_DWORD *)v2,
           *(
_DWORD *)(v2 4));

2nd. Code Block

PHP Code:
signed int __cdecl is_blocked_country_ip(int arg)
{
  
int v1// eax@2
  
unsigned int v2// ecx@2
  
int v3// ecx@2
  
char v4// t0@2
  
char v5// t1@2
  
signed int result// eax@8
  
int v7// [sp+4h] [bp-24h]@7
  
int v8// [sp+8h] [bp-20h]@7
  
signed int v9// [sp+Ch] [bp-1Ch]@7
  
const char *v10// [sp+10h] [bp-18h]@7
  
int v11// [sp+14h] [bp-14h]@7
  
int v12// [sp+1Ch] [bp-Ch]@1

  
if ( __inet_aton(arg, &v12) )
  {
    
v1 = *(_DWORD *)s_blocked_ip;
    
v3 v12;
    
v4 BYTE1(v3);
    
BYTE1(v3) = v12;
    
LOBYTE(v3) = v4;
    
v2 __ROR__(v316);
    
v5 BYTE1(v2);
    
BYTE1(v2) = v2;
    
LOBYTE(v2) = v5;
    while ( 
v1 != *(_DWORD *)&s_blocked_ip[4] )
    {
      if ( **(
_DWORD **)v1 <= v2 && v2 <= *(_DWORD *)(*(_DWORD *)v1 4) )
      {
        
v11 arg;
        
v10 "BLOCKED_COUNTRY_IP (%s) : YES";
        
v9 16;
        
v8 = (int)"is_blocked_country_ip";
        
v7 128;
        goto 
LABEL_8;
      }
      
v1 += 4;
    }
    
dev_log((int)"block_country.cpp"133, (int)"is_blocked_country_ip"16"BLOCKED_COUNTRY_IP (%s) : NO"arg);
    
result 0;
  }
  else
  {
    
v11 arg;
    
v9 16;
    
v8 = (int)"is_blocked_country_ip";
    
v10 "BLOCKED_COUNTRY_IP (%s) : YES";
    
v7 118;
LABEL_8:
    
dev_log((int)"block_country.cpp"v7v8v9v10v11);
    
result 1;
  }
  return 
result;

3rd. Code Block

PHP Code:
void __cdecl __static_initialization_and_destruction_0(int a1int a2)
{
  
int v2// eax@17
  
int v3// [sp+4h] [bp-34h]@12

  
if ( a2 == 65535 )
  {
    if ( 
a1 == )
    {
      
std__ios_base__Init__Init(&std____ioinit);
      *(
_DWORD *)s_blocked_ip 0;
      *(
_DWORD *)&s_blocked_ip[4] = 0;
      *(
_DWORD *)&s_blocked_ip[8] = 0;
      *(
_DWORD *)s_block_exception 0;
      
v2 std____default_alloc_template_true_0___allocate(0);
      *(
_DWORD *)s_block_exception v2;
      *(
_DWORD *)(v2 4) = 0;
      *(
_DWORD *)v2 0;
      *(
_DWORD *)&s_block_exception[4] = 0;
      *(
_DWORD *)(*(_DWORD *)s_block_exception 8) = *(_DWORD *)s_block_exception;
      *(
_DWORD *)(*(_DWORD *)s_block_exception 12) = *(_DWORD *)s_block_exception;
    }
    if ( !
a1 )
    {
      if ( *(
_DWORD *)&s_block_exception[4] )
      {
        
std___Rb_tree_std__string_std__string_std___Identity_std__string__std__less_std__string__std__allocator_std__string_____M_erase(
          (int)
s_block_exception,
          *(
void **)(*(_DWORD *)s_block_exception 4));
        *(
_DWORD *)(*(_DWORD *)s_block_exception 8) = *(_DWORD *)s_block_exception;
        *(
_DWORD *)(*(_DWORD *)s_block_exception 4) = 0;
        *(
_DWORD *)(*(_DWORD *)s_block_exception 12) = *(_DWORD *)s_block_exception;
        *(
_DWORD *)&s_block_exception[4] = 0;
      }
      
std____default_alloc_template_true_0___deallocate(*(_DWORD *)s_block_exception20);
    }
    if ( 
a2 == 65535 )
    {
      if ( !
a1 )
      {
        if ( (*(
_DWORD *)&s_blocked_ip[8] - *(_DWORD *)s_blocked_ip) >> )
          
std____default_alloc_template_true_0___deallocate(
            *(
_DWORD *)s_blocked_ip,
            
* ((*(_DWORD *)&s_blocked_ip[8] - *(_DWORD *)s_blocked_ip) >> 2));
      }
      if ( 
a2 == 65535 )
      {
        if ( !
a1 )
          
std__ios_base__Init___Init(&std____ioinitv3);
      }
    }
  }

Greetings from turkey
-TÜRK- is offline  
Thanks
13 Users
Old 05/26/2012, 16:49   #2

 
IgorGlock's Avatar
 
elite*gold: 1862
Join Date: Jan 2009
Posts: 3,725
Received Thanks: 7,671
Badboy.

(toll, hat mein Geheimnis verraten -.-)


Viel Spaß bei'm Eintragen der IPs. Wird große Liste sein.
IgorGlock is offline  
Thanks
1 User
Old 05/26/2012, 16:56   #3
 
-TÜRK-'s Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 328
Received Thanks: 434
Quote:
Originally Posted by IgorGlock View Post
Badboy.

(toll, hat mein Geheimnis verraten -.-)


Viel Spaß bei'm Eintragen der IPs. Wird große Liste sein.
What is problem Igor? ... -.- LolBoy...
-TÜRK- is offline  
Old 05/26/2012, 17:23   #4
 
iYoshix3's Avatar
 
elite*gold: 0
Join Date: Jun 2010
Posts: 1,264
Received Thanks: 2,019
hehe, schade
iYoshix3 is offline  
Old 05/26/2012, 17:39   #5
 
elite*gold: 0
Join Date: Oct 2010
Posts: 28
Received Thanks: 3
Why do we need the C++ code?
invisionmt2 is offline  
Old 05/26/2012, 17:45   #6
 
-TÜRK-'s Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 328
Received Thanks: 434
Quote:
Originally Posted by invisionmt2 View Post
Why do we need the C++ code?
Only sharing...
-TÜRK- is offline  
Old 05/26/2012, 18:12   #7
 
elite*gold: 0
Join Date: Feb 2011
Posts: 109
Received Thanks: 162
gameyi nasıl açıp ekleyecez c++ kodlarını
mt2bowded is offline  
Old 05/26/2012, 18:41   #8
 
.Infinity's Avatar
 
elite*gold: 29
Join Date: Jul 2009
Posts: 2,826
Received Thanks: 7,423
It isn't a C++ Source..
This is "C", decompiled with IDA.
.Infinity is offline  
Thanks
3 Users
Old 05/26/2012, 18:46   #9
 
[H]olymind's Avatar
 
elite*gold: 1
Join Date: Jun 2010
Posts: 76
Received Thanks: 192
Für was ist das code ????
[H]olymind is offline  
Old 05/26/2012, 19:55   #10
 
-TÜRK-'s Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 328
Received Thanks: 434
Quote:
Originally Posted by .Infinity View Post
It isn't a C++ Source..
This is "C", decompiled with IDA.
/* This file has been generated by the Hex-Rays decompiler.
Copyright (c) 2009 Hex-Rays <>

Detected compiler: GNU C++
*/
-TÜRK- is offline  
Thanks
1 User
Old 05/26/2012, 20:00   #11
 
ReckLess.'s Avatar
 
elite*gold: 0
Join Date: Dec 2011
Posts: 85
Received Thanks: 192
Quote:
Originally Posted by .Infinity View Post
It isn't a C++ Source..
This is "C", decompiled with IDA.
Dude, just a (C ANSI) pseudo-code
ReckLess. is offline  
Thanks
1 User
Old 05/26/2012, 20:50   #12

 
IgorGlock's Avatar
 
elite*gold: 1862
Join Date: Jan 2009
Posts: 3,725
Received Thanks: 7,671
Das ist schon C++ halt nur "nachgestellt".

Ich bin mir sicher niemand wird das wirklich machen - das mit IP's eintragen.
IgorGlock is offline  
Old 05/26/2012, 20:56   #13

 
elite*gold: 0
Join Date: Feb 2008
Posts: 2,754
Received Thanks: 1,748
Quote:
Originally Posted by IgorGlock View Post
Badboy.

(toll, hat mein Geheimnis verraten -.-)


Viel Spaß bei'm Eintragen der IPs. Wird große Liste sein.
Schon, nur gibts dafür sogar schon vorgefertigte Tabellen.
Einfach einen kleinen Query dafür schreiben der das dann übernimmt und gut ist. Seh ich kein Problem drin.
Zudem muss man ja nicht alles eintragen würd ich mal sagen :]
.. und drauf kommen könnte man eig von alleine.
Hatte mir diese Funktion schon seit ich das erste mal die account-db gesehen hatte gedacht nur gibts in meinen Augen keinen wirklichen Grund das (zumindest nicht auf layer 7) abzufangen.
Computerfreek is offline  
Reply


Similar Threads Similar Threads
All GM-Codes including their function
03/04/2016 - Shaiya Private Server - 85 Replies
Here are the must important GM-codes short and direct!I took some from the 2 guides on e*pvp, from other sites and from my experience. Everything in those signs <> should be replaced and the <> deleted Open the chat and insert one of the following: Moving /bmove <X> <Y> you move to the choosen X coordinate and the choosen Y coordinate /bmove <X> <Y> <M> you move to the choosen X coordinate, the choosen Y coordinate and the choosen map(M) value/ID
[VIP-function] ToxicSYS [VIP-function]
08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies
heeeey E-pvpers :pimp: this is a new hack by TSYS Status : UNDETECTED Functions (VIDEO) : YouTube - WarRock - Bikini event VIP hack
blocking-not blocking ?
02/22/2010 - Kal Online - 1 Replies
hey all , i just wanted to ask you, if gms can get you, if you use storms with cooldowns ? i mean.... is it the same like all other skills , or you can get auto blocked or sth ?i am talking for int server :p plz answer
blocking
02/06/2009 - Silkroad Online - 2 Replies
hey guys one question im wondering if i have a shield br 20 + pasive blader skill br 10+ it makes it 30% out of 100% off all blocks how much does the block rating on weapon decrease the block on my shield when an lets say glaiver with block rating 100(100%9 on glaive attacks me ???
Sub-Function Codes
08/08/2007 - Conquer Online 2 - 2 Replies
Ok, where would i find the sub-function codes, for x and y coords, player names ect. i would like to try my hand at making a specialist program for conquer. so any points in the right direction would be good. like redname/blackname/bluename current coords, my coords, other player coords, monster coords, mining packet ect..



All times are GMT +1. The time now is 05:33.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.