You are not logged in.

#101 07 Nov 2006 2:15 am

JeKyll
Member
Registered: Nov 2006
Posts: 7

Re: bf2142 stat query protocol

ah there's the light in the dark, tanks a lot smile

my problem is also the "You do not have permission to access this service"-problem...

so what can i do about this?
i'm also in my company and have a fixed ip-address (proxyserver)...

have you got another advices?

best regards

JeKyll

Offline

 

#102 07 Nov 2006 3:38 am

BobbyCZ
New Member
Registered: Nov 2006
Posts: 2

Re: bf2142 stat query protocol

JeKyll :

ah there's the light in the dark, tanks a lot smile

my problem is also the "You do not have permission to access this service"-problem...

so what can i do about this?
i'm also in my company and have a fixed ip-address (proxyserver)...

have you got another advices?

best regards

JeKyll

i earned the same restriction... but... you can gather data by whichever free webhosting
sample:

Code:

<html><head>
<META http-equiv="cache-control" content="no-cache">
<META http-equiv="pragma" content="no-cache">
</head><body>
<?php
require_once("ea_support.php");

$bfcoding  = &new ea_stats();

$pid = 81260470; // your PID
$code = dwh(dechex(time())).dwh(dechex(100)).dwh(dechex($pid))."0000";
$code.= CalcCRC($code);
$result = $bfcoding->DefEncryptBlock($bfcoding->hex2str($code));
$auth = $bfcoding->getBase64Encode($result);
$url="http://stella.prod.gamespy.com/getleaderboard.aspx?auth=".$auth."&pos=1&after=17&type=overallscore";
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

function dwh($h)
{
  $s = substr("0000000".$h, -8);
  return substr($s,6,2).substr($s,4,2).substr($s,2,2).substr($s,0,2);
}

function XOR32 ($a, $b)
{
  $a1 = $a & 0x7FFF0000;
  $a2 = $a & 0x0000FFFF;
  $a3 = $a & 0x80000000;
  $b1 = $b & 0x7FFF0000;
  $b2 = $b & 0x0000FFFF;
  $b3 = $b & 0x80000000;
  $c = ($a3 != $b3) ? 0x80000000 : 0;
  return (($a1 ^ $b1) |($a2 ^ $b2)) + $c;
}

function SHR32 ($x, $bits)
{
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $y = ($x & 0x7FFFFFFF) >> $bits;
  if (0x80000000 & $x) {
    $y |= (1<<(31-$bits));   
  }
  return $y;
}

function SHL32 ($x, $bits)
{
  if ($bits==0) return $x;
  if ($bits==32) return 0;
  $mask = (1<<(32-$bits)) - 1;
  return (($x & $mask) << $bits) & 0xFFFFFFFF;
}

function SAL32 ($x, $bits)
{
  $s = str_pad(decbin ($x),32,"0",STR_PAD_LEFT);
  return bindec(substr($s,$bits).substr($s,0,$bits));
}

function SAR32 ($x, $bits)
{
  $s = str_pad(decbin ($x),32,"0",STR_PAD_LEFT);
  $r = 32-$bits;
  return bindec(substr($s,$r,$bits).substr($s,0,$r));
}

function CalcCRC($h)
{
  $eax = 0;
  for($esi=0; $esi<14; $esi++) 
  {
    $ecx = $eax;
    $ecx = SAR32($ecx,8);    
    $ecx&= 255;
    $eax = SHL32($eax,8);    
    $ecx|= $eax;
    $eax = hexdec(substr($h,$esi*2,2));
    $eax = XOR32($eax,$ecx);
    $ecx = ($eax&255);
    $ecx = SHR32($ecx,4);    
    $eax = XOR32($eax,$ecx);
    $ecx = $eax;
    $ecx = SHL32($ecx,12);    
    $eax = XOR32($eax,$ecx);
    $ecx = $eax;
    $ecx&= 255;
    $ecx = SHL32($ecx,5);    
    $eax = XOR32($eax,$ecx);
  }
  $eax&= 65535;
  $hex = substr("0000".strtoupper(dechex($eax)), -4);
  return substr($hex,2,2).substr($hex,0,2);
}
?>
</body></html>

