Compare commits

..

4 Commits

Author SHA1 Message Date
68408b7cd3 Update 2020-08-22 01:29:47 +09:00
13da878026 Update 2020-08-21 16:26:43 +09:00
42164e5c31 Update 2020-08-21 06:23:49 +09:00
a0eb6e7bd4 Added 2020-08-21 05:51:19 +09:00
3 changed files with 5 additions and 3 deletions

View File

@ -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')
}

View File

@ -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

View File

@ -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