Commit fa62e83e by fwkz

Logging rsf exceptions

parent 649c423e
import logging
LOGGER = logging.getLogger(__name__)
class RoutersploitException(Exception): class RoutersploitException(Exception):
pass def __init__(self, msg=''):
super(RoutersploitException, self).__init__(msg)
LOGGER.exception(self)
class OptionValidationError(RoutersploitException): class OptionValidationError(RoutersploitException):
......
import unittest import unittest
import logging
from routersploit.utils import NonStringIterable from routersploit.utils import NonStringIterable
logging.getLogger().addHandler(logging.NullHandler())
class RoutersploitTestCase(unittest.TestCase): class RoutersploitTestCase(unittest.TestCase):
def assertIsDecorated(self, function, decorator_name): def assertIsDecorated(self, function, decorator_name):
try: try:
......
...@@ -3,10 +3,17 @@ ...@@ -3,10 +3,17 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import logging.handlers
from routersploit.interpreter import RoutersploitInterpreter from routersploit.interpreter import RoutersploitInterpreter
from routersploit.utils import create_exploit from routersploit.utils import create_exploit
log_handler = logging.handlers.RotatingFileHandler(filename='routersploit.log', maxBytes=500000)
log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s')
log_handler.setFormatter(log_formatter)
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.DEBUG)
LOGGER.addHandler(log_handler)
parser = argparse.ArgumentParser(description='RouterSploit - Router Exploitation Framework') parser = argparse.ArgumentParser(description='RouterSploit - Router Exploitation Framework')
parser.add_argument('-a', parser.add_argument('-a',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment