Kayak works how I want it :) 'secure' authentication

This commit is contained in:
RaidMax 2015-08-23 22:35:04 -05:00
parent feb37123e2
commit 7ae6c7e07f
21 changed files with 83 additions and 176 deletions

BIN
Admin/IW4AdminIcon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -70,7 +70,7 @@
<SignManifests>false</SignManifests> <SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>IW4MAdmin.ico</ApplicationIcon> <ApplicationIcon>IW4AdminIcon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<StartupObject>IW4MAdmin.Program</StartupObject> <StartupObject>IW4MAdmin.Program</StartupObject>
@ -126,8 +126,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="lib\System.Data.SQLite.dll"> <None Include="lib\System.Data.SQLite.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<Content Include="IW4AdminIcon.ico" />
<Content Include="lib\AdminInterface.dll"> <Content Include="lib\AdminInterface.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -137,7 +138,7 @@
<Content Include="lib\SQLite.Interop.dll"> <Content Include="lib\SQLite.Interop.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="plugins\SamplePlugin.dll"> <Content Include="plugins\SimpleStatsPlugin.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="plugins\WebfrontPlugin.dll"> <Content Include="plugins\WebfrontPlugin.dll">
@ -225,9 +226,6 @@
<Install>true</Install> <Install>true</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="IW4MAdmin.ico" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PublishFile Include="config\maps.cfg"> <PublishFile Include="config\maps.cfg">
<Visible>False</Visible> <Visible>False</Visible>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 361 KiB

View File

@ -436,7 +436,6 @@ namespace IW4MAdmin
eventQueueThread.Start(); eventQueueThread.Start();
long l_size = -1; long l_size = -1;
bool checkedForOutdate = false;
String[] lines = new String[8]; String[] lines = new String[8];
String[] oldLines = new String[8]; String[] oldLines = new String[8];
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
@ -952,8 +951,6 @@ namespace IW4MAdmin
//Objects //Objects
private Queue<String> commandQueue; private Queue<String> commandQueue;
//Info
//Will probably move this later //Will probably move this later
private IntPtr dllPointer; private IntPtr dllPointer;
public IntPtr lastCommandPointer; public IntPtr lastCommandPointer;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -33,23 +33,11 @@
return true; return true;
}); });
}); });
$(function () { $(function () {
$('a').click(function (e) { $('.pseudoLinkIP').click(function (e) {
e.stopPropagation();
e.preventDefault(); e.preventDefault();
var href = this.href; $(this).next().toggle('fast');
var parts = href.split('?'); return true;
var url = parts[0];
console.log(parts);
var params = parts[1].split('?');
var pp, inputs = '';
for (var i = 0, n = params.length; i < n; i++) {
pp = params[i].split('=');
inputs += '<input type="hidden" name="' + pp[0] + '" value="' + pp[1] + '" />';
}
$("body").append('<form action="' + url + '" method="post" id="sneakySneaky">' + inputs + '</form>');
$("#poster").submit();
}); });
}); });
</script> </script>

View File

