forked from threatgrid/ctim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openc2_network.cljc
132 lines (103 loc) · 3.4 KB
/
openc2_network.cljc
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
(ns ctim.schemas.openc2-network
(:require [ctim.schemas.openc2vocabularies :as openc2v]
#?(:clj [flanders.core :as f :refer [def-enum-type def-map-type def-eq]]
:cljs [flanders.core :as f :refer-macros [def-enum-type def-map-type def-eq]])))
(def-eq BGPBlackholeTypeIdentifier "BGPBlackhole")
(def-map-type BGPBlackhole
[(f/entry :type BGPBlackholeTypeIdentifier)
(f/entry :host f/any-str)])
(def-eq DNSSinkholeTypeIdentifier "DNSSinkhole")
(def-map-type DNSSinkhole
[(f/entry :type DNSSinkholeTypeIdentifier)
(f/entry :host f/any-str)])
(def protocol
#{"TCP"
"UDP"
"ICMP"
"Any"})
(def-enum-type Protocol protocol)
(def ACL-action
#{"ALERT"
"DROP"
"DENY"
"LOG"
"PASS"
"REJECT"})
(def-enum-type ACLAction ACL-action)
(def-map-type Traffic
[(f/entry :protocol Protocol)
(f/entry :source_address f/any-str)
(f/entry :source_port f/any-str)
(f/entry :destination_address f/any-str)
(f/entry :destination_port f/any-str)])
(def-eq NetworkACLTypeIdentifier "NetworkACL")
(def-map-type NetworkACL
[(f/entry :type NetworkACLTypeIdentifier)
(f/entry :traffic Traffic)
(f/entry :action ACLAction)])
(def-map-type VLANProfile
[(f/entry :vlan_tag f/any-str)])
(def-map-type SecGroupProfile
[(f/entry :sec_group_tag f/any-str)
(f/entry :sec_group_ACL f/any-str)])
(def-eq RemediationTypeIdentifier "Remediation")
(def-map-type Remediation
[(f/entry :type RemediationTypeIdentifier)
(f/entry :server f/any-str)
(f/entry :ACL NetworkACL)
;; (f/entry :containment_profile_VLAN VLANProfile
;; :required? false)
;; (f/entry :containment_profile_sec_group SecGroupProfile
;; :required? false)
])
(def-eq NonSensitiveTypeIdentifier "NonSensitive")
(def-map-type NonSensitive
[(f/entry :type NonSensitiveTypeIdentifier)
(f/entry :permissible_IPs f/any-string-seq)
(f/entry :ACL NetworkACL)])
(def-map-type HoneyPotRoutes
[(f/entry :prefix f/any-str)
(f/entry :next_hop f/any-str)
(f/entry :next_hope_type f/any-str)])
(def-eq HoneyPotTypeIdentifier "Honeypot")
(def-map-type HoneyPot
[(f/entry :type HoneyPotTypeIdentifier)
(f/entry :permissible_IPs f/any-str-seq)
(f/entry :ACL NetworkACL)
(f/entry :routes HoneyPotRoutes)])
(def-enum-type Encapsulation
#{"GRE"
"VXLAN"})
(def-enum-type BlockModifierType
#{"Perimeter"
"Internal"})
(def-map-type BlockModifier
(concat
[(f/entry :type BlockModifierType)]
(f/optional-entries
(f/entry :method_network_ACL NetworkACL)
(f/entry :method_BGP_blackhole BGPBlackhole)
(f/entry :method_DNS_sinkhole DNSSinkhole))))
(def-eq ContainTypeIdentifier "Contain")
(def-map-type ContainModifier
(concat
[(f/entry :type ContainTypeIdentifier)]
(f/optional-entries
(f/entry :method_remediation Remediation)
(f/entry :method_nonsensitive NonSensitive)
(f/entry :method_honeypot HoneyPot))))
(def-eq InspectModifierTypeIdentifier "Inspect")
(def-map-type InspectModifier
(concat
[(f/entry :type InspectModifierTypeIdentifier)]
(f/optional-entries
(f/entry :profile f/any-str)
(f/entry :server f/any-str)
(f/entry :encapsulation Encapsulation))))
(def-eq PacketCaptureModifierTypeIdentifier "PacketCapture")
(def-map-type PacketCaptureModifier
(concat
[(f/entry :type PacketCaptureModifierTypeIdentifier)]
(f/optional-entries
(f/entry :server f/any-str)
(f/entry :traffic Traffic))))