Récuperer les infos d'un serveur half-life

Signaler
Messages postés
3
Date d'inscription
vendredi 2 août 2002
Statut
Membre
Dernière intervention
6 août 2002
-
Messages postés
1
Date d'inscription
jeudi 26 décembre 2002
Statut
Membre
Dernière intervention
21 juin 2005
-
voila tout en ds le titre su sujet, je voudrai récuperer les info d'un serveur half-life, liste des joueurs nb de frags etc...
comment faire a partir de VB

10 réponses

Messages postés
84
Date d'inscription
jeudi 31 janvier 2002
Statut
Membre
Dernière intervention
19 juillet 2006

Ton serveur, C un serveur local pour une LAN ou un serveur Web....?
0
Messages postés
3
Date d'inscription
vendredi 2 août 2002
Statut
Membre
Dernière intervention
6 août 2002

n'importe kel serveur web, je rentre une ip et hop il me donne les info, kom qd tu fais "server info" ds half-life mais en VB!!
0
Messages postés
84
Date d'inscription
jeudi 31 janvier 2002
Statut
Membre
Dernière intervention
19 juillet 2006

C pour faire koi au juste ton prog....?
Je regarde si je trouve des infoset je te tiens au courant.....

XaV
0
Messages postés
3
Date d'inscription
vendredi 2 août 2002
Statut
Membre
Dernière intervention
6 août 2002

ben en fait c pour rechercher un pseudo en particulier ds une liste de serveur commune a plusieur pote, voila en gros, j'ai essayer avec winsock mais y veux pas se connecter, si tu trouve la solution t'es mon idole qq part merci aa+____
0
Messages postés
1662
Date d'inscription
lundi 16 septembre 2002
Statut
Membre
Dernière intervention
30 juillet 2008
1
moi g trouver :)

ca va etre dans mon programme... sauf que j'ai un tit bugs... genre je recois 4 chiffres et la jsais pas koi faire avec ca pour les mettre en client-time
0
Messages postés
140
Date d'inscription
mercredi 3 juillet 2002
Statut
Membre
Dernière intervention
19 novembre 2006

====================================

KRUST

c'est bien sympa de nous le dire mais dit nous plutôt comment :p
j'ai lut le sdk de hl
voilà ce qu'il dit :
faut utiliser udp et non tcp ip pour la connect
il faut envoyer 4 fois un integer 32bit contenant 255 à la connect
ensuite pour chaque commande faut:
envoyer 4 bit à zero puis envoyer la commande que vous sauhaitée : enfin voilà le texte orgiinal :
Note to those writing remote admin programs that issue rcon commands (the in-client rcon commands work as before), you will need to change your rcon tools to use the following revised protocol.

Remote App sends a UDP packet to the server on the server's port (e.g., 127.0.0.1:27015):

The packet should start with 4 consecutive bytes of 255 (32-bit integer -1) and the string:

"challenge rcon\n".

The server will respond to the requesting system on the purported remote IP address and port with four 255's and:

"challenge rcon number\n" where number is an unsigned int32 number.

To issue the actual rcon, the remote App then responds with a UDP packet containing 4 255s and:

"rcon number "password" rconcommands" where password is the rcon_password ( should be enclosed in quotes as noted so that multiple word passwords will continue to work ), number is the unsigned int32 number received from the server and rconcommands is the actual rcon command string.

If the remote App fails to send the appropriate challenge number, waits too long to send the challenge, or uses an invalid password more than a few times in the course of a few seconds, the remote App will be assumed to be malicious and the actual ip address used by the remote host will be permanently and automatically banned from the server (as with the addip command). You can use listip to see the list of banned ip addresses on a server.

-----------------------------
Game servers will answer the following messages:
Messages are sent to the server by sending 4 consecutive bytes of 255 (32-bit integer -1) and then the string command followed by a zero byte to terminate it

"ping"
Server responds with a single byte code ASCII 'j'

"info"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'C' (info response, S2A_INFO)
(string) net address of server
(string) name of the host / server
(string) name of the map
(string) game directory (i.e. valve/)
(string) Game description (e.g. "half-life multiplay")
(byte) active client count
(byte) maximum clients allowed
(byte) protocol version (currently 7)

"players"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'D' (players response, S2A_PLAYER)
(byte) active client count

for each active client
(byte) client number / index
(string) player name
(int32) client's frag total
(float32) client's total time in-game

"rules"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'E' (rules response, S2A_RULES)
(int16) number of rules

for each rule
(string) rule name
(string) rule value

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

Master server query protocol:

Sent to master:

(byte) ASCII 'c' ( A2M_GET_SERVERS )

Response from master:

(int32) -1
(byte) ASCII 'd' ( M2A_SERVERS )
(byte) unused

// This is followed by as many 6 byte ip addresses as will fit in the message. The master currently feeds about 2K worth of IP address ( 300+ or so ), but we may up that # significantly in the near future.

(4 x byte) ip address
(int16) port #

The old protocol is still valid, but there is a new, extended protocol:

Here are both the old and new protocols ( the new one is the "details" message ):

"info"
Server responds with the following packet:
(int32) -1
(byte) ASCII 'C' (info response, S2A_INFO)
(string) net address of server
(string) name of the host / server
(string) name of the map
(string) game directory (i.e. valve/)
(string) Game description (e.g. "half-life multiplay")
(byte) active client count
(byte) maximum clients allowed
(byte) protocol version (currently 37)

"details"
(int32) -1
(byte) ASCII 'm' ( S2A_INFO_DETAILED )
(string) net address of server
(string) name of the host / server
(string) name of the map
(string) game directory (i.e. valve/)
(string) Game description (e.g. "half-life multiplay")
(byte) active client count
(byte) maximum clients allowed
(byte) protocol version (currently 37)
(byte) type of server == 'l' for listen or 'd' for dedicated
(byte) os of server == 'w' for win32 or 'l' for linux
(byte) password on server == 1 or yes, 0, for no
(byte) is server running a mod? == 1 for yes, 0 for no

IFF the server is running mod byte was 1:

(string) URL for mod's "info" website
(string) URL for mod's download ftp server
(int32) mod version #
(int32) mod download size ( in bytes, approx. )(byte) is the mod a server side only mod? 1 yes, 0 no(byte) does this server require you to have a custom client side .dll ( client.dll )? 1 yes, 0 no.

====================
a plus Krust :p
====================
0
Messages postés
1662
Date d'inscription
lundi 16 septembre 2002
Statut
Membre
Dernière intervention
30 juillet 2008
1
bravo tu as trouvé, la seule chose qui ne marche pas c'est le getting des serveurs par le master... disons qu'on ne prend que comme il dit 300 serveurs mais comment faire pour avoir le reste ? de plus en VB comment faire pour utiliser la putain de fonction unpack qui se trouve en C et en php !?!? car c'est le plus utile pour par exemple l'ip du serveur CS (celle la jlai meme pas trouvé en php c quoi le format) et ca sert pour le time du players... ca c float :p
mais alors en VB C'EST KOI !!!!
0
Messages postés
2
Date d'inscription
mercredi 4 février 2009
Statut
Membre
Dernière intervention
4 février 2009

----------------------
Lu les programmeurs
----------------------
J'ai besoin de la mm chose... En plus si quelqu'un connait une commande pour obtenir le score des equipe CT et Terro (c'est pour un prg qui recupere les scor des matchs)

Je n'arrive toujours pas a me connecter aux serveurs par ce moyen, je ne sais pas comment envoyer les données par udp quelqu'un pourrait-il ecrire le code en entier ? Voici le mien mais faites attentions je suis nul il doit être faux :

Private Sub Command1_Click()
' Envoie le texte dès qu'il est tapé.
Dim dccc As Byte
dccc = 255
udpPeerB.SendData (dccc)
udpPeerB.SendData (dccc)
udpPeerB.SendData (dccc)
udpPeerB.SendData (dccc)
udpPeerB.SendData (txtSend.Text)

End Sub

Private Sub Form_Load()
' Le nom du contrôle est udpPeerB
With udpPeerB
' IMPORTANT : assurez-vous de changer la
' valeur de RemoteHost pour lui donner le nom
' de votre ordinateur.
.RemoteHost = "Kaoul"
.RemotePort = 27015
' Port auquel on se connecte.
.Bind
' Établit le lien avec le port local.
End With
End Sub

Private Sub udpPeerB_DataArrival _
(ByVal bytesTotal As Long)
Dim strData As String
udpPeerB.GetData strData
txtOutput.Text = strData
End Sub

--------------------
By Kaoul
0
Messages postés
1662
Date d'inscription
lundi 16 septembre 2002
Statut
Membre
Dernière intervention
30 juillet 2008
1
Je ne l'ai pas testé mais depuis qu j'ai posé la question j'ai réussi a faire le tout ce qu'il fallait :)
http://www.lookstrike.com/spy/

Meme que j'ai réussi a faire ca avec Unreal Tournament 2003 :) prochaine attaque : BattleField et Quake3
0
Messages postés
1
Date d'inscription
jeudi 26 décembre 2002
Statut
Membre
Dernière intervention
21 juin 2005

Suite a l'arrivée de VAC2 les requettes ont malheureusement changées.


Voici les nouvelles dite moi ce que vous en pensez et si vous arrivez a les piloter.


au passages il me semble que "ping" fonctionne toujours.


récuperer les infos d'un serveur half life avec VAC2



****************** VAC2, Server Queries for counter Strike 1.6 & Condition zero & source ********************


The Source engine allows you to query information from a running game server using UDP/IP packets.
This document describes the packet formats and protocol to access this data.

---- Basic Data Types ----
All server queries consist of 5 basic types of data packed together into a data stream.
Name Description

byte 8 bit character
short 16 bit signed integer
long 32 bit signed integer
float 32 bit float value
string Variable length byte field, terminated by 0x00



---- Query Types ----
The server responds to 4 queries:


A2S_SERVERQUERY_GETCHALLENGE - Returns a challenge number for use in the player and rules query.
A2S_INFO - Basic information about the server.
A2S_PLAYER - Details about each player on the server.
A2S_RULES - The rules the server is using.
Queries should be sent in UDP packets to the listen port of the server, which is typically port 27015.


*** A2S_SERVERQUERY_GETCHALLENGE ***
Request format


Challenge values are required for A2S_PLAYER and A2S_RULES requests, you can use this request to get one.
Note: You can also send A2S_PLAYER and A2S_RULES queries with a challenge value of -1 (0xFF FF FF FF FF FF FF FF) and they will respond with a challenge value to use (using the reply format below).


FF FF FF FF 57


Reply format


Data Type Comment
Type byte Should be equal to 'A' (0x41)
Challenge long The challenge number to use


Example reply:
FF FF FF FF FF 41 32 42 59 45 53 93 43 71


*** A2S_INFO ***
Request format


Server info can be requested by sending the following byte values in a UDP packet to the server.


FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69 6E 65 20 51 75 65 72 79 00



Reply format (Counter Strike : Source)


Data Type Comment

Type byte Should be equal to 'I' (0x49)
Version byte Network version
Hostname string The Servers name
Map string The current map being played
Game Directory string The Game type
Game Description string A friendly string name for the game type
AppID short Steam Application number (currently always set to 0)
Num players byte The number of players currently on the server
Max players byte Maximum allowed players for the server
Num of bots byte Number of bot players currently on the server
Dedicated byte Set to 1 for dedicated servers
OS byte 'l' for Linux, 'w' for Windows
Password byte If set to 1 a password is required to join this server
Secure byte If set to 1 this server is running VAC
Game Version string The version of the game


Example reply:


FF FF FF FF 49 02 67 61 6D 65 32 78 73 2E 63 6F ....I.game2xs.co
6D 20 43 6F 75 6E 74 65 72 2D 53 74 72 69 6B 65 m.Counter-Strike
20 53 6F 75 72 63 65 20 23 31 00 64 65 5F 64 75 .Source.#1.de_du
73 74 00 63 73 74 72 69 6B 65 00 43 6F 75 6E 74 st.cstrike.Count
65 72 2D 53 74 72 69 6B 65 00 00 00 0B 28 00 64 er-Strike....(.d
6C 00 00 31 2e 31 2e 30 2e 31 36 00 l..1.1.0.16



Reply format (Counter Strike : 1.6 & Conditon Zero)


Data Type Comment

Type byte Should be equal to 'm' (0x6D)
Game IP string Game Server IP address and port
Hostname string The Servers name
Map string The current map being played
Game Directory string The Game type
Game Description string A friendly string name for the game type
Num players byte The number of players currently on the server
Max players byte Maximum allowed players for the server
Version byte Network version
Dedicated byte Set to 'd' for dedicated servers, 'l' for listen
OS byte 'l' for Linux, 'w' for Windows
Password byte If set to 1 a password is required to join this server
IsMod byte If set to 1 this packet has a mod details section, 0 otherwise
URLInfo string (MOD Detail Only) URL containing information about this mod
URLDL string (MOD Detail Only) URL to download this mod
Unused string (MOD Detail Only) Will always be an empty string
ModVersion long (MOD Detail Only) Version of the installed mod
ModSize long (MOD Detail Only) The download size of this mod
SvOnly byte (MOD Detail Only) If 1 this is a server side only mod
ClDLL byte (MOD Detail Only) If 1 this mod has a custom client dll
Secure byte If set to 1 this server is running VAC
Num of bots byte Number of bot players currently on the server



*** A2S_PLAYER ***
Request format


FF FF FF FF 55 <4 byte challenge number>


The challenge number can either be set to -1 (0xFF FF FF FF FF FF FF FF) to have the server reply with S2C_CHALLENGE, or use the value from a previous A2S_SERVERQUERY_GETCHALLENGE request.


Reply format


The players response has two sections, the initial header:


Data Type Comment
Type byte Should be equal to 'D' (0x44)
Num Players byte The number of players reported in this response



Then for each player the following fields are sent:


Data Type Comment
Index byte The index into [0.. Num Players] for this entry
Player Name string Player's name
Kills long Number of kills this player has
Time connected float The time in seconds this player has been connected



***A2S_RULES
Request format


FF FF FF FF 56 <4 byte challenge number>
The challenge number can either be set to -1 (0xFF FF FF FF FF FF FF FF) to have the server reply with S2C_CHALLENGE, or use the value from a previous A2S_SERVERQUERY_GETCHALLENGE request.


Reply format


The rules response has two sections, the initial header:


Data Type Comment


Type byte Should be equal to 'E' (0x45)
Num Rules short The number of rules reported in this response


Then for each rule the following fields are sent:


Data Type Comment


Rule Name string The name of the rule
Rule Value string The rules value

------------------------------------------------
source tiré du site : http://www.valve-erc.com/srcsdk/
0