AAO25.com

America's Army => General Chat => Topic started by: Graf on Sunday, April 22, 2012, 12:50:24 PM

Title: AA25 Server UDP query
Post by: Graf on Sunday, April 22, 2012, 12:50:24 PM
Hi all.

I'm working on a small project to query AA25 gameservers and give inormation on a webside, all done with php / html / java. It worked fine with 2.8.5, but now the PB Guids of the players are missing. I used the PB Guids for additional links to hazard account history and the battletracker.

The only unique Player ID at the moment seems to be the Battletracker ID. But with my UDP query I don't get it from the server. Is there a way to query a server without the assist to get the ID's from Battletracker, so I can link the online players to Battletracker and perhaps show their violation history?

If you want to know, what my project is, take a look here: http://server-viewer.co.de/ (http://) It's not running propper at the moment, I have to update the AA2 and AA3 querys. Perhaps someone of the AA25 developers can help me?

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Spanky on Sunday, April 22, 2012, 13:31:20 PM
Hmmm, I'm trying to think of a way to grab BT ID's of players but I'm coming up empty. For the recently banned user, I have the BT ID and grab the username but that's reverse of what you want. Anyway, in the interest of sharing, I've uploaded the various user scripts I've written for this site, maybe there's something in there that can help you out.

http://dl.dropbox.com/u/464376/aac_maap/SpankyPHP.7z
If you do use something from my code, all I ask is a small credit somewhere :) I do have more scripts I've created for this site but I figured these would be the relevant ones for your use.
Title: Re: AA25 Server UDP query
Post by: Jonnym on Sunday, April 22, 2012, 13:37:59 PM
Yeah send a UDP query to auth.aa25.org:20047

to get ID for lord.anoobis:

send the following...
getaaoidlord.anoobis

will return....
aaoid811869
Title: Re: AA25 Server UDP query
Post by: Graf on Sunday, April 22, 2012, 14:19:48 PM
Hello all.

Spanky, thanks for your code, but it's nearly the same I'm using. I don't know the correct words for it, but I try to explain: in "server.php" you are using a "numeric" array for the replies from the server, I use a "named" array. Part of the reply I get is:

Quote
[maxplayers] => 26
[gamemode] => 7.13
[password] => 0
[tour] => 11
[official] => 1
[leased] => 1
[nato] => 0
[miles] => 0
[cheats] => 0
[minhonor] => 10
[maxhonor] => 100
[groups] => ALL
[current_round] => 4/15
[mission_time] => 2:39
[sv_punkbuster] => 1
[tournament] => 0
[ultimate_arena] => 1
[thirdparty] => 1
[custom] => 1
[AdminName] => blala-Admin

You know, what the red highlighted parts are for? I Guess "ulitmate_areana" is "hack hunter", but I'm not sure...


Also thanks to Jonnym. That is something I looked for and I'll try it. Before I start to "spam" the AA25Auth-System, is there a limitation for requests per minute / hour?

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Jared on Sunday, April 22, 2012, 14:32:14 PM
If I remember right when me and Nate did the server tracker deal assist alread cached them into a database so I think you would be fine to pull how every much u want
Title: Re: AA25 Server UDP query
Post by: Spanky on Sunday, April 22, 2012, 14:41:48 PM
Gamemode is for the current Assist version, I know that. The others are probably a mix of Official Assist server, HackHunter and something else. Check around in all the scripts, I think there's a comment for the query that I put in where Jonny explained what all the values returned were.

Hmmm, looking around, I can't find where I put that.

As for queries, I wouldn't be concerned about query amounts. Think about the hundreds of Assist users that leave Assist running and the browser list refreshes in the background every 2 minutes or whatever it is. For this site, I query the player list every minute to gather data for the number of players in game.
Title: Re: AA25 Server UDP query
Post by: Graf on Sunday, April 22, 2012, 14:59:43 PM
Hi.

My test worked, to get the ID --> http://server-viewer.co.de/aa25auth.php. But when I put it into my script to query a whole server with players, I didn't get an answer from AA25auth. I checked my test-file again and no answer returned. :-(

So when there is no automatically IP block in your auth, I have to ask my "test hoster", if there is a limitation...

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Jonnym on Sunday, April 22, 2012, 15:08:22 PM
gamemode = Assist Version
thirdparty = hackhunter
ultimate_arena = 2.5Assist server
custom = AA25 Authorization required

There is a limit of 20 querys per 10 seconds, if you go over this you are blocked for 10 seconds. This is a form of DOS protection.
Title: Re: AA25 Server UDP query
Post by: Spanky on Sunday, April 22, 2012, 17:20:03 PM
Graf, mind sharing the PHP code you used? I might integrate it into this site's server list if you don't mind.
Title: Re: AA25 Server UDP query
Post by: august on Sunday, April 22, 2012, 23:27:04 PM
Great project idea.
Title: Re: AA25 Server UDP query
Post by: Graf on Monday, April 23, 2012, 08:14:09 AM
Hello all.

