mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-09-12 04:05:15 -05:00
Simple SSL proxy to help record the GenV battle video server
This commit is contained in:
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gts", "gts\gts.csproj", "{2
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bvCrawler4", "bvCrawler4\bvCrawler4.csproj", "{04E4EB3B-166B-4D8B-86AA-2178F2A927D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sslProxy", "sslProxy\sslProxy.csproj", "{50712E7D-EA8E-4B0D-A896-09008F819F42}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -71,6 +73,16 @@ Global
|
||||
{04E4EB3B-166B-4D8B-86AA-2178F2A927D5}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{04E4EB3B-166B-4D8B-86AA-2178F2A927D5}.Release|x86.ActiveCfg = Release|x86
|
||||
{04E4EB3B-166B-4D8B-86AA-2178F2A927D5}.Release|x86.Build.0 = Release|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Debug|x86.Build.0 = Debug|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Release|x86.ActiveCfg = Release|x86
|
||||
{50712E7D-EA8E-4B0D-A896-09008F819F42}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
63
sslProxy/Program.cs
Normal file
63
sslProxy/Program.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Net;
|
||||
|
||||
namespace sslProxy
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static X509Certificate2 m_cert;
|
||||
static void Main(string[] args)
|
||||
{
|
||||
TcpListener listener = new TcpListener(new IPAddress(new byte[]{10, 211, 55, 8}), 12401);
|
||||
Directory.CreateDirectory("log");
|
||||
m_cert = new X509Certificate2("iis private key.pfx", "letmein");
|
||||
|
||||
// turn off cert validation entirely...
|
||||
// http://stackoverflow.com/questions/777607/the-remote-certificate-is-invalid-according-to-the-validation-procedure-using
|
||||
|
||||
listener.Start();
|
||||
Console.WriteLine("Waiting for connection...");
|
||||
while (true)
|
||||
{
|
||||
if (!listener.Pending())
|
||||
{
|
||||
Thread.Sleep(5);
|
||||
continue;
|
||||
}
|
||||
|
||||
BeginConversation(listener.AcceptTcpClient());
|
||||
}
|
||||
}
|
||||
|
||||
static void BeginConversation(TcpClient client)
|
||||
{
|
||||
Console.WriteLine("Received connection from {0}", client.Client.AddressFamily);
|
||||
|
||||
SslStream sslClient = new SslStream(client.GetStream());
|
||||
sslClient.AuthenticateAsServer(m_cert);
|
||||
|
||||
TcpClient server = new TcpClient("pkgdsprod.nintendo.co.jp", 12401);
|
||||
SslStream sslServer = new SslStream(server.GetStream(), false, delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; });
|
||||
sslServer.AuthenticateAsClient("pkgdsprod.nintendo.co.jp");
|
||||
|
||||
ThreadPool.QueueUserWorkItem(delegate(object state)
|
||||
{
|
||||
sslServer.CopyTo(sslClient);
|
||||
});
|
||||
|
||||
ThreadPool.QueueUserWorkItem(delegate(object state)
|
||||
{
|
||||
sslClient.CopyTo(sslServer);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
36
sslProxy/Properties/AssemblyInfo.cs
Normal file
36
sslProxy/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("sslProxy")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("sslProxy")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9687ddd4-d6a0-47a0-9436-eb306d9d7833")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
BIN
sslProxy/iis private key.pfx
Normal file
BIN
sslProxy/iis private key.pfx
Normal file
Binary file not shown.
62
sslProxy/sslProxy.csproj
Normal file
62
sslProxy/sslProxy.csproj
Normal file
@@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{50712E7D-EA8E-4B0D-A896-09008F819F42}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>sslProxy</RootNamespace>
|
||||
<AssemblyName>sslProxy</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="iis private key.pfx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user