mirror of
https://github.com/trufflesecurity/xsshunter
synced 2024-11-10 06:44:13 +00:00
trying to get ssl
This commit is contained in:
parent
2baa223ef7
commit
f10ba63a65
3 changed files with 59 additions and 4 deletions
3
api.js
3
api.js
|
@ -10,7 +10,6 @@ const favicon = require('serve-favicon');
|
|||
const database = require('./database.js');
|
||||
const safeCompare = require('safe-compare');
|
||||
const { Op } = require("sequelize");
|
||||
const sequelize = database.sequelize;
|
||||
const Settings = database.Settings;
|
||||
const PayloadFireResults = database.PayloadFireResults;
|
||||
const CollectedPages = database.CollectedPages;
|
||||
|
@ -586,4 +585,4 @@ async function set_up_api_server(app) {
|
|||
|
||||
module.exports = {
|
||||
set_up_api_server
|
||||
};
|
||||
};
|
||||
|
|
21
app.js
21
app.js
|
@ -8,6 +8,7 @@ const uuid = require('uuid');
|
|||
const database = require('./database.js');
|
||||
const Settings = database.Settings;
|
||||
const PayloadFireResults = database.PayloadFireResults;
|
||||
const Users = database.Users;
|
||||
const savePayload = database.savePayload;
|
||||
const CollectedPages = database.CollectedPages;
|
||||
const InjectionRequests = database.InjectionRequests;
|
||||
|
@ -33,6 +34,17 @@ function set_secure_headers(req, res) {
|
|||
}
|
||||
}
|
||||
|
||||
function makeRandomPath(length) {
|
||||
var result = '';
|
||||
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for ( var i = 0; i < length; i++ ) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
async function check_file_exists(file_path) {
|
||||
return asyncfs.access(file_path, fs.constants.F_OK).then(() => {
|
||||
return true;
|
||||
|
@ -288,9 +300,14 @@ async function get_app_server() {
|
|||
client.setCredentials(tokens);
|
||||
const oauth2 = google.oauth2({version: 'v2', auth: client});
|
||||
const email = await oauth2.userinfo.v2.me.get();
|
||||
const [user, created] = await Users.findOrCreate({ where: { 'email': email } });
|
||||
if(created){
|
||||
user.path = makeRandomPath(20);
|
||||
user.save();
|
||||
}
|
||||
req.session.email = user.email;
|
||||
req.session.authenticated = true;
|
||||
req.session.email = email.data.email;
|
||||
res.send(`Hello ${email.data.email}!`);
|
||||
res.send(`Hello ${user.email}, your path is ${user.path}!`);
|
||||
} catch (error) {
|
||||
console.log(`Error Occured: ${error}`);
|
||||
res.status(500).send("Error Occured");
|
||||
|
|
39
database.js
39
database.js
|
@ -59,6 +59,45 @@ Settings.init({
|
|||
});
|
||||
|
||||
|
||||
/*
|
||||
Secrets found in DOMs
|
||||
*/
|
||||
class Users extends Model {}
|
||||
Secrets.init({
|
||||
id: {
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
type: Sequelize.UUID,
|
||||
defaultValue: uuid.v4()
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
},
|
||||
path: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
}
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'userss',
|
||||
indexes: [
|
||||
{
|
||||
unique: false,
|
||||
fields: ['email'],
|
||||
method: 'BTREE',
|
||||
},
|
||||
{
|
||||
unique: false,
|
||||
fields: ['path'],
|
||||
method: 'BTREE',
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
Secrets found in DOMs
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue