wifipumpkin3/plugins/extension/plugin.py
2018-09-22 14:15:41 -03:00

34 lines
1.1 KiB
Python

import logging
from bs4 import BeautifulSoup
from PyQt4.QtCore import QObject,pyqtSignal
from core.utility.collection import SettingsINI
import core.utility.constants as C
class PluginTemplate(QObject):
name = 'plugin master'
version = '1.0'
config = SettingsINI(C.PUMPPROXY_INI)
loggers = {}
send_output = pyqtSignal(object)
def init_logger(self,session):
self.loggers['Pumpkin-Proxy'] = self.setup_logger('Pumpkin-Proxy',
'logs/AccessPoint/pumpkin-proxy.log',session)
self.log = self.loggers['Pumpkin-Proxy']
def setup_logger(self,logger_name, log_file,key=str(), level=logging.INFO):
if self.loggers.get(logger_name):
return self.loggers.get(logger_name)
else:
logger = logging.getLogger(logger_name)
formatter = logging.Formatter('SessionID[{}] %(asctime)s : %(message)s'.format(key))
fileHandler = logging.FileHandler(log_file, mode='a')
fileHandler.setFormatter(formatter)
logger.setLevel(logging.INFO)
logger.addHandler(fileHandler)
return logger
def request(self, flow):
raise NotImplementedError
def response(self, flow):
raise NotImplementedError