Last edited by BobbyCZ (07 Nov 2006 3:42 am)

Offline

 

#103 07 Nov 2006 5:02 am

JeKyll
Member
Registered: Nov 2006
Posts: 7

Re: bf2142 stat query protocol

now it works!

tank you very much for your fast help!

greets JeKyll

Offline

 

#104 07 Nov 2006 6:42 am

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

I plan on setting up my parents PC to scrape the data from the servers that way if i mess up the queries its ip gets banned instead of mine lol.  I'll do that tonight when I go vote.

Offline

 

#105 07 Nov 2006 11:16 am

Tubar
Senior Member
From: Slovakia
Registered: Oct 2006
Posts: 26
Website

Re: bf2142 stat query protocol

MadHatter :

BE CAREFUL FOLKS!

I'm getting

You do not have permission to access this service

from the stats servers now... In game I can't see any stats either, so beware.

Try don't use GamespyHTTP/1.0, use just only standart HTTP.

When I store this link with GamespyHTTP I got message about permission, but when I store just only in web as URL link, than I got data.

Offline

 

#106 07 Nov 2006 11:26 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

I wonder if thats tied to whether you're using 01 00 XX XX or 00 00 XX XX.  I never checked to see whether the servers sent a user agent or not.

looks like my work IP is banned no matter what the user agent looks like (or whether or not I use 00 or 01).

Offline

 

#107 08 Nov 2006 1:34 am

JeKyll
Member
Registered: Nov 2006
Posts: 7

Re: bf2142 stat query protocol

just my 2 cent:

read the following thread in the forum of http://www.2142-stats.com :

http://forum.2142-stats.de/2142-stats.d … +3502.html

Offline

 

#108 08 Nov 2006 6:39 am

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

That thread(the english parts) represent exactly what i was thinking.

EA doesn't want people hammering their stats server, since it is already so poor.  However as programmers we have ways to collect stats without hammering the servers.  Also, they are probably pissed that people will be making money off the stats(ads on stat pages).  This is a valid concern since the data does belong to them, and other people are now benefiting from their data.

My goal is to create a C# application that will query the server every 5-10 seconds(random intervals between 5-10 seconds to mimic a real user).  Run this at around 5 am, during a low traffic period.  Have it query the information for me and my guild members and generate sql queries to insert/update data into a database that is on our website, then I will have my own private stats site for my guild.

This way all of EA's concerns are invalid aside from the childish "IT'S MY BALL AND I'M GOING HOME!" attitude.

What is going to happen is someone is going to create a site that pulls all its info directly from EA's stat server.  Lots of people will start using it and they will get extremely pissed.

Offline

 

#109 08 Nov 2006 7:23 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

I've been working on my windows client that will get a snapshot of the players stats and post them to a stats server (any site that runs my web services that I'm also writing), but I am undecided whether or not I will pull stats directly with my app or use winpcap to sniff traffic generated by the game. 

