tcl:
Code: Select all
#
# gametiger.tcl par Ibu <ibu_lordaeron@yahoo.fr>
#
#
# ATTENTION !! CE TCL REQUIERT HTTP.TCL
#
#################
# Configuration #
#################
# aucun
########
# Motd #
########
putlog "\002gametiger.tcl\002 par \002Ibu\002 14<ibu_lordaeron@yahoo.fr>"
putlog " Tapez: .game ou !game (channel)"
################################
# Vérifier une ip sur un salon #
################################
bind pub - !game gametiger:pub:testip
proc gametiger:pub:testip { nick uhost handle channel arg } {
global encorebis
set encore [unixtime]
if {[info exists encorebis]} {
set trop [expr $encore - $encorebis]
if { $trop < 5 } {
putserv "PRIVMSG $channel :Désolé $nick, une demande d'IP toutes les 5 secondes"
return 0
} else {
set encorebis $encore
}
} else {
set encorebis $encore
}
set AddrIp [lindex $arg 0]
if { $AddrIp == "" } {
putserv "PRIVMSG $channel :Commande : \002!game\002 <ip>"
return 0
}
set token [http::geturl http://www.gametiger.net/search?address=$AddrIp]
set fv [open system/testip.txt w+]
puts $fv [http::data $token]
close $fv
http::Finish $token
set LectureFichierAcces "system/testip.txt"
if { [file exists $LectureFichierAcces] == 0 } {
set LectureTemp [open $LectureFichierAcces w+]
close $LectureTemp
}
set LectureTemp "[open $LectureFichierAcces r]"
while {![eof $LectureTemp]} {
set LectureTexteLu [nojoinhtml [gets $LectureTemp]]
if { [string match "*Server Name*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 340 end]"
set gt(server) "[join [gettext $i "><b>" " </b></td></tr>"]]"
} elseif { [string match "*<b>Status<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 180 end]"
set gt(status) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>IP:Port<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 90 end]"
set gt(ip) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*>Engine</td>*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(engine) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Game<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(game) "[join [gettext $i "\">" " </td></tr>"]]"
} elseif { [string match "*<b>Map<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(map) "[join [gettext $i "\">" " </td></tr>"]]"
} elseif { [string match "*<b>Last Map Change<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(lastmapchange) "[join [gettext $i "\">" " ago</td></tr>"]] ago"
} elseif { [string match "*<b>Protocol Version<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(protocol) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Type of Server<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(type) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>OS<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 110 end]"
set gt(os) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Password required<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(password) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Active*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 240 end]"
set gt(players) "[join [gettext $i "\">" "</td></tr>"]]"
set i [string first "/" $gt(players)]
set i1 [string range $gt(players) 0 [expr $i-1]]
set i2 [string range $gt(players) [expr $i+1] end]
if { $i1 == $i2 } {
set gt(players) "4$i1/$i2 (FULL)"
} else {
set gt(players) "3$i1/$i2"
}
} elseif { [string match "*<b>Last Check<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(lastcheck) "[join [gettext $i "\">" " ago</td></tr>"]] ago"
} elseif { [string match "*<b>Bogo Ping<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 120 end]"
set gt(ping) "[join [gettext $i "\">" "</td></tr>"]]"
}
}
close $LectureTemp
if { [info exist gt(ip)] } {
putserv "PRIVMSG $channel :\[ Server Name: 7$gt(server) \] \[ OS: $gt(os) \] \[ Type Server: $gt(type) \] \[ IP: 10$gt(ip) \] \[ Password Required: $gt(password) \] \[ Engine: $gt(engine) \] \[ Game: $gt(game) \] \[ Bogo Ping: $gt(ping) \] \[ Map: 5$gt(map) ($gt(lastmapchange)) \] \[ Players: $gt(players) (last check $gt(lastcheck)) \]"
} else {
putserv "PRIVMSG $channel :Ce serveur n'est pas enregistré par www.GameTiger.Net"
}
unset LectureTexteLu
return 0
}
################################
# Vérifier une ip en partyline #
################################
bind dcc - game gametiger:dcc:testip
proc gametiger:dcc:testip { hand idx arg } {
global encorebis
set encore [unixtime]
if {[info exists encorebis]} {
set trop [expr $encore - $encorebis]
if { $trop < 5 } {
putdcc $idx "Désolé $hand, une demande d'IP toutes les 5 secondes"
return 0
} else {
set encorebis $encore
}
} else {
set encorebis $encore
}
set AddrIp [lindex $arg 0]
if { $AddrIp == "" } {
putdcc $idx "Commande : \002.ip\002 <ip>"
return 0
}
set token [http::geturl http://www.gametiger.net/search?address=$AddrIp]
set fv [open system/testip.txt w+]
puts $fv [http::data $token]
close $fv
http::Finish $token
set LectureFichierAcces "system/testip.txt"
if { [file exists $LectureFichierAcces] == 0 } {
set LectureTemp [open $LectureFichierAcces w+]
close $LectureTemp
}
set LectureTemp "[open $LectureFichierAcces r]"
while {![eof $LectureTemp]} {
set LectureTexteLu [nojoinhtml [gets $LectureTemp]]
if { [string match "*Server Name*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 340 end]"
set gt(server) "[join [gettext $i "><b>" " </b></td></tr>"]]"
} elseif { [string match "*<b>Status<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 180 end]"
set gt(status) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>IP:Port<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 90 end]"
set gt(ip) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*>Engine</td>*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(engine) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Game<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(game) "[join [gettext $i "\">" " </td></tr>"]]"
} elseif { [string match "*<b>Map<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 100 end]"
set gt(map) "[join [gettext $i "\">" " </td></tr>"]]"
} elseif { [string match "*<b>Last Map Change<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(lastmapchange) "[join [gettext $i "\">" " ago</td></tr>"]] ago"
} elseif { [string match "*<b>Protocol Version<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(protocol) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Type of Server<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(type) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>OS<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 110 end]"
set gt(os) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Password required<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(password) "[join [gettext $i "\">" "</td></tr>"]]"
} elseif { [string match "*<b>Active*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 240 end]"
set gt(players) "[join [gettext $i "\">" "</td></tr>"]]"
set i [string first "/" $gt(players)]
set i1 [string range $gt(players) 0 [expr $i-1]]
set i2 [string range $gt(players) [expr $i+1] end]
if { $i1 == $i2 } {
set gt(players) "4$i1/$i2 (FULL)"
} else {
set gt(players) "3$i1/$i2"
}
} elseif { [string match "*<b>Last Check<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 130 end]"
set gt(lastcheck) "[join [gettext $i "\">" " ago</td></tr>"]] ago"
} elseif { [string match "*<b>Bogo Ping<*" "$LectureTexteLu"] } {
set i [string range "$LectureTexteLu" 120 end]"
set gt(ping) "[join [gettext $i "\">" "</td></tr>"]]"
}
}
close $LectureTemp
if { [info exist gt(ip)] } {
putlog " "
putlog "Server Name: 7$gt(server) OS: $gt(os) Type Server: $gt(type)"
putlog "IP: 10$gt(ip) Password Required: $gt(password)"
putlog "Engine: $gt(engine) Game: $gt(game) Bogo Ping: $gt(ping)"
putlog "Map: 5$gt(map) ($gt(lastmapchange)) Players: $gt(players) (last check $gt(lastcheck))"
putlog " "
} else {
putlog " "
putlog "Ce serveur n'est pas enregistré par www.GameTiger.Net"
putlog " "
}
unset LectureTexteLu
return 1
}
#################
# commmande !sith #
#################
bind pub - !sith gametiger:pub:sith
proc gametiger:pub:sith { nick uhost handle channel arg } {
gametiger:pub:testip $nick $uhost $handle $channel 62.212.74.121:27135
}
##############
# sous-procs #
##############
proc gettext { data start end } {
set index0 [string first $start $data]
set index1 [expr $index0 + [string length $start]]
set index2 [string first $end $data]
set index2 [expr $index2 - 1]
set index [expr $index2 + [string length $end]]
return [string range $data $index1 $index2]
}
proc nojoinhtml { text } {
regsub -all -- {\\} $text {\\\\} text
regsub -all -- {\{} $text {\{} text
regsub -all -- {\}} $text {\}} text
regsub -all -- {\[} $text {\[} text
regsub -all -- {\]} $text {\]} text
regsub -all -- {\"} $text {\"} text
return "$text"
}
!game 213.251.146.23:27015
the bot say:
[ Server Name: ] [ OS: ] [ Type Server: ] [ IP: ] [ Password Required: ] [ Engine: ] [ Game: ] [ Bogo Ping: ] [ Map: ( ago) ] [ Players: / (FULL) (last check ago) ]
Not info o_O. The testip.txt is good
thx<html>
<head>
<title>Gametiger Address Search : 213.251.146.23:27015</title>
<meta name="pragma" content="no-cache">
<meta name="robots" content="NOARCHIVE">
<link rel='stylesheet' type='text/css' href='gametiger.css'>
</head>
<body onload="if(parent.frames.length!=0)top.location='http://www.gametiger.net/index.html'; ">
<center>
<p>
<!-- *********** advert *********** -->
<a href="http://griffinrun.com/cgi-bin/refer?id= ... ster.shtml" target=_blank><img src="http://griffinrun.com/affiliates/buttons/gt_deal.gif" border=0></a><br>
<font size=-2>$39 server special at GriffinRUN for GameTiger visitors
Get a 12 player private, low ping Counter-Strike game server for only $39 / month, <br>
for every month for the lifetime of your account with them. Just order on
their site and use the coupon code: fullregister ... For more info go to: <br>
<a href="http://griffinrun.com/cgi-bin/refer?id= ... </a></font>
<!-- *********** /advert *********** -->
<br><br><br>
<!-- *********** advert *********** -->
<script> win=window.open("http://advnt03.com/popsend.asp?id=33214 ... ,menubar=0'); window.focus(); </script>
<!-- *********** /advert *********** -->
<br><br>
<table><tr class="dark"><td colspan=2><center><font color=ffffff><b>Server Details</td></tr><tr><td bgcolor=ccccdd><b>Server Name</td><td><font color=666666><b>FR - NitroServ.com - [#Jet-7] </b></td></tr>
<tr><td bgcolor=ccccdd><b>Status</td><td><img src=/images/up.gif border=0 width=15 height=15 align=left valign=bottom>up</td></tr>
<tr><td bgcolor=ccccdd><b>IP:Port</td><td>213.251.146.23:27015</td></tr>
<tr><td bgcolor=ccccdd><b>Engine</td><td>Half-Life 1.6 </td></tr>
<tr><td bgcolor=ccccdd><b>Game</td><td>cstrike </td></tr>
<tr><td bgcolor=ccccdd><b>Map</td><td>de_dust2 </td></tr>
<tr><td bgcolor=ccccdd><b>Last Map Change</td><td>00:03:51 ago</td></tr>
<tr><td bgcolor=ccccdd><b>Protocol Version</td><td>47</td></tr>
<tr><td bgcolor=ccccdd><b>Type of Server</td><td>dedicated</td></tr>
<tr><td bgcolor=ccccdd><b>OS</td><td>Linux</td></tr>
<tr><td bgcolor=ccccdd><b>Password required</td><td>yes</td></tr>
<tr><td bgcolor=ccccdd><b>Active/Max Players </td><td><img src=/images/up.gif border=0 width=15 height=15 align=left valign=bottom>0/12</td></tr>
<tr><td bgcolor=ccccdd><b>Last Check</td><td>00:00:26 ago</td></tr>
<tr><td bgcolor=ccccdd><b>Bogo Ping</td><td>10</td></tr>
</table><br>
<font size=+1><b><a href="/connect?address=213.251.146.23:27015&game=cstrike">connect now!</a></b>
<br>
<br>
<table><tr class="dark"><td align=right><font color=eeeeee><b> ID </td><td><font color=eeeeee><b> Player Name </b></td><td align=right><font color=eeeeee><b> Frags </td><td align=right><font color=eeeeee><b> In Game </b></td></tr>
</table>
<p>
<!-- ************** address search form ************** -->
<table class="dark"><tbody><tr class="dark">
<form method="GET" action="/search" name="f">
<td><b> Address Search </b></td>
<td align=center><input type="text" name="address" size=25 value="213.251.146.23:27015"></td>
<td> </td>
<td align=center><input type="submit" value=" search " border=0></td>
<td align=center> in <select name="game"><option selected value="all">all Games</option><option value=cstrike>Counter Strike</option><option value=h2>CS:Source (HL2)</option><option value=tfc>Team Fortress</option><option value=dod>Day of Defeat</option><option value=q3>Quake3</option><option value=bf>Bfield1942</option><option value=u3>UT2003</option><option value=u4>UT2004</option></select></td>
<td align=center><font size=-1>
<a href="/search?address=">address</a> |
<a href="/search?map=">map</a> |
<a href="/search?mod=">mod</a> |
<a href="/search?player=">player</a> |
<a href="/search?server=">server</a>
</td>
</tr>
</form>
</table>
<!-- ************** /address search form ************** -->
<p>
<p>
<img src="http://www.gametiger.de/" width=1 height=1>
<img src="http://www.gametiger.net/images/c.gif" width=1 height=1>
</body>
</html>