Thanks for your replies and the given information.

Graf, mind sharing the PHP code you used? I might integrate it into this site's server list if you don't mind.
It's the same you used in your uploaded example. Query a server via udp and list the results. I just have chosen a different way to display it. So I can't give you new information, you don't already have. I worked on this project since 4 years, as I saw in the copyright (I was really surprised about that long time). There is a lot of old parts in it, which will only confuse you. But perhaps I can help you if you can tell me, what you need special.

There is a limit of 20 querys per 10 seconds, if you go over this you are blocked for 10 seconds. This is a form of DOS protection.
Is there a way or possibility to set my web-server-ip on a white list, so it isn't blocked?


Another question to the dev team:
Is the "msgpbssv.html" automatically intergrated if the game-server takes screenshots? That is a more comfortabel screenshot viewer than the standard "pbsvss.htm" file.

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 12:26:42 PM
My test worked, to get the ID --> http://server-viewer.co.de/aa25auth.php.

Graf, I was talking about this :) I have no idea how to query with a specific string via UDP. Jonny will have to unblock servers or raise the max request amount.
Title: Re: AA25 Server UDP query
Post by: Jonnym on Monday, April 23, 2012, 12:27:40 PM
You seem to be forgetting, i dont run the servers anymore.
Title: Re: AA25 Server UDP query
Post by: Graf on Monday, April 23, 2012, 13:11:14 PM
Hi.

That part is no problem and also part of your code, but only with other adress:

Code: [Select]
<?php
$IP 
"auth.aa25.org";
$PORT 20047;
$sock fsockopen"udp://$IP"$PORT$errno$errstr0.5);
         if(
$sock)
                 {
                 
$playername "@-FMJ-@=Graf=";
                 
$queryString "getaaoid$playername";
                 
fwrite($sock$queryString);
                 
//Read response from server
                 
$Info = @fread($sock100);
                 
//Close the socket
                 
fclose($sock);
                 }

echo 
"Server response: $Info";
?>


Edit:
I used it in a function, so I splitted the query string and used variables for the IP and Port. You can put it together or rename it. It should work with single query for one user, but if you try to query a whole server at once, you'll also get the "ban" cause there are too many requests per second.

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 13:27:30 PM
You seem to be forgetting, i dont run the servers anymore.

*shifty eyes*

Thanks Graf :)
Title: Re: AA25 Server UDP query
Post by: Jonnym on Monday, April 23, 2012, 13:32:20 PM
This...
Code: [Select]
$queryString = "getaaoid$playername";
Surely should be...
Code: [Select]
$queryString = "getaaoid"$playername;
Title: Re: AA25 Server UDP query
Post by: Jonnym on Monday, April 23, 2012, 13:34:47 PM
spanky you could integrate this into s.aao25.com so when you click on a players name it querys for the id and takes you to their battletracker page.
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 13:44:04 PM
There's many ways to do it in PHP, I think you're thinking of something like:
Code: [Select]
$queryString = "getaaoid" . $playername;
Personally, I would do it like this:
Code: [Select]
$queryString = "getaaoid{$playername}";Jared taught me about brackets and I prefer keeping everything inside the quotes rather than outside. You don't NEED the brackets, it just tells PHP that the text in the brackets is the variable.

Jonny, that idea might require some jQuery. I think both me and Graf are thinking about generating the ID when the page is loaded, that way links can be created directly to the persons account. So, at maximum there would be 32 or whatever queries in a second when the page is loaded.
Title: Re: AA25 Server UDP query
Post by: pit-23 on Monday, April 23, 2012, 14:26:57 PM
[...] Jonny will have to unblock servers or raise the max request amount.

Whitelist is not the way to go, as it should be possible to create tracker by anyone. Limits are necessary to prevent DOS. Therefore we should just extend query functionality, so that's its possible to create tracker without spamming the master server. First thing to do is possibility to query more players at once (or maybe its already possible by multiplicating the query string, i don't know).

I'll take care of this, just give me a little time to get acquainted with new stuff.
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 15:38:13 PM
Look at you go Pit!
Title: Re: AA25 Server UDP query
Post by: Graf on Monday, April 23, 2012, 16:00:29 PM
Hi.

Whitelist is not the way to go, as it should be possible to create tracker by anyone. Limits are necessary to prevent DOS. Therefore we should just extend query functionality, so that's its possible to create tracker without spamming the master server. First thing to do is possibility to query more players at once (or maybe its already possible by multiplicating the query string, i don't know).

I'll take care of this, just give me a little time to get acquainted with new stuff.

I guess the playername, ID, eg is stored in a database. Perhapds it is possbile to store these information in a seperate file periodicly or after each update on the web server, so this file can be used for a query? Like a rss-feed or banlist. So you don't have to worry about the auth-server and the number of replies...


