forked from shaniacht1/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautomation-AquatoneDiscover.yml
57 lines (54 loc) · 1.82 KB
/
automation-AquatoneDiscover.yml
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
args:
- default: true
description: domain to discover
name: domain
required: true
comment: aquatone-discover will find the targets nameservers and shuffle DNS lookups
between them. Should a lookup fail on the target domains nameservers, aquatone-discover
will fall back to using Google public DNS servers to maximize discovery.
commonfields:
id: AquatoneDiscover
version: -1
dockerimage: demisto/aquatone
enabled: true
name: AquatoneDiscover
outputs:
- contextPath: Aquatone.discover
description: find the targets nameservers and shuffle DNS lookups between them
runonce: true
script: |-
from subprocess import Popen, PIPE, STDOUT
import subprocess
import time
domain = demisto.args()['domain']
stderr = {}
cmd = 'aquatone-discover --domain '+domain
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if p.returncode>0:
demisto.results({"Type": entryTypes["error"], "ContentsFormat": formats["text"],"Contents": stdout+stderr})
else:
res = stdout
cmd = 'cat /root/aquatone/'+domain+'/hosts.json'
p = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
if p.returncode>0:
demisto.results({"Type": entryTypes["error"], "ContentsFormat": formats["text"],"Contents": stdout+stderr})
else:
hosts = stdout
hosts_json = json.loads(hosts)
ec = {'Aquatone.discover': hosts_json}
entry_result = {
'Type': entryTypes['note'],
'ContentsFormat': formats['json'],
'Contents': hosts_json,
'HumanReadable':res,
'ReadableContentsFormat': formats['markdown'],
'EntryContext': ec
}
demisto.results(entry_result)
scripttarget: 0
system: true
tags: []
timeout: 1h0m0s
type: python