Brought back session viewer debug page.

This commit is contained in:
Greg Edwards
2014-07-24 13:05:40 -04:00
parent 10fc6a9c9c
commit cf88416e1d
4 changed files with 123 additions and 0 deletions

8
gts/admin/Sessions.aspx Normal file
View File

@@ -0,0 +1,8 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="Sessions.aspx.cs" Inherits="PkmnFoundations.GTS.admin.Sessions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMain" runat="server">
<asp:Literal ID="litDebug" runat="server" />
</asp:Content>

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace PkmnFoundations.GTS.admin
{
public partial class Sessions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GtsSessionManager manager = GtsSessionManager.FromContext(Context);
StringBuilder builder = new StringBuilder();
builder.Append("Active sessions (");
builder.Append(manager.Sessions4.Count);
builder.Append("):<br />");
foreach (KeyValuePair<String, GtsSession4> session in manager.Sessions4)
{
builder.Append("PID: ");
builder.Append(session.Value.PID);
builder.Append("<br />Token: ");
builder.Append(session.Value.Token);
builder.Append("<br />Hash: ");
builder.Append(session.Value.Hash);
builder.Append("<br />URL: ");
builder.Append(session.Value.URL);
builder.Append("<br />Expires: ");
builder.Append(session.Value.ExpiryDate);
builder.Append("<br /><br />");
}
builder.Append("Active GenV sessions (");
builder.Append(manager.Sessions5.Count);
builder.Append("):<br />");
foreach (KeyValuePair<String, GtsSession5> session in manager.Sessions5)
{
builder.Append("PID: ");
builder.Append(session.Value.PID);
builder.Append("<br />Token: ");
builder.Append(session.Value.Token);
builder.Append("<br />Hash: ");
builder.Append(session.Value.Hash);
builder.Append("<br />URL: ");
builder.Append(session.Value.URL);
builder.Append("<br />Expires: ");
builder.Append(session.Value.ExpiryDate);
builder.Append("<br /><br />");
}
if (Request.QueryString["data"] != null)
{
byte[] data = GtsSession4.DecryptData(Request.QueryString["data"]);
builder.Append("Data:<br />");
builder.Append(RenderHex(data.ToHexStringLower()));
builder.Append("<br />");
}
if (Request.QueryString["data5"] != null)
{
byte[] data = GtsSession5.DecryptData(Request.QueryString["data5"]);
builder.Append("Data:<br />");
builder.Append(RenderHex(data.ToHexStringLower()));
builder.Append("<br />");
}
litDebug.Text = builder.ToString();
}
private String RenderHex(String hex)
{
StringBuilder builder = new StringBuilder();
for (int x = 0; x < hex.Length; x += 16)
{
builder.Append(hex.Substring(x, Math.Min(16, hex.Length - x)));
builder.Append("<br />");
}
return builder.ToString();
}
}
}

24
gts/admin/Sessions.aspx.designer.cs generated Normal file
View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace PkmnFoundations.GTS.admin {
public partial class Sessions {
/// <summary>
/// litDebug control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litDebug;
}
}

View File

@@ -67,6 +67,7 @@
<ItemGroup>
<Content Include="admin\AddBoxes.aspx" />
<Content Include="admin\AddMusical.aspx" />
<Content Include="admin\Sessions.aspx" />
<Content Include="AllPokemon.aspx" />
<Content Include="BattleVideo.aspx" />
<Content Include="css\main.css" />
@@ -109,6 +110,13 @@
<Compile Include="admin\AddMusical.aspx.designer.cs">
<DependentUpon>AddMusical.aspx</DependentUpon>
</Compile>
<Compile Include="admin\Sessions.aspx.cs">
<DependentUpon>Sessions.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="admin\Sessions.aspx.designer.cs">
<DependentUpon>Sessions.aspx</DependentUpon>
</Compile>
<Compile Include="AllPokemon.aspx.cs">
<DependentUpon>AllPokemon.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>