if each player who wants stats outside of the game uses this client, then I don't think there's much gamespy / ea can do about it (since the stats site itself wouldn't access the stats service at all).

Offline

 

#110 08 Nov 2006 8:01 am

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

I was thinking about that as well.  I'll have to fix up my sniffer to look for Origin IP's of stella instead of destination to see what we get back.

What do you use for the winpcap.  I downloaded a project called SharpPcap that is a C# wrapper for winpcap.  I'm hesitent to distribute anything based on it since I havn't dug through all the code to make sure it isn't broadcasting my packets to an outside IP or anything.

Offline

 

#111 08 Nov 2006 8:29 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

Craigins :

What do you use for the winpcap.

I was planning on just using the normal distro provided by CACE Technologies .  If I cant directly p/invoke the library then I'll write a wrapper in C++ for it.  I haven't spent much R&D time on it though.

Offline

 

#112 08 Nov 2006 9:52 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: bf2142 stat query protocol

So, EternalDiagramIce is likely to ban or take legal actions against whoever abuses their stat databases? Hmmmm


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#113 08 Nov 2006 12:09 pm

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

http://www.tamirgal.com/home/

for more info on SharpPcap

Offline

 

#114 08 Nov 2006 1:17 pm

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

I took a look at the incoming packets form stella.  It doesn't look like it has page name in the packet.  I'm not a guru on packets and HTTP handshaking but is there any way to marry-up the outgoing request with the incoming data?

Offline

 

#115 08 Nov 2006 1:30 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

I haven't played w/ winpcap directly but there is a follow stream option in ethereal that produces the payload of the socket stream (both send and recieve), now i don't know if thats functionality provided by winpcap or whether ethereal is tracking all of that, but I'd assume that there is a way to wrap up the contents of a tcp stream.

Offline

 

#116 08 Nov 2006 2:49 pm

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

yes but the only problem with that is
player requests getplayerinfo.aspx
player requests getleaderboard.aspx
player receives getleaderboard.aspx
player receives getplayerinfo.aspx

With tcp/ip there is no way to manage which packets you will get in which order.  For instance the server might get the leaderboard request before the player info request.(if one has a bad crc or gets lost along the way).  I wonder if there is some sort of unique field for each page.  Well that wouldn't work either, since like the leaderboard can have many different types of views.

I'll have to dig into the packet data more to see what i can pull out.

Offline

 

#117 08 Nov 2006 3:05 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

thats at the TCP layer, if there is a way to filter down to the application layer (http) we'll be better off.  there's a lot of noise on the network layer (tcp) that we want to ignore.

I'll have a look at the standard distro and see if there is something in the core api that will allow filtering and stream tracing.

Offline

 

#118 08 Nov 2006 6:23 pm

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

ok i looked and I think i got it.

when you make a tcp request you find a local port open and sent the request on that port.  then the server returns the request on the same port.  Thus you must capture the outgoing port and page, then filter on the port when you get a packet to see which port it comes in on.

I'll test it out to make sure its a correct assumption.

Edit:

I just tested it out for about 15 examples and each holds true.

request goes out on port A, info comes back on port A.  I should be able to write something to capture the request packet port and page name, then watch for the incoming response and capture the data.

ugh now i just have to write a parser for each page, this won't be fun.

Last edited by Craigins (08 Nov 2006 6:53 pm)

Offline

 

#119 08 Nov 2006 8:50 pm

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

bah its not that easy.  I figured I could look for the packet coming in with the specific port  however certain requests span more than 1 packet(like weapon stats).  this means that capturing teh data will be a little trickier than I had hoped.

Offline

 

#120 10 Nov 2006 8:19 am

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

Looks like EA's site is back up and a friend said that http://www.2142-stats.com/ is back up too.

http://battlefield.ea.com/battlefield/b … ;Profiles=

Did anyone see them release an offical feed? or are they only giving it to a certain privliged few?

Offline

 

#121 10 Nov 2006 9:28 am

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: bf2142 stat query protocol

So, the one you guys made is in all ways legal?


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#122 10 Nov 2006 10:33 am

Craigins
Extreme Member
From: Chicago, IL
Registered: Oct 2006
Posts: 58
Website

Re: bf2142 stat query protocol

no idea.  either that or our cracking of their encryption caused them to shorten the timeline on te offical feed and they are currently giving it out to a few sites.

It could be that 2142-stats.com took our encryption/decryption and is using it now as well.

Offline

 

#123 16 Nov 2006 10:53 am

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

I updated the main bf2tech stats page yesterday.

If I've missed anything, please update it.

Offline

 

#124 16 Nov 2006 12:05 pm

Butcher
Moderator
From: Norway
Registered: Jul 2006
Posts: 308

Re: bf2142 stat query protocol

Had it only been understandable tongue


http://bamboocommandos.com/butcher_img/butchersig7.jpg

Offline

 

#125 16 Nov 2006 12:11 pm

MadHatter
Administrator
From: Dallas TX
Registered: Jun 2006
Posts: 529
Website

Re: bf2142 stat query protocol

you mean you haven't built your toaster that can make free long distance phone calls from this info yet?  for shame!

Offline

 



© 2003 - 2024 NullFX
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License