This commit is contained in:
Stefan Etringer 2025-07-21 12:28:26 +00:00
parent 824c387ed7
commit e9a0f1b64a
2 changed files with 14 additions and 6 deletions

View File

@ -114,7 +114,8 @@ async function updateGraph(agentData) {
name : name,
type : 'Agent',
ip : agent.IPv4Address,
status: agent.status
status: agent.status,
addport: agent.addPort
},
classes: online ? 'online' : 'offline' // ← only classes
});
@ -160,12 +161,18 @@ async function updateGraph(agentData) {
{
content: 'Ping',
select: function(ele) {
const ip = ele.data().ip;
console.log(`Ping to ${ip} triggered!`);
const agentStatus = ele.data().status;
alert(`Ping response: ${agentStatus === "Connected" ? 'Online' : 'Offline'}`);
}
},
{
content: 'Remote Shell',
select: (ele) => {
window.open(`/proxyAgent/${ele.data().ip}:${ele.data().addport}/`);
}
}
],
menuRadius: 100,
menuRadius: 65,
fillColor: `rgba(0, 0, 0, 0.75)`,
activeFillColor: `rgba(255, 255, 255, 0.3)`,
activePadding: 10,
@ -228,8 +235,8 @@ async function loadGraphData() {
console.log('Extracted agent data:', agentData);
// Only update the graph if agent data is available
if (JSON.stringify(agentData) != agentDataCurrent) {
// Only update the graph if agent is available and has been changed
if (JSON.stringify(agentData) !== agentDataCurrent) {
// if (agentData && agentData.length > 0) {
console.log("updating graph");
await updateGraph(agentData);

View File

@ -408,6 +408,7 @@ func Server() (*http.Server) {
}
webSocketMux := http.NewServeMux()
// webSocketMux.Handle("/register", webSocketHandler)
webSocketMux.Handle("/data", webSocketHandler)
webSocketMux.Handle("/executeCommand", corsMiddleware(http.HandlerFunc(executeCommand)))
webSocketMux.Handle("/agentNames", corsMiddleware(http.HandlerFunc(getAgentNames)))