It still needs a little fixing but it'll work for now. This is just one method of checking. I have others.
Leave the credits in it.
PHP Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Windows.Forms;
using System.Drawing;
using System.Net;
using System.IO;
using System.Threading;
public static class LogicalGamers
{
#region Credits
//Sk8er's idea of the way to do the auth.
//Coded by Chad
//PS: Sk8er has his own way of doing his auth.
#endregion
#region Declarings
private static String LG_URL_Main = "http://logicalgamers.com/";
private static String LG_URL_Auth = "auth/auth.php?";
private static Random random = new Random();
public static HTTPWrapper Wrapper = null;
private static String rnd;
private static WebClient client = new WebClient();
private static String Results = "stfu";
private static String str = String.Empty;
private static String[] Info = new String[6];
#endregion
#region Authorize
public static bool Authorize(String Username, String Password, String Program_Key)
{
rnd = random.Next(random.Next(1, 500000), random.Next(500001, 1000000)).ToString();
//Results = Wrapper.Get(LG_URL_Main + LG_URL_Auth + "user=" + Username + "&pass=" + Password + "&key=" + Program_Key.ToString() + "&gpc=" + rnd.ToString());
if (Wrapper.Get(LG_URL_Main + LG_URL_Auth + "user=" + Username + "&pass=" + Password + "&key=" + Program_Key.ToString() + "&gpc=" + rnd.ToString()).IndexOf("GIF") > -1)
{
Uri img = new Uri(LG_URL_Main + LG_URL_Auth + "user=" + Username + "&pass=" + Password + "&key=" + Program_Key.ToString() + "&gpc=" + rnd.ToString() + ".gif");
client.DownloadFileAsync(img, "filae.jpg");
Thread.Sleep(2500);
Char chaVal;
Bitmap objBitmap = new Bitmap(@"filae.jpg");
objBitmap = new Bitmap(@"filae.jpg");
for (int x = 0; x < objBitmap.Width; x++)
{
Color col = objBitmap.GetPixel(x, 0);
chaVal = (Char)col.R;
str += chaVal.ToString();
}
#region Information
//Info[0] = First to numbers before / at beginning
//Info[1] = Username Than username decoded.
//Info[2] = Randomized String
//Info[3] = Key?
#endregion
Info[0] = str.Substring(0,2);
Info[1] = Wrapper.Between(str, "/", "80Ym");
Info[4] = Wrapper.Between(str, Info[0], "ï");
str = str.Replace(Info[0] + "/" + Info[1] + "80Ym", String.Empty);
Info[1] = Decode(Info[1] + "==");
Info[2] = Wrapper.Between(str, "&", ".gif");
if (Info[1] == Username && Info[2] == rnd && Program_Key.Contains(Info[4]))
{
// DeleteAuth("filae.jpg");
return true;
}
}
return false;
}
public static void DeleteAuth(String Name)
{
File.Delete(Name);
}
#endregion
#region Other
public static String md5(String Password)
{
return System.Text.RegularExpressions.Regex.Replace(BitConverter.ToString((new MD5CryptoServiceProvider()).ComputeHash(ASCIIEncoding.Default.GetBytes(Password))), "-", "").ToLower();
}
public static string Encode(string data)
{
try
{
byte[] encData_byte = new byte[data.Length];
encData_byte = System.Text.Encoding.UTF8.GetBytes(data);
string encodedData = Convert.ToBase64String(encData_byte);
return encodedData;
}
catch (Exception e)
{
throw new Exception("Error in base64Encode" + e.Message);
}
}
public static string Decode(string data)
{
try
{
System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
System.Text.Decoder utf8Decode = encoder.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(data);
int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];
utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
string result = new String(decoded_char);
return result;
}
catch (Exception e)
{
return e.Message;
}
}
#endregion
}
Results 1 to 3 of 3
Thread: C# Auth for LG
- 18 Jul. 2010 03:14am #1
C# Auth for LG
- 19 Jul. 2010 03:45pm #2
- 20 Jul. 2010 05:46pm #3
Your welcome, and i wont be on much. It's hell week for football so I wont be on a lot for this week. Can barley type.
Heres just an update for you guys.
1.) Get up at 40 AM and do a 1 mile and a half run to a hill.
2.) At the hill we sprint up and down 25 times.
3.) Run back to football field.
4.) Break for 30 minutes.
5.) Eat breakfast.
6.) Chill for an hour.
7.) Do something we call "County Fair Run" which consists of running for 30 minutes straight doing different drills.
8.) get 2 hour break and go home or stay at field.
9.) Go back at 110 AM for 2 hour practice
10.) 2:00 PM, hit the weights for 2 hours.
11.) Get 3 hour break and go home and get some sleep.
12.) 60 PM Competitions until 10:00 PM or later.
Repeat. Really no time to get on.