-
Notifications
You must be signed in to change notification settings - Fork 7
/
plugin_template.py
64 lines (48 loc) · 2.16 KB
/
plugin_template.py
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
import syslog
def add_ip(ip,settings,intel_list,tags):
""" adds an IP to the pre-established list. The tags might or might not be supported by the control"""
# your code here
if "[condition for confirming a successful addition":
syslog.syslog(syslog.LOG_INFO,'nyx->[this_plugin]: successfully added %s to %s'% (ip,intel_list))
return True
else:
syslog.syslog(syslog.LOG_ERR,'nyx->[this_plugin]: problems adding %s to %s'% (ip,intel_list))
return False
def add_domain(domain,settings,intel_list,tags):
""" adds an domain to the pre-established list. The tags might or might not be supported by the control"""
# your code here
if "[condition for confirming a successful addition":
syslog.syslog(syslog.LOG_INFO,'nyx->[this_plugin]: successfully added %s to %s'% (ip,intel_list))
return True
else:
syslog.syslog(syslog.LOG_ERR,'nyx->[this_plugin]: problems adding %s to %s'% (ip,intel_list))
return False
def list_ips(settings):
""" retrieves the IP addresses from the control's specific lists for comparison"""
ip_index={}
# your code here
return ip_index
def list_domains(settings):
""" retrieves the domains from the control's lists for comparison.
The index should be structured as a dictionary of {domain:intel_list}"""
domain_index={}
# your code here
return domain_index
def remove_ip(ip,settings):
""" removes an IP from the control"""
# your code here
if "[conditions for successful removal]":
syslog.syslog(syslog.LOG_INFO,'nyx->[this_plugin]:: successfully removed %s'% (ip))
return True
else:
syslog.syslog(syslog.LOG_ERR,'nyx->[this_plugin]: problems removing %s'% (ip))
return False
def remove_domain(domain,settings):
""" removes a domain from the control"""
# your code here
if "[conditions for successful removal]":
syslog.syslog(syslog.LOG_INFO,'nyx->[this_plugin]:: successfully removed %s'% (ip))
return True
else:
syslog.syslog(syslog.LOG_ERR,'nyx->[this_plugin]: problems removing %s'% (ip))
return False