A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

C# LGAuth [Private]

807 views · started by Chris ·
#1
C# LGAuth [Private]
using System;
using System.Drawing;
using System.Net;
using System.IO;
using System.Windows.Forms;

static class LGAuth
{
public static Boolean Auth(String Username, String Password, String Key)
{
HTTPWrapper Wrapper = new HTTPWrapper();
String Gpc = Key.Substring(0, (int)Math.Round((Decimal)Key.Length / 2)) + (new Random((Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds).Next());
Bitmap AuthImage = (Bitmap)Image.FromStream((Stream)Wrapper.get_stream("http://logicalgamers.com/auth/auth.php?user=" + Username + "&pass=" + Password + "&key=" + Key + "&gpc=" + Gpc));
String Crypt = "";
for (int y = 0; y < AuthImage.Width; y++)
{
for (int x = 0; x < AuthImage.Width; x++)
{
Crypt += ((Char)AuthImage.GetPixel(x, y).R).ToString();
}
}
int SkipStart = Int32.Parse(Crypt.Substring(0, Crypt.IndexOf("/")));
Crypt = Crypt.Substring((Crypt.IndexOf("/") + 1), Crypt.Length - (Crypt.IndexOf("/") + 1));
String Decrypt = Decode(Crypt.Substring(0, SkipStart) + Crypt.Substring((SkipStart + 10), Crypt.IndexOf("&") - (SkipStart + 10)));
String[] rawInfo = Decrypt.Split('/');
String rawGpc = Crypt.Substring((Crypt.IndexOf("&") + 1), 16);
if (rawInfo[0] == Username && rawInfo[1] == Key && rawInfo[2] == Password && Gpc.IndexOf(rawGpc) > -1)
{
return true;
}
return false;
}

private static String Decode(String Crypt)
{
return System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(Crypt));
}
}[/2][/1][/0]


You need to use my HTTPWrappers, provided here, for this to function properly.

This method does NOT save the image on the user's computer, and rather parses it with a memory stream.

This method also fully decrypts Arti's encryption, meaning it will obtain the data properly and without unsafe operations.
#2
Thanks chris, I'll be using this on my next big project.
#3
I updated the auth, make sure to use it or it wont work <3
#4
The auth was once again improved, I removed a small bit of data that was not needed. Also I fixed the image reading method because as Artificial stated to me, "If the user has a long username or password, it can loop down to the next row/y axis." So it not reads all of the pixels for text and properly checks the data.
#5
There is a problem with this authorization. You can't use it with Console Applications.
#6
Chad wrote:
There is a problem with this authorization. You can't use it with Console Applications.


What specifically is wrong?
#7
Console applications do not support System.Drawing and some other thing.
#8
Which will force you to use normal apps untill further notice.