Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions implants/lib/tavern/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type Beacon implements Node {
agentIdentifier: String
"""Timestamp of when a task was last claimed or updated for the beacon."""
lastSeenAt: Time
"""The callback interval of the agent"""
interval: Int
"""Host this beacon is running on."""
host: Host!
"""Tasks that have been assigned to the beacon."""
Expand Down Expand Up @@ -121,6 +123,17 @@ input BeaconWhereInput {
lastSeenAtLTE: Time
lastSeenAtIsNil: Boolean
lastSeenAtNotNil: Boolean
"""interval field predicates"""
interval: Int
intervalNEQ: Int
intervalIn: [Int!]
intervalNotIn: [Int!]
intervalGT: Int
intervalGTE: Int
intervalLT: Int
intervalLTE: Int
intervalIsNil: Boolean
intervalNotNil: Boolean
"""host edge predicates"""
hasHost: Boolean
hasHostWith: [HostWhereInput!]
Expand Down Expand Up @@ -880,6 +893,9 @@ UpdateBeaconInput is used for update Beacon object.
Input was generated by ent.
"""
input UpdateBeaconInput {
"""The callback interval of the agent"""
interval: Int
clearInterval: Boolean
hostID: ID
}
"""
Expand Down
2 changes: 2 additions & 0 deletions tavern/internal/c2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (srv *Server) ClaimTasks(ctx context.Context, req *c2pb.ClaimTasksRequest)
if req.Beacon.Agent.Identifier == "" {
return nil, fmt.Errorf("must provide agent identifier")
}

hostPlaform := convertHostPlatform(req.Beacon.Host.Platform)

// 1. Upsert the host
Expand All @@ -72,6 +73,7 @@ func (srv *Server) ClaimTasks(ctx context.Context, req *c2pb.ClaimTasksRequest)
SetAgentIdentifier(req.Beacon.Agent.Identifier).
SetHostID(hostID).
SetLastSeenAt(now).
SetInterval(req.Beacon.Interval).
OnConflict().
UpdateNewValues().
ID(ctx)
Expand Down
13 changes: 12 additions & 1 deletion tavern/internal/ent/beacon.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tavern/internal/ent/beacon/beacon.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions tavern/internal/ent/beacon/where.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 98 additions & 0 deletions tavern/internal/ent/beacon_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading