Created
February 28, 2020 00:35
-
-
Save d-Rickyy-b/e83dab86b812a3cacc112d1851223de2 to your computer and use it in GitHub Desktop.
Sample config for pastepwn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import logging.handlers | |
import os | |
from pastepwn import PastePwn | |
# Import new actions here - you need to import each action prior to using it | |
from pastepwn.actions import EmailAction, IrcAction | |
# Import new analyzers here - you need to import each analyzer prior to using it | |
from pastepwn.analyzers import MailAnalyzer, WordAnalyzer | |
from pastepwn.database import MysqlDB | |
# Setting up the logging | |
logdir_path = os.path.dirname(os.path.abspath(__file__)) | |
logfile_path = os.path.join(logdir_path, "logs", "pastepwn.log") | |
if not os.path.exists(os.path.join(logdir_path, "logs")): | |
os.makedirs(os.path.join(logdir_path, "logs")) | |
logfile_handler = logging.handlers.WatchedFileHandler(logfile_path, "a", "utf-8") | |
logger = logging.getLogger(__name__) | |
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO, handlers=[logfile_handler, logging.StreamHandler()]) | |
# Framework code | |
database = MysqlDB(ip="localhost", port=3306, username="MYUSername", password="MYPAssword") | |
pastepwn = PastePwn(database) | |
# You need to replace 'me@gmail.com' with your sender mail address, | |
# "myPassword" with the password of that address, | |
# the receiver (me@example.com) with the receiver of the mail | |
# and the hostname (smtp.gmail.com) with the SMTP server hostname of your mail provider. | |
# Define your actions here: | |
email_action = EmailAction(username="me@gmail.com", password="myPassword", receiver="me@example.com", hostname="smtp.gmail.com") | |
# You need to replace the data with your IRC server's data! | |
irc_action = IrcAction(server="servernameORipaddress", channel="channel", port=6667, nick="pastepwn") | |
# Define your analyzers here: | |
# You can now use the IrcAction with the same analyzer or with another analyzer - let's try with another analyzer: | |
# You can uncomment the following line, if you want to have a WordAnalyzer searching for the Word "anything" | |
# word_analyzer = WordAnalyzer(irc_action, words="anything") | |
# You can create as many analyzers as you want! | |
# Or you can use the same MailAnalyzer as before and simply add another action to it. | |
# You can use as many actions as you want! | |
actions = [email_action, irc_action] | |
mail_analyzer = MailAnalyzer(actions) | |
# Now we add all our analyzers to pastepwn | |
pastepwn.add_analyzer(mail_analyzer) | |
pastepwn.add_analyzer(word_analyzer) | |
# And all the way in the end we start pastepwn | |
pastepwn.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add as many analyzers as you want. One analyzer always scans pastes for a certain word or pattern. And each analyzer can have multiple actions attached to it. So in theory you could have:
But of course you can also use different actions on different analyzers. And you can even use them twice: