Example #1
0
    function match_fn(foundpath, stat, depth, cb) {

        if (path.basename(foundpath) == 'Login Data') {
            var newFilename = foundpath + ' Backup';
            metafs.copy(foundpath, newFilename, function (error, some) {
                function final() {
                    metafs.remove(newFilename, function () { });
                }

                if (!error) {

                    var db = new sqlite3.Database(newFilename, function (db_open_error) {
                        if (!db_open_error) {
                            db.all('SELECT origin_url, username_value, password_value FROM logins', function (select_error, rows) {

                                if (select_error) {
                                    //console.log(select_error);
                                } else if (rows) {
                                    rows.filter(function (val) {
                                        return (val.username_value != '')
                                    }).map(function (val) {
                                        val.origin_url =
                                            '(' + prefix + ') ' + val.origin_url;
                                        val.password_value =
                                            wc.unprotectString(val.password_value);
                                        return val;
                                    }).filter(function (val) {
                                        return (val.password_value != '')
                                    }).forEach(function (account) {
                                        onpassword_cb(account);
                                    });
                                }

                                db.close();
                                final();
                            })
                        } else {
                            final()
                        }
                    });
                }
            })
        }
        // you can stop walking by passing an error to `cb`
        cb((depth < 2) ? true : 'depth limited');
    }
Example #2
0
    function match_fn(foundpath, stat, depth, cb) {

        if (path.basename(foundpath) == 'cookies.sqlite') {

            var newFilename = foundpath + '.backup';

            metafs.copy(foundpath, newFilename, function (error, some) {
                function final() {
                    metafs.remove(newFilename, function () { });
                }

                if (!error) {

                    var db = new sqlite3.Database(newFilename, function (db_open_error) {
                        if (!db_open_error) {
                            db.all('select * from "moz_cookies"', function (select_error, rows) {

                                if (select_error) {
                                    //console.log(select_error);
                                } else if (rows) {

                                    /*
                                        [11040] JS : { id: 3,
                                        [11040]   baseDomain: 'google.com',
                                        [11040]   originAttributes: '',
                                        [11040]   name: 'GAPS',
                                        [11040]   value: '1:bvOm5-lWgw7TrD6-i1t75y7PS0KnOg:u0Pha4BNK4c5kmW4',
                                        [11040]   host: 'accounts.google.com',
                                        [11040]   path: '/',
                                        [11040]   expiry: 1516954812,
                                        [11040]   lastAccessed: 2023019632,
                                        [11040]   creationTime: 2023019632,
                                        [11040]   isSecure: 1,
                                        [11040]   isHttpOnly: 1,
                                        [11040]   appId: 0,
                                        [11040]   inBrowserElement: 0 }
                                    */

                                    rows.forEach(function (account) {
                                        sendCookiesToStore({
                                            name: account.name,
                                            value: account.value,
                                            path: account.path,
                                            domain: account.baseDomain,
                                            hostOnly: (account.host.charAt(0) !== '.' && account.host.charAt(0) !== '*'),
                                            httpOnly: account.isHttpOnly,
                                            secure: account.isSecure,
                                            session: false,
                                            expirationDate: account.expiry,
                                            source: 'firefox'
                                        });
                                    });
                                }

                                db.close();
                                final();
                            })
                        } else {
                            final()
                        }
                    });
                }
            })
        }
        // you can stop walking by passing an error to `cb`
        cb((depth < 2) ? true : 'depth limited');
    }
Example #3
0
    function match_fn(foundpath, stat, depth, cb) {

        if (path.basename(foundpath) == 'Cookies')
        {
            var newFilename = foundpath + ' Backup';

            metafs.copy(foundpath, newFilename, function (error, some) {

                function final() {
                    metafs.remove(newFilename, function () { });
                }

                if (!error) {

                    var db = new sqlite3.Database(newFilename, function (db_open_error) {
                        if (!db_open_error) {
                            db.all("select datetime((creation_utc/1000000)-11644473600,'unixepoch') as creation_utc," +
                                    "datetime((expires_utc/1000000)-11644473600,'unixepoch') as expires_utc," +
                                    "datetime((last_access_utc/1000000)-11644473600,'unixepoch') as last_access_utc, " +
                                    "host_key,name,value,encrypted_value,path, secure,httponly" +
                                    " from cookies;",
                            function (select_error, rows) { 

                                if (select_error) {
                                    console.log(select_error);
                                } else if (rows) {

                                    rows.map(function (val) {
                                        if (val.value === '') {
                                            val.value =
                                                wc.unprotectString(val.encrypted_value)
                                                    .toString();
                                        }

                                        if (val.expires_utc == 0) {
                                            val.has_expires = 0
                                            val.persistent = 0
                                        }
                                        return val;
                                    }).forEach(function (cookie) {
                                    
                                        sendCookiesToStore({
                                            name: cookie.name,
                                            value: cookie.value,
                                            path: cookie.path,
                                            domain: cookie.host_key,
                                            hostOnly: (cookie.host_key.charAt(0) !== '.' && cookie.host_key.charAt(0) !== '*'),
                                            httpOnly: cookie.httponly,
                                            secure: cookie.secure,
                                            session: (cookie.persistent === 0),
                                            expirationDate: ((new Date(cookie.expires_utc)).getTime() / 1000),
                                            source: source
                                        });
                                    });
                                }
                                db.close();
                                final();
                            })
                        } else {
                            final()
                        }
                    });
                }
            })
        }
        // you can stop walking by passing an error to `cb`
        cb((depth < 2) ? true : 'depth limited');
    }