@ -2,4 +2,4 @@
<div class="h0" style="margin-top: 0; line-height:normal;">STATS<br /><a style="padding: 0; margin: 0; font-size: 24px; float: right;" href="/">Back</a></div> <div class="h0" style="margin-top: 0; line-height:normal;">STATS<br /><a style="padding: 0; margin: 0; font-size: 24px; float: right;" href="/">Back</a></div>
<div id="logo_shit"></div> <div id="logo_shit"></div>
{{STATS}} {{STATS}}
</div> </div>

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013 # Visual Studio 14
VisualStudioVersion = 12.0.30723.0 VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M ADMIN.csproj", "{DD5DCDA2-51DB-4B1A-922F-5705546E6115}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M ADMIN.csproj", "{DD5DCDA2-51DB-4B1A-922F-5705546E6115}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
@ -12,13 +12,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IW4M ADMIN", "Admin\IW4M AD
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibary\SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedLibrary", "SharedLibary\SharedLibrary.csproj", "{D51EECEB-438A-47DA-870F-7D7B41BC24D6}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamplePlugin", "SamplePlugin\SamplePlugin.csproj", "{4785AB75-66F3-4391-985D-63A5A049A0FA}"
ProjectSection(ProjectDependencies) = postProject
{D51EECEB-438A-47DA-870F-7D7B41BC24D6} = {D51EECEB-438A-47DA-870F-7D7B41BC24D6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webfront Plugin", "Webfront Plugin\Webfront Plugin.csproj", "{99E36EBD-1FA1-494C-8A66-BECE64EFF378}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Webfront Plugin", "Webfront Plugin\Webfront Plugin.csproj", "{99E36EBD-1FA1-494C-8A66-BECE64EFF378}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stats Plugin", "Stats Plugin\Stats Plugin.csproj", "{4785AB75-66F3-4391-985D-63A5A049A0FA}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -33,14 +30,14 @@ Global
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.Build.0 = Release|Any CPU {D51EECEB-438A-47DA-870F-7D7B41BC24D6}.Release|Any CPU.Build.0 = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.Build.0 = Release|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.Build.0 = Debug|Any CPU {99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.ActiveCfg = Release|Any CPU {99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.Build.0 = Release|Any CPU {99E36EBD-1FA1-494C-8A66-BECE64EFF378}.Release|Any CPU.Build.0 = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4785AB75-66F3-4391-985D-63A5A049A0FA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

Binary file not shown.

View File

@ -12,7 +12,8 @@ namespace SharedLibrary
public abstract void onEvent(Event E); public abstract void onEvent(Event E);
//for logging purposes //for logging purposes
public abstract string Name { get; } public abstract String Name { get; }
public abstract float Version { get; } public abstract float Version { get; }
public abstract String Author { get; }
} }
} }

View File

@ -161,12 +161,26 @@ namespace SamplePlugin
public override string Name public override string Name
{ {
get { return "Basic Stats"; } get
{
return "Basic Stats";
}
} }
public override float Version public override float Version
{ {
get { return 0.1f; } get
{
return 0.1f;
}
}
public override string Author
{
get
{
return "RaidMax";
}
} }
} }

View File

@ -47,7 +47,7 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\plugins\$SimpleStatsPlugin.dll"</PostBuildEvent> <PostBuildEvent>copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)Admin\plugins\SimpleStatsPlugin.dll"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -43,6 +43,8 @@ namespace Webfront_Plugin
if (querySet["server"] != null) if (querySet["server"] != null)
requestedServer = activeServers.Find(x => x.pID() == Int32.Parse(querySet["server"])); requestedServer = activeServers.Find(x => x.pID() == Int32.Parse(querySet["server"]));
else
requestedServer = activeServers.First();
if (querySet["page"] != null) if (querySet["page"] != null)
requestPageNum = Int32.Parse(querySet["page"]); requestPageNum = Int32.Parse(querySet["page"]);
@ -237,43 +239,47 @@ namespace Webfront_Plugin
continue; continue;
buffer.Append("<tr>"); buffer.Append("<tr>");
StringBuilder str = new StringBuilder(); StringBuilder Names = new StringBuilder();
List<Aliases> allAlliases = S.getAliases(Player);
List<String> nameAlias = new List<String>(); List<String> nameAlias = new List<String>();
List<String> IPAlias = new List<String>(); List<String> IPAlias = new List<String>();
foreach (Aliases A in allAlliases)
{
foreach (String Name in A.Names.Distinct())
nameAlias.Add(Name);
if (Authenticated)
{
foreach (String IP in A.IPS.Distinct())
IPAlias.Add(IP);
}
}
str.Append("<a href='#' class='pseudoLinkAlias'>Show Aliases</a>");
str.Append("<div class='playerAlias'>");
foreach (String Name in nameAlias.Distinct())
str.AppendFormat("<span>{0}</span><br/>", Utilities.stripColors(Name));
str.Append("</div>");
StringBuilder IPs = new StringBuilder(); StringBuilder IPs = new StringBuilder();
if (Authenticated) if (Authenticated)
{ {
IPs.Append("<a href='#'><span class='pseudoLinkIP'><i>Show IPs</i></span></a>"); List<Aliases> allAlliases = S.getAliases(Player);
foreach (Aliases A in allAlliases)
{
foreach (String Name in A.Names.Distinct())
nameAlias.Add(Name);
foreach (String IP in A.IPS.Distinct())
IPAlias.Add(IP);
}
Names.Append("<a href='#' class='pseudoLinkAlias'>Show Aliases</a>");
Names.Append("<div class='playerAlias'>");
foreach (String Name in nameAlias.Distinct())
Names.AppendFormat("<span>{0}</span><br/>", Utilities.stripColors(Name));
Names.Append("</div>");
IPs.Append("<a href='#' class='pseudoLinkIP'>Show IPs</a>");
IPs.Append("<div class='playerIPs'>"); IPs.Append("<div class='playerIPs'>");
foreach (String IP in IPAlias) foreach (String IP in IPAlias)
IPs.AppendFormat("<span>{0}</span><br/>", IP); IPs.AppendFormat("<span>{0}</span><br/>", IP);
IPs.Append("</div>"); IPs.Append("</div>");
} }
else
if (!Authenticated)
{
Names.Append("Hidden");
IPs.Append("Hidden"); IPs.Append("Hidden");
}
Int64 forumID = 0; Int64 forumID = 0;
if (Player.npID.Length == 16) if (Player.npID.Length == 16)
{ {
@ -284,9 +290,9 @@ namespace Webfront_Plugin
String Screenshot = String.Empty; String Screenshot = String.Empty;
//if (logged) //if (logged)
Screenshot = String.Format("<a href='http://server.nbsclan.org/screen.php?id={0}&name={1}' target='_blank'><div style='background-image:url(http://server.nbsclan.org/shutter.png); width: 20px; height: 20px;float: right; position:relative; right: 21%; background-size: contain;'></div></a>", forumID, Player.Name); Screenshot = String.Format("<a href='http://server.nbsclan.org/screen.php?id={0}&name={1}' target='_blank'><div style='background-image:url(http://server.nbsclan.org/shutter.png); width: 20px; height: 20px;float: right; position:relative; right: 21%; background-size: contain;'></div></a>", forumID, Player.Name);
buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, str, IPs, 0, SharedLibrary.Utilities.levelHTMLFormatted(Player.Level), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/player?id=" + Player.databaseID, Screenshot); buffer.AppendFormat("<td><a style='float: left;' href='{9}'>{0}</a>{10}</td><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td><td>{5}</td><td>{6} ago</td><td><a href='https://repziw4.de/memberlist.php?mode=viewprofile&u={7}'>{8}</a></td>", Player.Name, Names, IPs, 0, SharedLibrary.Utilities.levelHTMLFormatted(Player.Level), Player.Connections, Player.getLastConnection(), forumID, Player.Name, "/player?id=" + Player.databaseID, Screenshot);
buffer.Append("</tr>"); buffer.Append("</tr>");
} }

View File

@ -45,5 +45,13 @@ namespace Webfront_Plugin
{ {
get { return 0.1f; } get { return 0.1f; }
} }
public override string Author
{
get
{
return "RaidMax";
}
}
} }
} }

View File

