Skip to content

Commit c606a61

Browse files
authored
Farsight DNSDB - Added handling for 404 and 400 responses (#1675)
* Added handling for 404 and 400 responses graceful handling of no inforamaion found condition Also improved humanreadable for results * fix commonfields fix commonfields * Added test plybook for DNSDB Farsight DNSDB test playbook
1 parent 8b3649f commit c606a61

File tree

3 files changed

+155
-2
lines changed

3 files changed

+155
-2
lines changed

Integrations/integration-DNSDB.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ script:
114114
head+=key+'|';
115115
line+='-|';
116116
}
117-
var md=head+'\n'+line+'\n';
117+
var md = '### Farsight DNSDB\n';
118+
md+=head+'\n'+line+'\n';
118119
for (var i = 0; i<data.length; i++) {
119120
md += '|';
120121
for (key in keys) {
@@ -144,6 +145,10 @@ script:
144145
params.useproxy
145146
146147
);
148+
if (res.StatusCode == 404 || res.StatusCode == 400) {
149+
//null is returned while 404 returns error that stops playbook
150+
return null;
151+
}
147152
if (res.StatusCode < 200 || res.StatusCode>299) {
148153
throw 'Error ' + res.StatusCode + '. ' + res.Status;
149154
}
@@ -181,6 +186,10 @@ script:
181186
parameters.time_last_after = args.time_last_after*-1;
182187
}
183188
var res= sendRequest(requestUrl,parameters);
189+
if (res === null) {
190+
md = '### Farsight DNSDB: No information found on ' + args.value;
191+
return { ContentsFormat: formats.markdown, Type: entryTypes.note, Contents: md } ;
192+
}
184193
var md = dataToMd(api,res.entries);
185194
return {Type: entryTypes.note, Contents: res, ContentsFormat: formats.json, HumanReadable: md};
186195
}
@@ -255,4 +264,5 @@ script:
255264
- name: time_last_after
256265
description: Filter results for entries seen for last time after (seconds)
257266
description: Lookup rrser records
258-
hidden: false
267+
runonce: false
268+
releaseNotes: "Added error handling of 404/400 response and improved human readable output."

TestPlaybooks/playbook-DNSDB-Test.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
id: DNSDBTest
2+
version: -1
3+
name: DNSDBTest
4+
starttaskid: "0"
5+
tasks:
6+
"0":
7+
id: "0"
8+
taskid: f50ccca6-eb90-4d74-8299-c128a80ccba9
9+
type: start
10+
task:
11+
id: f50ccca6-eb90-4d74-8299-c128a80ccba9
12+
version: -1
13+
name: ""
14+
iscommand: false
15+
brand: ""
16+
nexttasks:
17+
'#none#':
18+
- "1"
19+
reputationcalc: 0
20+
separatecontext: false
21+
view: |-
22+
{
23+
"position": {
24+
"x": 265,
25+
"y": 50
26+
}
27+
}
28+
"1":
29+
id: "1"
30+
taskid: 5e24c48c-eb4e-44d4-8d41-21dacb7caa99
31+
type: regular
32+
task:
33+
id: 5e24c48c-eb4e-44d4-8d41-21dacb7caa99
34+
version: -1
35+
name: DeleteContext
36+
description: Delete field from context
37+
scriptName: DeleteContext
38+
type: regular
39+
iscommand: false
40+
brand: ""
41+
nexttasks:
42+
'#none#':
43+
- "2"
44+
- "5"
45+
scriptarguments:
46+
all:
47+
simple: "yes"
48+
key: {}
49+
reputationcalc: 0
50+
separatecontext: false
51+
view: |-
52+
{
53+
"position": {
54+
"x": 265,
55+
"y": 195
56+
}
57+
}
58+
"2":
59+
id: "2"
60+
taskid: f459f09b-4032-4b43-89c7-c104653fc831
61+
type: regular
62+
task:
63+
id: f459f09b-4032-4b43-89c7-c104653fc831
64+
version: -1
65+
name: dnsdb-rrset
66+
description: Check IP reputation (when information is available, returns a JSON
67+
with details). Uses all configured Threat Intelligence feeds
68+
script: Farsight DNSDB_copy|||dnsdb-rrset
69+
type: regular
70+
iscommand: true
71+
brand: Farsight DNSDB_copy
72+
scriptarguments:
73+
bailiwick: {}
74+
limit:
75+
simple: "10"
76+
owner:
77+
simple: google.*
78+
rrtype: {}
79+
time_first_after: {}
80+
time_first_before: {}
81+
time_last_after: {}
82+
time_last_before: {}
83+
reputationcalc: 0
84+
separatecontext: false
85+
view: |-
86+
{
87+
"position": {
88+
"x": -196,
89+
"y": 446
90+
}
91+
}
92+
"5":
93+
id: "5"
94+
taskid: edcdf841-173b-4e52-87ce-6a13b3920b05
95+
type: regular
96+
task:
97+
id: edcdf841-173b-4e52-87ce-6a13b3920b05
98+
version: -1
99+
name: dnsdb-rdata
100+
script: Farsight DNSDB_copy|||dnsdb-rdata
101+
type: regular
102+
iscommand: true
103+
brand: Farsight DNSDB_copy
104+
scriptarguments:
105+
limit:
106+
simple: "10"
107+
rrtype: {}
108+
time_first_after: {}
109+
time_first_before: {}
110+
time_last_after: {}
111+
time_last_before: {}
112+
type:
113+
simple: name
114+
value:
115+
simple: youtube.com
116+
reputationcalc: 0
117+
separatecontext: false
118+
view: |-
119+
{
120+
"position": {
121+
"x": 740,
122+
"y": 432
123+
}
124+
}
125+
view: |-
126+
{
127+
"linkLabelsPosition": {},
128+
"paper": {
129+
"dimensions": {
130+
"height": 491,
131+
"width": 1316,
132+
"x": -196,
133+
"y": 50
134+
}
135+
}
136+
}
137+
inputs: []
138+
outputs: []

Tests/conf.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@
352352
}
353353
],
354354
"skipped": [
355+
{
356+
357+
"integrations": "Farsight DNSDB",
358+
"playbookID": "DNSDBTest"
359+
},
355360
{
356361
"integrations": "Cybereason",
357362
"playbookID": "Cybereason Test"

0 commit comments

Comments
 (0)