Test Foro de elhacker.net SMF 2.1

Programación => Scripting => Mensaje iniciado por: Eleкtro en 13 Noviembre 2012, 16:42 PM

Título: [RUBY] GameTracker ServerList
Publicado por: Eleкtro en 13 Noviembre 2012, 16:42 PM
  (http://www.nos.clanservers.com/images/gametracker.png)

 GameTracker Server List
 By Elektro H@cker


La idea de Doddy me ha inspirado para crear este script el cual se puede usar por línea de comandos o de forma preconfigurada.
Referencia de la idea de Doddy:  [Perl] Counter Strike 1.6 Servers List  (http://foro.elhacker.net/scripting/perl_counter_strike_16_servers_list-t375873.0.html)

(http://img204.imageshack.us/img204/4318/captura3j.png)

(http://img707.imageshack.us/img707/1717/captura4g.png)






GTSL.rb help
(Muestra los valores de "games" y "locations".)

GTSL.rb (game) (location) (archivo)
(Obtiene todos los servidores del juego "game" del país "location" y los guarda en el archivo "archivo")

O cambiar los dos valores por defecto del script, "game" y "location".


:
GTSL.rb cs es
(Obtiene todos los servidores españoles del Counter-Strike 1.6 y los guarda en el archivo por defecto "cs-ES servers.txt")

GTSL.rb cs uk "servidores UK.txt"
(Obtiene todos los servidores ingleses del Counter-Strike 1.6 y los guarda en el archivo "servidores UK.txt")







 alienswarm    = Alien Swarm
 aa    = America's Army 2.0
 aa3   = America's Army 3
 arma2 = ARMA 2
 arma  = ArmA Armed Assault
 bf1942        = Battlefield 1942
 bf2   = Battlefield 2
 bf2142        = Battlefield 2142
 bf3   = Battlefield 3
 bc2   = Battlefield Bad Company 2
 bfv   = Battlefield Vietnam
 brink = Brink
 cod   = Call of Duty
 cod2  = Call of Duty 2
 cod4  = Call of Duty 4
 blackops      = Call of Duty : Black Ops
 mw3   = Call of Duty : Modern Warfare 3
 uo    = Call of Duty United Offensive
 codww = Call of Duty World at War
 cs    = Counter Strike 1.6
 csgo  = Counter Strike Global Offensive
 css   = Counter Strike Source
 czero = Counter-Strike Condition Zero
 crysis        = Crysis
 crysis2       = Crysis 2
 warhead       = Crysis Wars
 rordh = Darkest Hour
 dod   = Day of Defeat
 dods  = Day of Defeat Source
 dayz  = DayZ
 doom3 = Doom 3
 etqw  = Enemy Territory Quake Wars
 fear  = F.E.A.R.
 ff    = Fortress Forever
 ffow  = Frontlines Fuel of War
 garrysmod     = Garry's Mod
 hl    = Half Life 1
 hl2dm = Half-Life 2 Deathmatch
 halo  = Halo
 homefront     = Homefront
 ins   = Insurgency
 killingfloor  = Killing Floor
 l4d   = Left 4 Dead
 left4dead2    = Left 4 Dead 2
 moh   = Medal of Honor
 mohaa = Medal of Honor Allied Assault
 bt    = Medal of Honor Breakthrough
 sh    = Medal of Honor Spearhead
 mohw  = Medal of Honor Warfighter
 minecraft     = Minecraft
 mnc   = Monday Night Combat
 mumble        = Mumble
 hlns  = Natural Selection
 qw    = Quake 1 (Quake World)
 q2    = Quake 2
 q3    = Quake 3
 q4    = Quake 4
 ravaged       = Ravaged
 ro2   = Red Orchestra 2
 ror   = Red Orchestra Ostfront 41-45
 s8prejudicepc = Section 8 Prejudice
 s8prejudice   = Section 8 Prejudice (xbox)
 sniperelite2  = Sniper Elite V2
 sof2  = Soldier of Fortune II
 swbf2 = Star Wars Battlefront 2
 swjk  = Star Wars Jedi Knight
 swat4 = SWAT 4
 tf2   = Team Fortress 2
 tfc   = Team Fortress Classic 1.6
 teamspeak     = TeamSpeak
 ts3   = TeamSpeak 3
 ut    = Unreal Tournament
 ut2k4 = Unreal Tournament 2004
 ut3   = Unreal Tournament 3
 urbanterror   = Urban Terror
 ventrilo      = Ventrilo
 et    = Wolfenstein Enemy Territory
 wolf  = Wolfenstein PC
 hl2zp = Zombie Panic! Source




 AF = Afghanistan
 AX = Aland Islands
 AL = Albania
 DZ = Algeria
 AS = American Samoa
 AD = Andorra
 AO = Angola
 AI = Anguilla
 A1 = Anonymous Proxy
 AG = Antigua and Barbuda
 AR = Argentina
 AM = Armenia
 AW = Aruba
 AU = Australia
 AT = Austria
 AZ = Azerbaijan
 BS = Bahamas
 BH = Bahrain
 BD = Bangladesh
 BB = Barbados
 BY = Belarus
 BE = Belgium
 BZ = Belize
 BJ = Benin
 BM = Bermuda
 BT = Bhutan
 BO = Bolivia
 BA = Bosnia and Herzegovina
 BW = Botswana
 BV = Bouvet Island
 BR = Brazil
 IO = British Indian Ocean Territory
 BN = Brunei Darussalam
 BG = Bulgaria
 BF = Burkina Faso
 BI = Burundi
 KH = Cambodia
 CM = Cameroon
 CA = Canada
 CV = Cape Verde
 KY = Cayman Islands
 CF = Central African Republic
 TD = Chad
 CL = Chile
 CN = China
 CX = Christmas Island
 CC = Cocos (Keeling) Islands
 CO = Colombia
 KM = Comoros
 CG = Congo
 CD = Congo, The Democratic Republic of the
 CK = Cook Islands
 CR = Costa Rica
 CI = Cote D'Ivoire
 HR = Croatia
 CU = Cuba
 CY = Cyprus
 CZ = Czech Republic
 DK = Denmark
 DJ = Djibouti
 DM = Dominica
 DO = Dominican Republic
 EC = Ecuador
 EG = Egypt
 SV = El Salvador
 GQ = Equatorial Guinea
 ER = Eritrea
 EE = Estonia
 ET = Ethiopia
 FK = Falkland Islands (Malvinas)
 FO = Faroe Islands
 FJ = Fiji
 FI = Finland
 FR = France
 GF = French Guiana
 PF = French Polynesia
 TF = French Southern Territories
 GA = Gabon
 GM = Gambia
 GE = Georgia
 DE = Germany
 GH = Ghana
 GI = Gibraltar
 GR = Greece
 GL = Greenland
 GD = Grenada
 GP = Guadeloupe
 GU = Guam
 GT = Guatemala
 GG = Guernsey
 GN = Guinea
 GW = Guinea-Bissau
 GY = Guyana
 HT = Haiti
 HM = Heard Island And Mcdonald Islands
 VA = Holy See (Vatican City State)
 HN = Honduras
 HK = Hong Kong
 HU = Hungary
 IS = Iceland
 IN = India
 ID = Indonesia
 IR = Iran, Islamic Republic of
 IQ = Iraq
 IE = Ireland
 IM = Isle Of Man
 IL = Israel
 IT = Italy
 JM = Jamaica
 JP = Japan
 JE = Jersey
 JO = Jordan
 KZ = Kazakhstan
 que = Kenya
 KI = Kiribati
 KP = Korea, Democratic People's Republic of
 KR = Korea, Republic of
 KW = Kuwait
 KG = Kyrgyzstan
 LA = Lao People's Democratic Republic
 LV = Latvia
 LB = Lebanon
 LS = Lesotho
 LR = Liberia
 LY = Libya
 LI = Liechtenstein
 LT = Lithuania
 LU = Luxembourg
 MO = Macao
 MK = Macedonia
 MG = Madagascar
 MW = Malawi
 MY = Malaysia
 MV = Maldives
 ML = Mali
 MT = Malta
 MH = Marshall Islands
 MQ = Martinique
 MR = Mauritania
 MU = Mauritius
 YT = Mayotte
 MX = Mexico
 FM = Micronesia, Federated States of
 MD = Moldova, Republic of
 MC = Monaco
 MN = Mongolia
 ME = Montenegro
 MS = Montserrat
 MA = Morocco
 MZ = Mozambique
 MM = Myanmar
 NA = Namibia
 NR = Nauru
 NP = Nepal
 NL = Netherlands
 AN = Netherlands Antilles
 NC = New Caledonia
 NZ = New Zealand
 NI = Nicaragua
 NE = Niger
 NG = Nigeria
 NU = Niue
 NF = Norfolk Island
 MP = Northern Mariana Islands
 NO = Norway
 A0 = Not Found
 OM = Oman
 PK = Pakistan
 PW = Palau
 PS = Palestinian Territory, Occupied
 PA = Panama
 PG = Papua New Guinea
 PY = Paraguay
 PE = Peru
 PH = Philippines
 PN = Pitcairn
 PL = Poland
 PT = Portugal
 PR = Puerto Rico
 QA = Qatar
 RE = Reunion
 RO = Romania
 RU = Russian Federation
 RW = Rwanda
 BL = Saint Barthelemy
 SH = Saint Helena
 KN = Saint Kitts and Nevis
 LC = Saint Lucia
 MF = Saint Martin
 PM = Saint Pierre and Miquelon
 VC = Saint Vincent and the Grenadines
 WS = Samoa
 SM = San Marino
 ST = Sao Tome and Principe
 A2 = Satellite Provider
 SA = Saudi Arabia
 SN = Senegal
 RS = Serbia
 SC = Seychelles
 SL = Sierra Leone
 SG = Singapore
 SK = Slovakia
 SI = Slovenia
 SB = Solomon Islands
 SO = Somalia
 ZA = South Africa
 GS = South Georgia and the South Sandwich Islands
 ES = Spain
 LK = Sri Lanka
 SD = Sudan
 SR = Suriname
 SJ = Svalbard and Jan Mayen
 SZ = Swaziland
 SE = Sweden
 CH = Switzerland
 SY = Syrian Arab Republic
 TW = Taiwan, Province of China
 TJ = Tajikistan
 TZ = Tanzania, United Republic of
 TH = Thailand
 TL = Timor-Leste
 TG = Togo
 TK = Tokelau
 TO = Tonga
 TT = Trinidad and Tobago
 TN = Tunisia
 TR = Turkey
 TM = Turkmenistan
 TC = Turks and Caicos Islands
 TV = Tuvalu
 UG = Uganda
 UA = Ukraine
 AE = United Arab Emirates
 GB = United Kingdom
 US = United States
 UM = United States Minor Outlying Islands
 UY = Uruguay
 UZ = Uzbekistan
 VU = Vanuatu
 VE = Venezuela
 VN = Viet Nam
 VG = Virgin Islands, British
 VI = Virgin Islands, U.S.
 WF = Wallis and Futuna
 EH = Western Sahara
 YE = Yemen
 ZM = Zambia
 ZW = Zimbabwe





Executable: http://exoshare.com/download.php?uid=MHXEVOZYO bsoleto, el nuevo executable está en el comentario de abajo...


GTSL.rb Obsoleto, el nuevo código está en el comentario de abajo...


Saludos
Título: Re: [RUBY] GameTracker ServerList
Publicado por: Eleкtro en 29 Noviembre 2012, 12:28 PM
GameTracker ha cambiado el sistema de búsqueda y ha aumentado un poco la seguridad (Ahora la localización del país es "Case-Sensitive"), así que la versión anterior queda obsoleta, he hecho una nueva versión.

Y como extra, la tool ahora genera un archivo de favoritos para reemplazar el archivo dentro de la carpeta del juego y no tener que ir metiendo las ips dentro del juego:

Ejemplo:

serverbrowser_hist.vdf
"Filters"
{
"favorites"
{
"1"
{
"name" "89.44.246.123:27015"
"address" "89.44.246.123:27015"
"lastplayed" "1256267351"
"appID" "0"
}
"2"
{
"name" "89.44.246.14:27015"
"address" "89.44.246.14:27015"
"lastplayed" "1256267351"
"appID" "0"

etc.
etc..
etc...



Executable: http://exoshare.com/download.php?uid=QNKEUJXB


GTSL.rb:
Código (ruby) [Seleccionar]


# GameTracker ServerList v1.2
#
# By Elektro H@cker


# Description:
# -----------
# This tool retreives the servers list of a game from GameTracker site,
# and generates a favorite gameserver steam list.


# How to use:
# ----------
#
# GTSL.rb help
#
# GTSL.rb (game) (location) (output file)
#
# Or change the default values...
#
# Default values:
$game     = "cs"
$location = "ES"
# # # # # # # #

require 'net/http'

exit if Object.const_defined?(:Ocra)

$url = "http://www.gametracker.com/search/#{$game}/#{$location.upcase}/?searchipp=50&searchpge=1#search"

def logo()
puts '
  GameTracker Server List
 
  By Elektro H@cker
'
end


def help()

  puts '

  Options:
  _______

  /? (or) help (or) -h (or) -help | Shows this help.


  Parameters:
  __________         

  (game)      | The game kind.

  (locacion)  | The geo-location of servers.

  (file)      | The output file. 


  How to use:
  __________

  GTSL.rb -help

  GTSL.rb (game) (location) (output file)

  PS: Or change the two default values near the start line inside the script...


  Examples:
  ________

  GTSL CS UK
  [+] Gets all the UK servers for Counter-Strike 1.6
      and save it in the default generated file.


  GTSL HL ES "servers.txt"
  [+] Gets all the Spanish servers for Half-life
      and save it in the custom file ("servers.txt").
  '

  # game value list
  puts "\n
  Game values:
  ___________\n"
  puts Net::HTTP.get_response(URI.parse($url)).body.split('<option value="_all">All Games</option>').last.split('</select>').first.gsub('<option value="', "").gsub('</option>', "").gsub(' selected="selected"', "").gsub('" >', " = ").gsub(" ", "  ")

  # location value list
  puts "\n
  Location values:
  _______________\n"
  puts Net::HTTP.get_response(URI.parse($url)).body.split('<optgroup label="Search by country">').last.split('</optgroup>').first.gsub('<option value="', "").gsub('</option>', "").gsub(' selected', "").gsub('" >', " = ").gsub(" ", "  ")
 
  exit

end


def args()
  if ARGV[0] =~ /help/i or ARGV[0] =~ /-help/i or ARGV[0] =~ /-h/i or ARGV[0] == "/?" then help()    end
  if not ARGV[0].nil?   then $game     = ARGV[0] end
  if not ARGV[1].nil?   then $location = ARGV[1] end
  if not ARGV[2].nil?   then $file     = ARGV[2] else $file = ".\\#{$game}-#{$location.upcase} servers.txt" end
end


def info()
  puts "
  Game    : #{$game}
  Location: #{$location.upcase}
  Pages   : #{$pag}
  Servers : #{$pag*50} (approx.)

  "
end


def get_pages()
  $pag = 0
  $url = "http://www.gametracker.com/search/#{$game}/#{$location.upcase}/?searchipp=50&searchpge=1&sort=c_name&order=ASC"
  Net::HTTP.get_response(URI.parse($url)).body.each_line do |line|
    if (line[/;order=ASC#search">NEXT<\/a>/]) then break  end
    if (line[/^\s+<a href="\/search\/.+\/.+\/?searchipp=50&amp;searchpge=[0-9]+&amp;sort=c_name&amp;order=ASC#search">[0-9]+<\/a>\s+$/])
      if $pag < line.split("</a>").first.split('>').last.to_i
         $pag = line.split("</a>").first.split('>').last.to_i
      end
    end
  end
end


def show_ips()
  a = 0

  print "[+] Parsing pages "

  File.open('serverbrowser_hist.vdf', 'a+') do |favorites|
    favorites.puts '"Filters"'
    favorites.puts '{'
    favorites.puts '"favorites"'
    favorites.puts '{'
  end

  for i in 1..$pag do
    print "#{i}/#{$pag}..."
    $url = "http://www.gametracker.com/search/#{$game}/#{$location.upcase}/?searchipp=50&searchpge=#{i}#search"
    Net::HTTP.get_response(URI.parse($url)).body.each_line do |line|

      # puts line.split("/")[2] if (line["server_info"])

      File.open($file, 'a+') do |f|
        f.puts line.split("/")[2] if (line["server_info"])
      end

      File.open('serverbrowser_hist.vdf', 'a+') do |favorites|
        a = a+1 if (line["server_info"])
        favorites.puts "\"#{a}\""                              if (line["server_info"])
        favorites.puts "{"                                     if (line["server_info"])
        favorites.puts "\"name\" \"#{line.split("/")[2]}\""    if (line["server_info"])
        favorites.puts "\"address\" \"#{line.split("/")[2]}\"" if (line["server_info"])
        favorites.puts "\"lastplayed\" \"1256267351\""         if (line["server_info"])
        favorites.puts "\"appID\" \"0\""                       if (line["server_info"])
        favorites.puts "}"                                     if (line["server_info"])
      end

    end
  end

  File.open('serverbrowser_hist.vdf', 'a+') do |favorites|
    favorites.puts '}'
    favorites.puts '"History"'
    favorites.puts '{'
    favorites.puts '}'
    favorites.puts '}'
  end

end


logo()
args()
get_pages()
info()
show_ips()


exit