To the code snipet a little earlier - you can use all of these:

Code: [Select]
$queryString = "getaaoid" . $playername;
$queryString = "getaaoid{$playername}";
$queryString = "getaaoid$playername";
$queryString = 'getaaoid' . $playername;


Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Jared on Monday, April 23, 2012, 16:03:25 PM
Why not have the assist server query the game servers every minute and store that into a db then we could write an API that the public could use?
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 16:16:19 PM
If we were to have a database of ID's and usernames, might I suggest we toss a date column in there and clean out accounts that haven't been used in 30 days? i.e. banned ones and abandoned noob accounts so it doesn't clutter things up.

Just my useless contribution :)
Title: Re: AA25 Server UDP query
Post by: BlueBlaster on Monday, April 23, 2012, 16:49:47 PM
Why not have the assist server query the game servers every minute and store that into a db then we could write an API that the public could use?

Sounds genius. Then you don't need to worry about querying too many times since you can pull a hell lot of info from a db through 1 query.
Title: Re: AA25 Server UDP query
Post by: Spanky on Monday, April 23, 2012, 20:12:23 PM
Actually, I just thought of a way to bypass the query spam problem. You don't link the usernames to Battletracker in the serverlist, you link them to another file with POST data (the username) which then sends a query to the Assist server, replies back with the BT ID and then a header redirect at the bottom. This way might be better too, because you wouldn't have to hook into an Assist API just to load the server list page, it would only talk to the Assist server if the web visitor actually clicked a name.
Title: Re: AA25 Server UDP query
Post by: Graf on Tuesday, April 24, 2012, 00:04:56 AM
Hi all.

I think, we all talk about the same thing, even if my words were't the best to describe.

You also store the login IP in the auth database? So it would be possible to find a second account and build a account history...

I wouldn't delete accounts from db automatically. Let the infos in there, perhaps you need it sometimes...

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: BiG_SerGiO on Tuesday, April 24, 2012, 05:36:59 AM
You also store the login IP in the auth database? So it would be possible to find a second account and build a account history...

I wouldn't delete accounts from db automatically. Let the infos in there, perhaps you need it sometimes...

Regards
Graf

This would be the best option since we don't know how long ACi History will be up, so this will be a way to users can still search and link accounts for AA 2.5
Title: Re: AA25 Server UDP query
Post by: Graf on Tuesday, April 24, 2012, 17:01:56 PM
Hello all.

I did some work on my beta page (http://server-viewer.co.de/). Now the complete information given from AA25 is included. I'm still waiting for the possibility to get the Tracker-ID from Playername...  ;)

I'm only working on the Army 2.5 part at the moment. AA3 and BF2 are not updated yet. If you find any mistakes, errors, bugs, please report.

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Spanky on Tuesday, April 24, 2012, 18:03:13 PM
Check out my server.php that I sent you, specifically;
Code: [Select]
<?php
if($Info == "")
{
echo "Can't connect to server. Please try again.";
die();
}
?>

Your code doesn't fail gracefully:
Code: [Select]
Warning: fsockopen() [function.fsockopen]: unable to connect to udp://127.255.255.255:1717 (Permission denied) in /data/multiserv/users/760329/projects/1823153/www/includes/aa2_js_funktionen.php on line 5

Warning: fclose() expects parameter 1 to be resource, boolean given in /data/multiserv/users/760329/projects/1823153/www/includes/aa2_js_funktionen.php on line 15
Title: Re: AA25 Server UDP query
Post by: Graf on Wednesday, April 25, 2012, 13:42:27 PM
Hi all.

Check out my server.php that I sent you, specifically;
(...)
Your code doesn't fail gracefully:

There was already a error handlig and now your special request to 127.255.255.255 also gives a "normal" error message.

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

I really couldn't follow the content of the last two posts, don't know if they contain a joke or not, but my feeling is, that the one from "mans" isn't very polite. So I just ignore them and don't start a discussion about politically correctness or anything else

Regards
Graf
Title: Re: AA25 Server UDP query
Post by: Viratrigo on Saturday, June 02, 2012, 13:40:19 PM
Hello!

How i create official public server in AA25? I am thinking creating a public server but dont know what to do!

What i need to create?
Title: Re: AA25 Server UDP query
Post by: Spanky on Saturday, June 02, 2012, 13:43:12 PM
Might check out the "Server" tab in Assist.
Title: Re: AA25 Server UDP query
Post by: Viratrigo on Saturday, June 02, 2012, 14:20:15 PM
hum! i trry creat but i think this server is not public, just private! i need pay i know, but where i buy the server?
Title: Re: AA25 Server UDP query
Post by: tacstealth on Thursday, June 07, 2012, 15:47:47 PM
you can go see there www.freeserver.ca (http://www.freeserver.ca)