Jump to content

Parsing Halo 4 Meta


Anatamize

Recommended Posts

I decompiled some HTTP web request headers whilst logging into Halo 4, and found some interesting things. Some of these things i'd like to tell some fellow programmers. These links could retrieve data from spartans, such as service records, etc with the use of parsing data.

 

Links:

 

Spartan ops: https://stats.svc.ha...type=spartanops

Ranks: https://stats.svc.ha...data?type=ranks

Waypoint version: https://app.halowayp...us/home/version

Serivce Record: https://stats.svc.ha...4/servicerecord (Replace {username} with your username)

 

Raw header-data (provided some censored tags) :

 

 

https://stats.svc.halowaypoint.com/en-us/players/*censored*/h4/servicerecord?_=*censored*OPTIONS /en-us/players/*censored*/h4/servicerecord?_=*censored* HTTP/1.1
Host: stats.svc.halowaypoint.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120621 Firefox/15.0a2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Origin: https://app.halowaypoint.com
Access-Control-Request-Method: GET
Access-Control-Request-Headers: x-343-authorization-spartan
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
E2EActivity: qK0PZTUI4Uy1iVuNe+1UXA==
Access-Control-Allow-Origin: https://app.halowaypoint.com
Access-Control-Allow-Methods: GET
Access-Control-Allow-Credentials: true
Access-Control-Max-Age: 172800
Access-Control-Allow-Headers: x-343-authorization-spartan
Date: Sun, 09 Dec 2012 06:35:52 GMT

 

 

 

Example of a VB .Net Halo 4 Service record API:

 

 

Imports System.Net
Imports System.Text
Imports System.IO
Imports System.Xml
Public Class Calculator
#Region "Detail Functions"
Private Shared Function ParseBetween(ByVal Source As String, ByVal Before As String, ByVal After As String, ByVal Offset As Integer) As String
 If String.IsNullOrEmpty(Source) Then Return String.Empty
 If Source.Contains(Before) = True Then
	 Dim Result As String = Source.Substring(Source.IndexOf(Before) + (Before.Length + Offset))
	 If Result.Contains(After) = True Then
		 If Not String.IsNullOrEmpty(After) Then Result = Result.Substring(0, Result.IndexOf(After))
	 End If
	 Return Result
 Else
	 Return String.Empty
 End If
End Function
#End Region
Private Shared SR As New XmlDocument()
Public Class Load
 Public Shared Function ServiceRecord(ByVal Username$) As Integer
	 '0 = Unsuccessful
	 '1 = Success
	 Try
		 Dim WebReq As HttpWebRequest = DirectCast(WebRequest.Create("https://stats.svc.halowaypoint.com/en-us/players/" & Username & "/h4/servicerecord"), HttpWebRequest)
		 Dim WebRes As HttpWebResponse = DirectCast(WebReq.GetResponse, HttpWebResponse)
		 Dim Reader As New StreamReader(WebRes.GetResponseStream)
		 SR.LoadXml(Reader.ReadToEnd.ToString)
		 Return SR.DocumentElement("StatusCode").InnerText 'This will return either 0 or 1 or 3(not found)
	 Catch
		 Return 0 'If it failed to get the response then it will return 0 by default.
	 End Try
 End Function
End Class
Public Class Parse 'Only use this class once you've loaded a service record! Otherwise you will get errors.
 Public Class Emblem
	 Public Shared Function EmblemURL() As String
		 Return SR.DocumentElement("EmblemImageUrl").ChildNodes(1).InnerText
	 End Function
	 Public Shared Function Emblem(ByVal EmblemURL$, ByVal SquarePx As Integer) As Bitmap '128 SquarePx maximum
		 Dim RequestBitmap As HttpWebRequest = HttpWebRequest.Create("https://emblems.svc.halowaypoint.com/h4/emblems/" & EmblemURL.Replace("{size}", SquarePx)) : RequestBitmap.Method = "GET"
		 Dim EmblemBitmap As Bitmap = New Bitmap(RequestBitmap.GetResponse().GetResponseStream)
		 Return EmblemBitmap
	 End Function
 End Class
 Public Class Spartan
	 Public Shared Function BodyArmor(ByVal Gamertag$, ByVal ArmorSize As String) As Bitmap 'Sizes = small, medium, large
		 Dim RequestBitmap As HttpWebRequest = HttpWebRequest.Create("https://spartans.svc.halowaypoint.com/players/" & Gamertag & "/h4/spartans/fullbody?target=" & ArmorSize) : RequestBitmap.Method = "GET"
		 Dim ArmorBitmap As Bitmap = New Bitmap(RequestBitmap.GetResponse().GetResponseStream)
		 Return ArmorBitmap
	 End Function
	 Public Shared Function FavoriteWeapon(ByVal GunURL$, ByVal GunSize As String) As Bitmap
		 Dim RequestBitmap As HttpWebRequest = HttpWebRequest.Create("https://assets.halowaypoint.com/games/h4/damage-types/v1/" & GunURL.Replace("{size}", GunSize)) : RequestBitmap.Method = "GET"
		 Dim GunBitmap As Bitmap = New Bitmap(RequestBitmap.GetResponse().GetResponseStream)
		 Return GunBitmap
	 End Function
	 Public Shared Function FavoriteWeaponURL() As String
		 Return SR.DocumentElement("FavoriteWeaponImageUrl").ChildNodes(1).InnerText
	 End Function
	 Public Shared Function FavoriteWeapon() As String
		 Return SR.DocumentElement("FavoriteWeaponName").InnerText
	 End Function
	 Public Shared Function FavoriteWeaponKills() As String
		 Return SR.DocumentElement("FavoriteWeaponTotalKills").InnerText
	 End Function
	 Public Shared Function FavoriteWeaponDescription() As String
		 Return SR.DocumentElement("FavoriteWeaponDescription").InnerText
	 End Function
	 Public Shared Function SpartanTag() As String
		 Return SR.DocumentElement("ServiceTag").InnerText
	 End Function
 End Class
 Public Class Statistics
	 Public Class SpartanRank
		 Public Shared Function SpartanRank() As Integer
			 Return Convert.ToInt32(SR.DocumentElement("RankName").InnerText)
		 End Function
		 Public Shared Function Rank_XpCurrently() As Integer
			 Return Convert.ToInt32(SR.DocumentElement("XP").InnerText) - Convert.ToInt32(SR.DocumentElement("RankStartXP").InnerText)
		 End Function
		 Public Shared Function Rank_XpRemains() As Integer
			 Return Convert.ToInt32(SR.DocumentElement("NextRankStartXP").InnerText) - Convert.ToInt32(SR.DocumentElement("XP").InnerText)
		 End Function
		 Public Shared Function Rank_XpEnds() As Integer
			 Return Convert.ToInt32(SR.DocumentElement("NextRankStartXP").InnerText) - Convert.ToInt32(SR.DocumentElement("RankStartXP").InnerText)
		 End Function
		 Public Shared Function Rank_XpPercent() As Decimal
			 Return Math.Round(Rank_XpCurrently() / Rank_XpEnds(), 2) * 100
		 End Function
	 End Class
	 Public Class GameModes
		 Public Class WarGames
			 Public Shared Function Kills(ByVal CustomGames As Boolean) As Integer
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(12).InnerText
			 End Function
			 Public Shared Function Deaths(ByVal CustomGames As Boolean) As Integer
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(.InnerText
			 End Function
			 Public Shared Function KillDeathRatio(ByVal CustomGames As Boolean) As Decimal
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(6).InnerText
			 End Function
			 Public Shared Function GamesCompleted(ByVal CustomGames As Boolean) As Integer
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(10).InnerText
			 End Function
			 Public Shared Function GamesWon(ByVal CustomGames As Boolean) As Integer
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(11).InnerText
			 End Function
			 Public Shared Function GamesWinLossRatio(ByVal CustomGames As Boolean) As Decimal
				 Dim IntCustomGames% = New Integer
				 Select Case CustomGames
					 Case False
						 IntCustomGames = 0
					 Case True
						 IntCustomGames = 1
				 End Select
				 Return Math.Round(GamesWon(IntCustomGames) / (GamesCompleted(IntCustomGames) - GamesWon(IntCustomGames)), 1)
			 End Function
			 Public Shared Function AveragePersonalScore(ByVal CustomGames As Boolean) As Integer
				 Dim KillElement As XmlElement = SR.DocumentElement("GameModes")
				 Select Case CustomGames
					 Case False
						 KillElement = KillElement.ChildNodes(2)
					 Case True
						 KillElement = KillElement.ChildNodes(3)
				 End Select
				 Return KillElement.ChildNodes(4).InnerText
			 End Function
		 End Class
	 End Class
 End Class
 Public Shared Function Gamertag() As String
	 Return SR.DocumentElement("Gamertag").InnerText
 End Function
End Class
End Class

 

 

 

Example of a program integrated with previous API (I will not release source) :

 

bab961012eb8d542ad2587b3c47c8115.png?1355035432

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...