Skip to content

Commit

Permalink
fix(syslogaction): use templating engine
Browse files Browse the repository at this point in the history
  • Loading branch information
d-Rickyy-b committed Mar 4, 2020
1 parent c061c0f commit 54d3652
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pastepwn/actions/syslogaction.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
import logging.handlers

from pastepwn.util import TemplatingEngine
from .basicaction import BasicAction


class SyslogAction(BasicAction):
"""Action to log a paste to the syslog"""
name = "SyslogAction"

def __init__(self, syslog_address="/dev/log"):
def __init__(self, syslog_address="/dev/log", template=None):
"""
This sets up a syslogger, which defaults to /dev/log.
That means that it will work on most linux systems,
Expand All @@ -18,6 +19,7 @@ def __init__(self, syslog_address="/dev/log"):
/var/run/syslog
"""
super().__init__()
self.template = template
self.logger = logging.getLogger('SyslogLogger')
self.logger.setLevel(logging.DEBUG)

Expand All @@ -32,4 +34,5 @@ def perform(self, paste, analyzer_name=None, matches=None):
:param matches: List of matches returned by the analyzer
:return: None
"""
self.logger.debug("New Paste matched: {0}".format(paste))
text = TemplatingEngine.fill_template(paste, analyzer_name, template_string=self.template, matches=matches)
self.logger.debug(text)

0 comments on commit 54d3652

Please sign in to comment.