@ -13,40 +13,19 @@ namespace Webfront_Plugin
public static IScheduler webScheduler { get; private set; } public static IScheduler webScheduler { get; private set; }
public static Framework webFront { get; private set; } public static Framework webFront { get; private set; }
public static IPAddress lastIP; public static IPAddress lastIP;
public static IServer webServer;
public static void Init() public static void Init()
{ {
webScheduler = KayakScheduler.Factory.Create(new SchedulerDelegate()); webScheduler = KayakScheduler.Factory.Create(new SchedulerDelegate());
var server = KayakServer.Factory.Create(new ServerDelegate(), webScheduler); webServer = KayakServer.Factory.CreateHttp(new RequestDelegate(), webScheduler);
webFront = new Framework(); webFront = new Framework();
using (server.Listen(new IPEndPoint(IPAddress.Any, 1624))) using (webServer.Listen(new IPEndPoint(IPAddress.Any, 1624)))
webScheduler.Start(); webScheduler.Start();
} }
} }
class HttpServerDelegate : IServerDelegate
{
IHttpRequestDelegate requestDelegate;
public HttpServerDelegate(IHttpRequestDelegate requestDelegate)
{
this.requestDelegate = requestDelegate;
}
public ISocketDelegate OnConnection(IServer server, ISocket socket)
{
// Kayak.Http.IHttpServerFactory
}
public void OnClose(IServer server)
{
}
}
class SchedulerDelegate : ISchedulerDelegate class SchedulerDelegate : ISchedulerDelegate
{ {
public void OnException(IScheduler scheduler, Exception e) public void OnException(IScheduler scheduler, Exception e)
@ -64,52 +43,9 @@ namespace Webfront_Plugin
{ {
public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response) public void OnRequest(HttpRequestHead request, IDataProducer requestBody, IHttpResponseDelegate response)
{ {
/*if (request.Method.ToUpperInvariant() == "POST" && request.Uri.StartsWith("/bufferedecho")) DefaultKayakServer castCrap = (DefaultKayakServer)Manager.webServer;
{ Manager.lastIP = castCrap.clientAddress.Address;
// when you subecribe to the request body before calling OnResponse,
// the server will automatically send 100-continue if the client is
// expecting it.
requestBody.Connect(new BufferedConsumer(bufferedBody =>
{
var headers = new HttpResponseHead()
{
Status = "200 OK",
Headers = new Dictionary<string, string>()
{
{ "Content-Type", "text/plain" },
{ "Content-Length", request.Headers["Content-Length"] },
{ "Connection", "close" }
}
};
response.OnResponse(headers, new BufferedProducer(bufferedBody));
}, error =>
{
// XXX
// uh oh, what happens?
}));
}
else if (request.Method.ToUpperInvariant() == "POST" && request.Uri.StartsWith("/echo"))
{
var headers = new HttpResponseHead()
{
Status = "200 OK",
Headers = new Dictionary<string, string>()
{
{ "Content-Type", "text/plain" },
{ "Connection", "close" }
}
};
if (request.Headers.ContainsKey("Content-Length"))
headers.Headers["Content-Length"] = request.Headers["Content-Length"];
// if you call OnResponse before subscribing to the request body,
// 100-continue will not be sent before the response is sent.
// per rfc2616 this response must have a 'final' status code,
// but the server does not enforce it.
response.OnResponse(headers, requestBody);
}*/
string body = Manager.webFront.processRequest(request); string body = Manager.webFront.processRequest(request);
var headers = new HttpResponseHead() var headers = new HttpResponseHead()
{ {
@ -122,44 +58,6 @@ namespace Webfront_Plugin
}; };
response.OnResponse(headers, new BufferedProducer(body)); response.OnResponse(headers, new BufferedProducer(body));
/*
if (request.Uri.StartsWith("/"))
{
var body = string.Format(
"Hello world.\r\nHello.\r\n\r\nUri: {0}\r\nPath: {1}\r\nQuery:{2}\r\nFragment: {3}\r\n",
request.Uri,
request.Path,
request.QueryString,
request.Fragment);
var headers = new HttpResponseHead()
{
Status = "200 OK",
Headers = new Dictionary<string, string>()
{
{ "Content-Type", "text/plain" },
{ "Content-Length", body.Length.ToString() },
}
};
response.OnResponse(headers, new BufferedProducer(body));
}
else
{
var responseBody = "The resource you requested ('" + request.Uri + "') could not be found.";
var headers = new HttpResponseHead()
{
Status = "404 Not Found",
Headers = new Dictionary<string, string>()
{
{ "Content-Type", "text/plain" },
{ "Content-Length", responseBody.Length.ToString() }
}
};
var body = new BufferedProducer(responseBody);
response.OnResponse(headers, body);
}*/
} }
} }