Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
var IJOD = require('../../Common/node/ijod').IJOD;
var sqlite = require('sqlite');
// var INDEXED_FIELDS = [{fieldName:'timeStamp', fieldType:'REAL'}, {fieldName:'data.id', fieldType:'REAL'}];
var people = {};
var statuses = {};
var currentDB = new sqlite.Database();
exports.init = function(callback) {
if(!people.followers && ! people.friends) {
people.followers = new IJOD('followers');
people.friends = new IJOD('friends');
statuses.home_timeline = new IJOD('home_timeline');
statuses.user_timeline = new IJOD('user_timeline');
statuses.mentions = new IJOD('mentions');
people.followers.init(function() {
people.friends.init(function() {
statuses.home_timeline.init(function() {
statuses.user_timeline.init(function() {
statuses.mentions.init(function() {
openDB(callback);
});
});
});
/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
var sys = require('sys'),
sqlite = require('sqlite');
var db = new sqlite.Database();
// open the database for reading if file exists
// create new database file if not
var fs = require('fs');
var exec = require('child_process').exec;
fs.mkdir('my', 0755);
function copyAndExtract(accountID) {
child = exec('cp ' + process.env.HOME + '/Library/Application\\ Support/Firefox/Profiles/7v61pmci.default/places.sqlite places.sqlite', function(error, stdout, stderr) {
fs.mkdir('my/' + accountID, 0755);
var stream = fs.createWriteStream('my/' +accountID + '/history.json');
db.open('places.sqlite', function (error) {
if (error) {
console.log("Tonight. You.");
var load = function() {
var config = cfg.get('cookies');
if(cookie_jar !== null || !config.activate) {
log.info('cookie storage load skiped')
return; // return if already loaded
}
log.info('loading cookie storage');
if(config['type'] == 'firefox_sqlite') {
var db = new sqlite.Database();
db.open(config['cookie_jar'], function(error) {
if(error) {
log.error('unable to load cookie_sqlite: ' + config['cookie_jar']);
return;
}
var sql = 'SELECT * FROM moz_cookies';
db.execute(sql, function(error, rows) {
if(error) {
log.error('error execute sqlite query: '+error);
return;
}
cookie_jar = [];
for(var i = 0; i < rows.length; i++) {
// whitelist configuration, if set (not empty), match with host field
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
var fs = require('fs'),
sqlite = require('sqlite'),
express = require('express'),
connect = require('connect'),
spawn = require('child_process').spawn,
lfs = require('../../Common/node/lfs.js'),
locker = require('../../Common/node/locker.js');
var db = new sqlite.Database();
var app = express.createServer(
connect.bodyParser(),
connect.cookieParser(),
connect.session({secret: "locker"})
);
app.get('/', function(req, res) {
res.end("we'll be chugging away...");
// TODO: Check for existing JSON dump and update if exists
fs.mkdir('my', 0755);
var ff_profiles_dir = null;
switch (process.platform) {
// TODO: Add paths for other platforms
case "darwin":
function prepareDb()
{
db = new sqlite.Database();
db.open("journal.sqlite", function(error) {
if (error) {
process.stderr.write("DB Startup error:" + error + "\n");
process.exit(1);
}
db.execute("SELECT name FROM sqlite_master WHERE name='journal'", function(error, results) {
if (error) {
process.stderr.write("Finding journal error: " + error + "\n");
db.close();
process.exit(1);
}
if (results.length == 0) {
db.execute("CREATE TABLE journal(timestamp INT PRMIARY KEY, event TEXT)", function(error, results) {
if (error) {
process.stderr.write("Journal create table error: " + error + "\n");
res.download(crxName, 'locker-browser-history.crx', function() {
fs.unlink(crxName);
});
});
});
app.get('/allLinks', function(req, res) {
getURLs(function(error, rows) {
if(error) throw error;
res.end(JSON.stringify(rows));
});
})
var port;
var stdin = process.openStdin();
var db = new sqlite.Database();
stdin.setEncoding('utf8');
stdin.on('data', function (chunk) {
var processInfo = JSON.parse(chunk);
process.chdir(processInfo.workingDirectory);
db.open("history.db", function (error) {
createTable(function () {
externalBase = processInfo.externalBase;
port = processInfo.port;
var returnedInfo = {port: processInfo.port};
app.listen(processInfo.port);
console.log(JSON.stringify(returnedInfo));
});
});
});
/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
var IJOD = require('../../Common/node/ijod').IJOD;
var sqlite = require('sqlite');
var INDEXED_FIELDS = [{fieldName:'timeStamp', fieldType:'REAL'}, {fieldName:'data.id', fieldType:'REAL'}];
var friends = undefined;
var currentDB = new sqlite.Database();
exports.init = function(callback) {
if(!friends) {
friends = new IJOD('friends', INDEXED_FIELDS);
places = new IJOD('places', INDEXED_FIELDS);
friends.init(function() {
places.init(function() {
openDB(callback);
})
});
} else {
callback();
}
}
function openDB(callback) {
currentDB.open('current.db', function(err) {
function SQLiteStore(options) {
options = options || {};
Store.call(this, options);
this.table = options.db || 'sessions';
this.db = new sqlite.Database();
this.client = new events.EventEmitter();
var self = this;
var dbFile = (options.dir || '.') + '/' + this.table + '.db';
this.db.open(dbFile, function(err) {
if (err) throw err;
self.db.executeScript('CREATE TABLE IF NOT EXISTS ' + self.table + ' (' +
'sid PRIMARY KEY, ' +
'expired, sess);',
function(err) {
if (err) throw err;
self.client.emit('connect');
}
);
});
function IJOD(name, indexedFields) {
this.name = name;
this.indexFile = name + '/' + name + '.index';
this.dataFile = name + '/' + name + '.json';
this.dbFile = name + '/' + name + '.db';
this.indexListFile = name + '/' + name + '.json';
this.indexedFields = indexedFields;
this.db = new sqlite.Database();
}
this.connectToDatabase = function(callback) {
if (that.client === null) {
var database = require('sqlite').Database();
database.open(options.database, function(error) {
that.client = database;
callback();
});
} else {
callback();
}
};