@@ -82,7 +82,11 @@ func getIOCType(iocStr string) (string, error) {
82
82
// addCrowdStrikeIOC will add a supported iocs with an optional description
83
83
// defaults to an expiration date of 10 years & a severity of medium.
84
84
// will detect on domains/ips and block on hashes. Retro detection enabled by default.
85
- func addCrowdStrikeIOCs (iocs []string , description string , client * client.CrowdStrikeAPISpecification ) error {
85
+ func addCrowdStrikeIOCs (
86
+ iocs []string ,
87
+ description string ,
88
+ client * client.CrowdStrikeAPISpecification ,
89
+ ) error {
86
90
87
91
body := models.APIIndicatorCreateReqsV1 {}
88
92
@@ -100,6 +104,8 @@ func addCrowdStrikeIOCs(iocs []string, description string, client *client.CrowdS
100
104
action = "prevent"
101
105
}
102
106
107
+ expiration := strfmt .DateTime (time .Now ().Add (24 * time .Hour * 365 * 10 ))
108
+
103
109
// add iocs to body
104
110
truth := true
105
111
body .Indicators = append (body .Indicators , & models.APIIndicatorCreateReqV1 {
@@ -110,7 +116,7 @@ func addCrowdStrikeIOCs(iocs []string, description string, client *client.CrowdS
110
116
Description : description ,
111
117
Platforms : []string {"windows" , "mac" , "linux" },
112
118
Value : iocStr ,
113
- Expiration : strfmt . DateTime ( time . Now (). Add ( 24 * time . Hour * 365 * 10 )) ,
119
+ Expiration : & expiration ,
114
120
// Tags: []string{"example_tag1", "example_tag2"},
115
121
})
116
122
}
@@ -134,13 +140,20 @@ func addCrowdStrikeIOCs(iocs []string, description string, client *client.CrowdS
134
140
return nil
135
141
}
136
142
137
- func addCrowdStrikeIOC (iocStr string , description string , client * client.CrowdStrikeAPISpecification ) error {
143
+ func addCrowdStrikeIOC (
144
+ iocStr string ,
145
+ description string ,
146
+ client * client.CrowdStrikeAPISpecification ,
147
+ ) error {
138
148
return addCrowdStrikeIOCs ([]string {iocStr }, description , client )
139
149
}
140
150
141
151
// searchCrowdStrikeIOC searches custom IOCs for an IOC and returns an id if found.
142
152
// if no IOC is found, an empty string is returned
143
- func _getCrowdStrikeIOCID (iocStr string , client * client.CrowdStrikeAPISpecification ) (id string , err error ) {
153
+ func _getCrowdStrikeIOCID (
154
+ iocStr string ,
155
+ client * client.CrowdStrikeAPISpecification ,
156
+ ) (id string , err error ) {
144
157
fql := fmt .Sprintf (`value:"%s"` , iocStr )
145
158
146
159
params := ioc .NewIndicatorSearchV1Params ().WithFilter (& fql )
@@ -219,9 +232,21 @@ func showCrowdStrikeIOC(iocStr string, client *client.CrowdStrikeAPISpecificatio
219
232
220
233
func main () {
221
234
222
- falconClientId := flag .String ("client-id" , os .Getenv ("FALCON_CLIENT_ID" ), "Client ID for accessing CrowdStrike Falcon Platform (default taken from FALCON_CLIENT_ID env)" )
223
- falconClientSecret := flag .String ("client-secret" , os .Getenv ("FALCON_CLIENT_SECRET" ), "Client Secret for accessing CrowdStrike Falcon Platform (default taken from FALCON_CLIENT_SECRET)" )
224
- clientCloud := flag .String ("cloud" , os .Getenv ("FALCON_CLOUD" ), "Falcon cloud abbreviation (us-1, us-2, eu-1, us-gov-1)" )
235
+ falconClientId := flag .String (
236
+ "client-id" ,
237
+ os .Getenv ("FALCON_CLIENT_ID" ),
238
+ "Client ID for accessing CrowdStrike Falcon Platform (default taken from FALCON_CLIENT_ID env)" ,
239
+ )
240
+ falconClientSecret := flag .String (
241
+ "client-secret" ,
242
+ os .Getenv ("FALCON_CLIENT_SECRET" ),
243
+ "Client Secret for accessing CrowdStrike Falcon Platform (default taken from FALCON_CLIENT_SECRET)" ,
244
+ )
245
+ clientCloud := flag .String (
246
+ "cloud" ,
247
+ os .Getenv ("FALCON_CLOUD" ),
248
+ "Falcon cloud abbreviation (us-1, us-2, eu-1, us-gov-1)" ,
249
+ )
225
250
debug := flag .Bool ("debug" , false , "Debug requests" )
226
251
227
252
list := flag .Bool ("list" , false , "list all IOC values in the IOC management panel" )
0 commit comments