MCPcopy
hub / github.com/jipegit/OSXAuditor / HTMLLog

Function HTMLLog

osxauditor.py:169–202  ·  view source on GitHub ↗

Write a string of HTML log depending of its type

(LogStr, TYPE)

Source from the content-addressed store, hash-verified

167 HTML_LOG_FILE.close()
168
169def HTMLLog(LogStr, TYPE):
170 ''' Write a string of HTML log depending of its type '''
171
172 global HTML_LOG_CONTENT
173 global HTML_LOG_MENU
174
175 if TYPE == 'INFO':
176 Splitted = LogStr.split(' ')
177 if re.match('[A-Fa-f\d]{32}', Splitted[0]): #Should be a md5
178 Link = u'<a href=\'https://www.virustotal.com/fr/file/' + Splitted[0] + u'/analysis/\'>' + Splitted[0] + u'</a> '
179 HTML_LOG_CONTENT += u"<i class='icon-file'></i> " + Link + u" ".join(Splitted[1:]) + u"<br>"
180 else:
181 HTML_LOG_CONTENT += u"<i class='icon-file'></i> " + LogStr + u"<br>"
182
183 elif TYPE == "INFO_RAW":
184 HTML_LOG_CONTENT += u"<pre>" + LogStr + u"</pre><br>"
185
186 elif TYPE == "WARNING":
187 HTML_LOG_CONTENT += u"<div class=\"alert alert-error\"><i class='icon-fire'></i> "+ LogStr + u"</div>"
188
189 elif TYPE == "ERROR":
190 HTML_LOG_CONTENT += u"<div class=\"alert\"><i class='icon-warning-sign'></i> "+ LogStr + u"</div>"
191
192 elif TYPE == "SECTION":
193 HTML_LOG_CONTENT += u"<h2 id=\"" + LogStr + u"\">" + LogStr + u"</h2>"
194 HTML_LOG_MENU += u"</ul></li><li class=\"dropdown\"><a href=\"#\" role=\"button\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">" + LogStr + u"<b class=\"caret\"></b></a><ul class=\"dropdown-menu\">"
195 HTML_LOG_MENU += u"<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#" + LogStr + u"\">" + LogStr + u"</a></li><li class=\"divider\"></li>"
196
197 elif TYPE == "SUBSECTION":
198 HTML_LOG_CONTENT += u"<h3 id=\"" + LogStr + u"\">" + LogStr + u"</h3>"
199 HTML_LOG_MENU += u"<li role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#" + LogStr + u"\">" + LogStr + u"</a></li>"
200
201 elif TYPE == "DEBUG":
202 HTML_LOG_CONTENT += u"<i class='icon-wrench'></i> " + LogStr + u"<br>"
203
204def SyslogSetup(SyslogServer):
205 ''' Set the Syslog handler up'''

Callers 1

PrintAndLogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected