Add Production P2P Servers to list in Super User Panel
parent
ec2544b887
commit
e45c411490
|
@ -192,6 +192,7 @@
|
||||||
"Filter Name": "Filter Name",
|
"Filter Name": "Filter Name",
|
||||||
"Find Where": "Find Where",
|
"Find Where": "Find Where",
|
||||||
"Reason": "Reason",
|
"Reason": "Reason",
|
||||||
|
"Open Dashboard Remotely": "Open Dashboard Remotely",
|
||||||
"Detection Engine": "Detection Engine",
|
"Detection Engine": "Detection Engine",
|
||||||
"X Point": "X Point",
|
"X Point": "X Point",
|
||||||
"Y Point": "Y Point",
|
"Y Point": "Y Point",
|
||||||
|
@ -210,6 +211,8 @@
|
||||||
"Easy Remote Access (P2P)": "Easy Remote Access (P2P)",
|
"Easy Remote Access (P2P)": "Easy Remote Access (P2P)",
|
||||||
"P2P Settings Applied": "P2P Settings Applied",
|
"P2P Settings Applied": "P2P Settings Applied",
|
||||||
"p2pSettingsText1": "You will need to refresh this page for changes to be applied.",
|
"p2pSettingsText1": "You will need to refresh this page for changes to be applied.",
|
||||||
|
"P2P Server Not Selected": "P2P Server Not Selected",
|
||||||
|
"p2pServerNotSelectedText": "Select a server from the list and press Save. Wait 10 seconds then attempt to open the dashboard remotely.",
|
||||||
"P2P Host": "P2P Host",
|
"P2P Host": "P2P Host",
|
||||||
"P2P API Key": "P2P API Key",
|
"P2P API Key": "P2P API Key",
|
||||||
"Preferences": "Preferences",
|
"Preferences": "Preferences",
|
||||||
|
|
|
@ -5,6 +5,36 @@ module.exports = function(s,config,lang,app){
|
||||||
config.machineId = config.p2pApiKey + '' + config.p2pGroupId
|
config.machineId = config.p2pApiKey + '' + config.p2pGroupId
|
||||||
config.p2pTargetAuth = config.p2pTargetAuth || s.gid(30)
|
config.p2pTargetAuth = config.p2pTargetAuth || s.gid(30)
|
||||||
if(!config.p2pServerList)config.p2pServerList = {
|
if(!config.p2pServerList)config.p2pServerList = {
|
||||||
|
"vancouver-1": {
|
||||||
|
name: 'Vancouver-1',
|
||||||
|
host: '104.218.61.236',
|
||||||
|
p2pPort: '8084',
|
||||||
|
webPort: '8000',
|
||||||
|
maxNetworkSpeed: {
|
||||||
|
up: 5000,
|
||||||
|
down: 5000,
|
||||||
|
shared: true
|
||||||
|
},
|
||||||
|
location: {
|
||||||
|
lat: 49.284966,
|
||||||
|
lon: -123.1140607
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"toronto-1": {
|
||||||
|
name: 'Toronto-1',
|
||||||
|
host: '104.218.60.72',
|
||||||
|
p2pPort: '8084',
|
||||||
|
webPort: '8000',
|
||||||
|
maxNetworkSpeed: {
|
||||||
|
up: 5000,
|
||||||
|
down: 5000,
|
||||||
|
shared: true
|
||||||
|
},
|
||||||
|
location: {
|
||||||
|
lat: 43.644773,
|
||||||
|
lon: -79.3862837
|
||||||
|
}
|
||||||
|
},
|
||||||
"paris-1": {
|
"paris-1": {
|
||||||
name: 'Paris-1',
|
name: 'Paris-1',
|
||||||
host: '163.172.180.205',
|
host: '163.172.180.205',
|
||||||
|
@ -18,22 +48,22 @@ module.exports = function(s,config,lang,app){
|
||||||
location: {
|
location: {
|
||||||
lat: 48.873877,
|
lat: 48.873877,
|
||||||
lon: 2.295533
|
lon: 2.295533
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"paris-2": {
|
"amsterdam-1": {
|
||||||
name: 'Paris-2',
|
name: 'Amsterdam-1',
|
||||||
host: '163.172.180.205',
|
host: '51.15.43.80',
|
||||||
p2pPort: '8084',
|
p2pPort: '8084',
|
||||||
webPort: '8000',
|
webPort: '8000',
|
||||||
maxNetworkSpeed: {
|
maxNetworkSpeed: {
|
||||||
up: 200,
|
up: 500,
|
||||||
down: 200,
|
down: 500,
|
||||||
shared: true
|
shared: true
|
||||||
},
|
},
|
||||||
location: {
|
location: {
|
||||||
lat: 48.873877,
|
lat: 52.348773,
|
||||||
lon: 2.295533
|
lon: 4.8846043
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if(!config.p2pHostSelected)config.p2pHostSelected = 'paris-1'
|
if(!config.p2pHostSelected)config.p2pHostSelected = 'paris-1'
|
||||||
|
|
|
@ -131,7 +131,6 @@ const initialize = (config,lang) => {
|
||||||
// })
|
// })
|
||||||
|
|
||||||
connectionToP2PServer.on('wsInit',(rawRequest) => {
|
connectionToP2PServer.on('wsInit',(rawRequest) => {
|
||||||
s.debugLog('p2pWsInit',rawRequest)
|
|
||||||
const user = rawRequest.user
|
const user = rawRequest.user
|
||||||
const clientConnectionToMachine = createShinobiSocketConnection(rawRequest.cnid)
|
const clientConnectionToMachine = createShinobiSocketConnection(rawRequest.cnid)
|
||||||
connectedUserWebSockets[user.auth_token] = user;
|
connectedUserWebSockets[user.auth_token] = user;
|
||||||
|
|
|
@ -2,7 +2,6 @@ $(document).ready(function(){
|
||||||
var easyRemoteAccessTab = $('#easyRemoteAccess')
|
var easyRemoteAccessTab = $('#easyRemoteAccess')
|
||||||
var p2pHostSelectedContainer = $('#p2pHostSelected')
|
var p2pHostSelectedContainer = $('#p2pHostSelected')
|
||||||
var easyRemoteAccessForm = easyRemoteAccessTab.find('form')
|
var easyRemoteAccessForm = easyRemoteAccessTab.find('form')
|
||||||
var currentlySelectedP2PServerId = p2pHostSelectedContainer.find('.active').attr('drawn-id')
|
|
||||||
easyRemoteAccessTab.find('.submit').click(function(){
|
easyRemoteAccessTab.find('.submit').click(function(){
|
||||||
easyRemoteAccessForm.submit()
|
easyRemoteAccessForm.submit()
|
||||||
})
|
})
|
||||||
|
@ -32,4 +31,22 @@ $(document).ready(function(){
|
||||||
el.addClass('active')
|
el.addClass('active')
|
||||||
currentlySelectedP2PServerId = p2pServerId
|
currentlySelectedP2PServerId = p2pServerId
|
||||||
})
|
})
|
||||||
|
easyRemoteAccessTab.on('click','.remote-dashboard-link',function(e){
|
||||||
|
e.preventDefault()
|
||||||
|
var apiKey = easyRemoteAccessForm.find('[name="p2pApiKey"]').val()
|
||||||
|
var selectedServer = p2pServerList[currentlySelectedP2PServerId]
|
||||||
|
console.log(selectedServer,currentlySelectedP2PServerId,p2pServerList)
|
||||||
|
if(selectedServer && selectedServer.host){
|
||||||
|
var href = `http://${selectedServer.host}:${selectedServer.webPort}/s/${apiKey}?p2p=1`
|
||||||
|
var win = window.open(href, '_blank');
|
||||||
|
win.focus();
|
||||||
|
}else{
|
||||||
|
new PNotify({
|
||||||
|
type: 'warning',
|
||||||
|
title: lang['P2P Server Not Selected'],
|
||||||
|
text: lang.p2pServerNotSelectedText,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
|
<% const p2pServerList = config.p2pServerList || {}
|
||||||
|
const selectedServer = p2pServerList[config.p2pHostSelected]
|
||||||
|
%>
|
||||||
|
<script>
|
||||||
|
window.p2pServerList = <%- JSON.stringify(p2pServerList) %>
|
||||||
|
window.currentlySelectedP2PServerId = `<%- config.p2pHostSelected %>`
|
||||||
|
</script>
|
||||||
<link rel="stylesheet" href="<%-window.libURL%>libs/css/super.easyRemoteAccess.css">
|
<link rel="stylesheet" href="<%-window.libURL%>libs/css/super.easyRemoteAccess.css">
|
||||||
<form>
|
<form>
|
||||||
<div class="mb-4">
|
<div class="mb-4 btn-group" style="display:flex">
|
||||||
<a href="#" class="submit btn btn-block btn-default"><i class="fa fa-check"></i> <%- lang.Save %></a>
|
<a style="flex:6" href="#" class="submit btn btn-default"><i class="fa fa-check"></i> <%- lang.Save %></a>
|
||||||
|
<a style="flex:6" target="_blank" href="#" class="btn btn-info remote-dashboard-link"><i class="fa fa-external-link"></i> <%- lang['Open Dashboard Remotely'] %></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>
|
<label>
|
||||||
|
@ -15,13 +23,13 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>
|
<label>
|
||||||
<div><span><%-lang['P2P API Key']%></span></div>
|
<div><span><%-lang['P2P API Key']%></span></div>
|
||||||
<div><input class="form-control" type="password" name="p2pApiKey" value="<%- config.p2pApiKey %>"></div>
|
<div><input class="form-control" type="text" name="p2pApiKey" value="<%- config.p2pApiKey %>"></div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="row" id="p2pServerList">
|
<div class="row" id="p2pServerList">
|
||||||
<% Object.keys(config.p2pServerList).forEach((key) => {
|
<% Object.keys(p2pServerList).forEach((key) => {
|
||||||
const details = config.p2pServerList[key]
|
const details = p2pServerList[key]
|
||||||
%>
|
%>
|
||||||
<div class="col-md-3 mt-2">
|
<div class="col-md-3 mt-2">
|
||||||
<div class="card <% if(config.p2pHostSelected === key){ %>active<% } %>" drawn-id="<%- key %>">
|
<div class="card <% if(config.p2pHostSelected === key){ %>active<% } %>" drawn-id="<%- key %>">
|
||||||
|
|
Loading…
Reference in New Issue