Skip to content

Commit

Permalink
Capture pids (mitre#424)
Browse files Browse the repository at this point in the history
* making modifications to the report

* removing the annoying looking comments

* removing the space

* capturing pid
  • Loading branch information
brianedmonds90 authored and David Hunt committed Aug 26, 2019
1 parent 65a787c commit f4bd3e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions app/service/agent_svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ class AgentService(BaseService):
def __init__(self):
self.log = self.add_service('agent_svc', self)

async def handle_heartbeat(self, paw, platform, server, group, executor, location):
async def handle_heartbeat(self, paw, platform, server, group, executor, location, pid):
self.log.debug('HEARTBEAT (%s)' % paw)
agent = await self.get_service('data_svc').explode_agents(criteria=dict(paw=paw))
now = self.get_current_timestamp()
if agent:
await self.get_service('data_svc').update('core_agent', 'paw', paw,
data=dict(last_seen=now, executor=executor))
data=dict(last_seen=now, executor=executor, pid=pid))
return agent[0]
else:
queued = dict(last_seen=now, paw=paw, platform=platform, server=server, host_group=group, executor=executor, location=location)
queued = dict(last_seen=now, paw=paw, platform=platform, server=server, host_group=group, executor=executor,
location=location, pid=pid)
await self.get_service('data_svc').create_agent(agent=queued)
return (await self.get_service('data_svc').explode_agents(criteria=dict(paw=paw)))[0]

Expand Down
2 changes: 1 addition & 1 deletion conf/core.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ CREATE TABLE if not exists core_ability (id integer primary key AUTOINCREMENT, a
CREATE TABLE if not exists core_payload (id integer primary key AUTOINCREMENT, ability integer, payload text, UNIQUE (ability, payload) ON CONFLICT IGNORE);
CREATE TABLE if not exists core_adversary (id integer primary key AUTOINCREMENT, adversary_id text, name text, description text, UNIQUE (name));
CREATE TABLE if not exists core_adversary_map (phase integer, adversary_id text, ability_id text, UNIQUE (adversary_id, phase, ability_id));
CREATE TABLE if not exists core_agent (id integer primary key AUTOINCREMENT, paw text, last_seen date, platform text, executor text, server text, host_group text, location text);
CREATE TABLE if not exists core_agent (id integer primary key AUTOINCREMENT, paw text, last_seen date, platform text, executor text, server text, host_group text, location text, pid integer);
CREATE TABLE if not exists core_operation (id integer primary key AUTOINCREMENT, name text, host_group text, adversary_id text, jitter text, start date, finish date, phase integer, stealth integer, planner integer, state text);
CREATE TABLE if not exists core_chain (id integer primary key AUTOINCREMENT, op_id integer, paw text, ability integer, jitter integer, command text, cleanup integer, score integer, status integer, decide date, collect date, finish date, UNIQUE(op_id, paw, command));
CREATE TABLE if not exists core_parser (id integer primary key AUTOINCREMENT, ability integer, name text, property text, script text, UNIQUE(ability, property) ON CONFLICT IGNORE);
Expand Down

0 comments on commit f4bd3e2

Please sign in to comment.