コード例 #1
0
    def start(self, name = None, isNew = False, ip = None):
        if platform.system() == 'Windows':
            os.sys.path.append('c:/python/lib/site-packages')
        else:
            pass
            #os.sys.path.append('/usr/lib/python3/dist-packages')
            #os.sys.path.append('/usr/local/lib/python2.7/dist-packages')
            #os.sys.path.append('/usr/lib/python3.6/dist-packages')
            #os.sys.path.append('/usr/lib/python3.7/dist-packages')
        import sys
        sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

        import Screen
        import Setup
        import Enumeration
        import Exploit
        import Maintain
        import Parsers

        self._rhost = '127.0.0.1'
        self._rport = 'ALL'
        self._targetOS = 'Agnostic'
        self._sessionId = ''
        self._threads = '50'
        self._outputTty = None
        self._autoScreenShot = False
        self._wordlist = '/usr/share/wordlists/rockyou.txt'
        self._httpWordlist = '/usr/share/wordlists/rockyou.txt'
        self._dbWordlist = '/usr/share/wordlists/rockyou.txt'
        self._userlist = '../wordlists/usernames.txt'
        
        self.DEV_MODE = True
        self.CWD = os.getcwd()
        self.attackManager = Attack.AttackManager()
        self.targetHost = TargetHost.TargetHost()
        self.parserManager = Parsers.ParserManager()
        self.checklistManager = Checklist.ChecklistManager()

        if name == None or len(name) < 5 or isNew == True:
            # New session
            if isNew == True:
                self._id = name
                self._sessionId = name
                
                if ip != None:
                    self._rhost = ip
            else:
                self._id = str(uuid.uuid4())[:5]
                self._sessionId = str(date.today()) + '-' + self._id
        else:
            # Saved session
            self._id = name[5:]
            self._sessionId = name

            self.load(self._sessionId)  

        # Create session directories
        self._workingDir = './' + self._sessionId
        if not os.path.exists(self._workingDir):
            os.makedirs(self._workingDir)

        self._exploitDir = self._workingDir + '/exploits'
        if not os.path.exists(self._exploitDir):
            os.makedirs(self._exploitDir)

        self._lootDir = self._workingDir + '/loot'
        if not os.path.exists(self._lootDir):
            os.makedirs(self._lootDir)

        self._intelDir = self._workingDir + '/intel'
        if not os.path.exists(self._intelDir):
            os.makedirs(self._intelDir)

        self._reportDir = self._workingDir + '/report'
        if not os.path.exists(self._reportDir):
            os.makedirs(self._reportDir)

        # Set standard report/markdown files
        #self._reportOutput = self._reportDir + '/output.md'
        #self._reportResult = self._reportDir + '/result.md'

        # Logging
        logging.basicConfig(format='%(asctime)s %(message)s', filemode = 'a', datefmt='%m/%d/%Y %I:%M:%S %p', filename=self._workingDir + '/session.log', level=logging.INFO)  
        self.save()

        self.screen = Screen.Screen()
        self.setup = Setup.Setup()
        self.enumeration = Enumeration.Enumeration()
        self.exploit = Exploit.Exploit()
        self.maintain = Maintain.Maintain()
        self.toolManager = ToolManager.ToolManager()
        self.PROCS = []
        self.USE_SDKS = False