diff --git a/pkmnFoundations.sln b/pkmnFoundations.sln index dbfe8650..1019d59b 100644 --- a/pkmnFoundations.sln +++ b/pkmnFoundations.sln @@ -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 diff --git a/sslProxy/Program.cs b/sslProxy/Program.cs new file mode 100644 index 00000000..71109c6e --- /dev/null +++ b/sslProxy/Program.cs @@ -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); + }); + + } + } +} diff --git a/sslProxy/Properties/AssemblyInfo.cs b/sslProxy/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..4e3c99f3 --- /dev/null +++ b/sslProxy/Properties/AssemblyInfo.cs @@ -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")] diff --git a/sslProxy/iis private key.pfx b/sslProxy/iis private key.pfx new file mode 100644 index 00000000..0b187427 Binary files /dev/null and b/sslProxy/iis private key.pfx differ diff --git a/sslProxy/sslProxy.csproj b/sslProxy/sslProxy.csproj new file mode 100644 index 00000000..aab79f60 --- /dev/null +++ b/sslProxy/sslProxy.csproj @@ -0,0 +1,62 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {50712E7D-EA8E-4B0D-A896-09008F819F42} + Exe + Properties + sslProxy + sslProxy + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Always + + + + + \ No newline at end of file