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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268 | from collections import OrderedDict
VERSION = "1.1.0"
"""Version of this set of plugin definitions."""
MINIMUM_THAT_VERSION = "1.1.0"
"""Minimum THAT version required to run these plugin definitions."""
NAME = "symantec"
PRIORITY = 9
ANALYZE_DATA = OrderedDict()
GET_TANIUM_DATA = OrderedDict()
GET_INTERNET_DATA = [
]
# ask the question 'Get Installed Applications contains "Symantec" from all machines'
# and store results in "Symantec.csv"
GET_TANIUM_DATA["symantec.csv"] = {
"filters": [],
"sensors": ["Installed Applications, that contains:symantec"],
}
# ask the question 'Get Online from all machines'
# and store results in "Symantectargets.csv"
GET_TANIUM_DATA["symantectargets.csv"] = {
"filters": ["Installed Applications, that contains:symantec"],
"sensors": ["Online"],
}
# ask the question 'Get Symantec Client Version from all machines'
# and store results in "symantecversion.csv"
GET_TANIUM_DATA["symantecversion.csv"] = {
"filters": [],
"sensors": ["Symantec Client Version"],
}
# ask the question 'Get Symantec DAT Days Old from all machines'
# and store results in "symantecdatdaysold.csv"
GET_TANIUM_DATA["symantecdatdaysold.csv"] = {
"filters": [],
"sensors": ["Symantec DAT Days Old"],
}
# ask the question 'Get Symantec DAT Version from all machines'
# and store results in "symantecdatver.csv"
GET_TANIUM_DATA["symantecdatver.csv"] = {
"filters": [],
"sensors": ["Symantec DAT Version"],
}
# ask the question 'Get Symantec Last Report Days Old from all machines'
# and store results in "symanteclasrep.csv"
GET_TANIUM_DATA["symanteclasrep.csv"] = {
"filters": [],
"sensors": ["Symantec Last Report Days Old"],
}
# ask the question 'Get Symantec SEP 12 Last Report Days Old from all machines'
# and store results in "symantecsep12lasrep.csv"
GET_TANIUM_DATA["symantecsep12lasrep.csv"] = {
"filters": [],
"sensors": ["Symantec SEP 12 Last Report Days Old"],
}
# ask the question 'Get SEP Client Version from all machines'
# and store results in "sepversion.csv"
GET_TANIUM_DATA["sepversion.csv"] = {
"filters": [],
"sensors": ["SEP Client Version"],
}
# ask the question 'Get SEP Client Virus Definitions Age from all machines'
# and store results in "sepvirusdef.csv"
GET_TANIUM_DATA["sepvirusdef.csv"] = {
"filters": [],
"sensors": ["SEP Client Virus Definitions Age"],
}
# ask the question 'Get SEP Client AV Running State from all machines'
# and store results in "sepavstate.csv"
GET_TANIUM_DATA["sepavstate.csv"] = {
"filters": [],
"sensors": ["SEP Client AV Running State"],
}
# ask the question 'Get SEP Client Firewall Running State from all machines'
# and store results in "sepfwstate.csv"
GET_TANIUM_DATA["sepfwstate.csv"] = {
"filters": [],
"sensors": ["SEP Client Firewall Running State"],
}
ANALYZE_DATA["cleaned_symantec_df"] = """
# clean out noise from symantec.csv
csv = "symantec.csv"
df = self.load_csv_as_df(csv)
result = self.clean_df(df, columns=["Name"])
"""
ANALYZE_DATA["cleaned_symantecversion_df"] = """
# clean out noise from symantecversion.csv
csv = "symantecversion.csv"
df = self.load_csv_as_df(csv)
result = self.clean_df(df, columns=["Symantec Client Version"])
"""
ANALYZE_DATA["cleaned_symantecdatdaysold_df"] = """
# clean out noise from symantecdatdaysold.csv
csv = "symantecdatdaysold.csv"
df = self.load_csv_as_df(csv)
result = self.clean_df(df, columns=["Symantec DAT Days Old"])
"""
ANALYZE_DATA["cleaned_symantecdatver_df"] = """
# clean out noise from symantecdatver.csv
csv = "symantecdatver.csv"
df = self.load_csv_as_df(csv)
result = self.clean_df(df, columns=["Symantec DAT Version"])
"""
# Done Cleaning
ANALYZE_DATA["ep_install_total"] = """
# total number endpoints reporting any Symantec product installed
csv = "symantectargets.csv"
df = self.load_csv_as_df(csv)
result = df['Count'].sum()
#csv = "symantecversion.csv"
#df = self.load_csv_as_df(csv)
#result = df['Count'].sum()
"""
ANALYZE_DATA["product_count"] = """
# get total count of Symantec products installed across endpoints
df = self.get_result("cleaned_symantec_df")
result = len(df['Name'].unique())
"""
ANALYZE_DATA["install_count"] = """
# get total number of times symantec products installed across all endpoints
csv = "symantec.csv"
df = self.load_csv_as_df(csv)
result = self.force_int(df['Count'].sum())
"""
ANALYZE_DATA["install_avg"] = """
# average Sym installs per endpoint
ep_install_total = self.get_result("ep_install_total")
install_count = self.get_result("install_count")
if ep_install_total > 0:
if (float(install_count) / float(ep_install_total)) < 1:
result = math.ceil(float(install_count) / float(ep_install_total))
else:
result = float(install_count) / float(ep_install_total)
else:
result = 0
result = int(result)
"""
ANALYZE_DATA["not_installed"] = """
# total number endpoints missing Sym (Not Installed)
df = self.get_result("cleaned_symantecversion_df")
col = 'Symantec Client Version'
result = df.loc[df[col] == 'Not Installed', 'Count'].sum()
"""
ANALYZE_DATA["versions_installed"] = """
# number of Sym Versions Detected
df = self.get_result("cleaned_symantecversion_df")
col = 'Symantec Client Version'
result = len(df.loc[df[col] != 'Not Installed'])
"""
ANALYZE_DATA["oldest_dat_days"] = """
# Sym Patterns Days Old (Oldest)
df = self.get_result("cleaned_symantecdatdaysold_df")
col = 'Symantec DAT Days Old'
#result = self.force_int(df.loc[df[col] != 'Not Installed'].max())
#result = (df.loc[df[col] != 'Not Installed']).max()
#result = df[df[col].is_numeric].max()[col]
#result = df.loc[df[col] == 'Not Installed', col].max()
#result = self.force_int(df[[col]].convert_objects(convert_numeric=True).dropna().max()[col])
val = pandas.to_numeric(df[col], errors='coerce').dropna().max()
result = self.force_int(val, 0) if val is not numpy.nan else "N/A"
"""
ANALYZE_DATA["outdated_symantec_dat"] = """
# Sym Patterns Days Old > 3
df = self.get_result("cleaned_symantecdatdaysold_df")
col = 'Symantec DAT Days Old'
#result = df.loc[df[col] > 3, 'Count'].sum()
#df[[col]].convert_objects(convert_numeric=True).dropna()
result = df.loc[df[col] >3, 'Count'].sum()
"""
ANALYZE_DATA["dat_versions"] = """
# Number of Detected dat Versions
df = self.get_result("cleaned_symantecdatver_df")
col = 'Symantec DAT Version'
result = len(df.loc[df[col] != 'Not Installed'])
"""
ANALYZE_DATA["versions_installed_df"] = """
# Data frame with all versions installed
df = self.get_result("cleaned_symantecdatver_df")
col = 'Symantec DAT Version'
result = df.loc[df[col] != 'Not Installed']
"""
ANALYZE_DATA["newest_version"] = """
# Latest version of version installed
df = self.get_result("versions_installed_df")
col = 'Symantec DAT Version'
#result = df.loc[df[col != 'Not Installed'].max()]
result = (df.loc[df[col] != 'Not Installed']).max()[col]
"""
ANALYZE_DATA["old_dat_versions_ep"] = """
# Number of Endpoints with "older" Symantec DAT Versions
df = self.get_result("versions_installed_df")
newest_ver = self.get_result("newest_version")
col = 'Symantec DAT Version'
result = df.loc[df[col] != newest_ver, 'Count'].sum()
"""
|