def createChecklistSection(self, title, checklistItems): checklistSection = Report.Section(title) checklistItems = Checklist.compileChecklist(self.project, self.trace, checklistItems) for item in checklistItems: title = "%s [%s]" % (item.name, item.verdict and "PASS" or "FAIL") itemSection = checklistSection.create(Report.Section, title) itemSection.create(Report.Paragraph, item.verdict and "PASS" or "FAIL", elementClass = item.verdict and "checkpass" or "checkfail") itemSection.create(Report.Paragraph, item.description) commentList = itemSection.create(Report.UnorderedList) # List unique comments only comments = sorted(item.comments, key = lambda c: c[1]) lastComment = None repeatedEvents = [] for event, comment in comments + [(None, None)]: if comment != lastComment: if lastComment and repeatedEvents: if len(repeatedEvents) < 100: commentList.addItem("Previous comment repeated for %s." % ", ".join(["%s (%d)" % (e.name, e.seq) for e in repeatedEvents])) else: commentList.addItem("Previous comment repeated for %d events." % len(repeatedEvents)) if comment: if event: commentList.addItem("%s (%d): %s" % (self.getEventDescription(event), event.seq, comment)) else: commentList.addItem(comment) lastComment = comment repeatedEvents = [] elif event: repeatedEvents.append(event) return checklistSection
def runTraceChecklist(self, traceName, fileName = None): """ Run a GLES trace through a checklist of common performance issues. @param traceName: Name of trace to check @param fileName: File to which the checklist is saved """ if not traceName in self.analyzer.traces: self.analyzer.fail("Trace not found: %s" % traceName) trace = self.analyzer.traces[traceName] if fileName: output = open(fileName, "w") print >>output, "GLES Checklist Report" print >>output, "=====================" print >>output, "" else: output = None checklistItems = Checklist.compileChecklist(self.analyzer.project, trace, GlesChecklist.checklistItems) for item in checklistItems: if item.verdict: self.analyzer.reportInfo(str(item)) else: self.analyzer.reportError(str(item)) if output: title = "%s [%s]" % (item.name, item.verdict and "PASS" or "FAIL") print >>output, title print >>output, "-" * len(title) print >>output, "" print >>output, StringUtils.wordWrap(item.description) print >>output, "" # Print unique comments only comments = sorted(item.comments, key = lambda c: c[1]) lastComment = None repeatedEvents = [] for event, comment in comments + [(None, None)]: if comment != lastComment: if lastComment and repeatedEvents: if len(repeatedEvents) < 100: print >>output, StringUtils.wordWrap("* Last comment repeated for %s" % ", ".join(["%s (%d)" % (e.name, e.seq) for e in repeatedEvents]), indent = " " * 4, extraIndent = " ") else: print >>output, StringUtils.wordWrap("* Last comment repeated for %d events." % len(repeatedEvents), indent = " " * 4, extraIndent = " ") if comment: if event: print >>output, StringUtils.wordWrap("* %s (%d): %s" % (event.name, event.seq, comment), indent = " " * 4, extraIndent = " ") else: print >>output, StringUtils.wordWrap("* %s" % (comment), indent = " " * 4, extraIndent = " ") lastComment = comment repeatedEvents = [] elif event: repeatedEvents.append(event) print >>output, ""
def createChecklistSection(self, title, checklistItems): checklistSection = Report.Section(title) checklistItems = Checklist.compileChecklist(self.project, self.trace, checklistItems) for item in checklistItems: title = "%s [%s]" % (item.name, item.verdict and "PASS" or "FAIL") itemSection = checklistSection.create(Report.Section, title) itemSection.create(Report.Paragraph, item.verdict and "PASS" or "FAIL", elementClass=item.verdict and "checkpass" or "checkfail") itemSection.create(Report.Paragraph, item.description) commentList = itemSection.create(Report.UnorderedList) # List unique comments only comments = sorted(item.comments, key=lambda c: c[1]) lastComment = None repeatedEvents = [] for event, comment in comments + [(None, None)]: if comment != lastComment: if lastComment and repeatedEvents: if len(repeatedEvents) < 100: commentList.addItem( "Previous comment repeated for %s." % ", ".join([ "%s (%d)" % (e.name, e.seq) for e in repeatedEvents ])) else: commentList.addItem( "Previous comment repeated for %d events." % len(repeatedEvents)) if comment: if event: commentList.addItem( "%s (%d): %s" % (self.getEventDescription(event), event.seq, comment)) else: commentList.addItem(comment) lastComment = comment repeatedEvents = [] elif event: repeatedEvents.append(event) return checklistSection
def __init__(self, parent, id=wx.ID_ANY): wx.Panel.__init__(self, parent, id) self.SetBackgroundColour(wx.Colour(255, 255, 255)) ps = wx.BoxSizer(wx.VERTICAL) self.splitter = wx.SplitterWindow(self, wx.VERTICAL) ps.Add(self.splitter, 1, flag=wx.EXPAND) self.SetSizer(ps) #--------------------------------------------------------------------------------------------- self.leftPanel = wx.Panel(self.splitter) bs = wx.BoxSizer(wx.VERTICAL) self.leftPanel.SetSizer(bs) self.leftPanel.SetBackgroundColour(wx.Colour(255, 255, 255)) self.leftPanel.Bind(wx.EVT_SIZE, self.setWrappedRaceInfo) buttonSize = 220 self.button = RoundButton(self.leftPanel, size=(buttonSize, buttonSize)) self.button.SetLabel(FinishText) self.button.SetFontToFitLabel() self.button.SetForegroundColour(wx.Colour(128, 128, 128)) self.Bind(wx.EVT_BUTTON, self.onPress, self.button) self.clock = Clock(self, size=(190, 190), checkFunc=self.updateClock) self.clock.SetBackgroundColour(wx.WHITE) self.raceIntro = wx.StaticText(self.leftPanel, label=u'') self.raceIntro.SetFont(wx.Font(20, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) self.chipTimingOptions = wx.RadioBox( self.leftPanel, label=_("Chip Timing Options"), majorDimension=1, choices=Properties.RfidProperties.choices, style=wx.RA_SPECIFY_COLS) self.Bind(wx.EVT_RADIOBOX, self.onChipTimingOptions, self.chipTimingOptions) self.settingsButton = wx.BitmapButton( self.leftPanel, bitmap=Utils.GetPngBitmap('settings-icon.png')) self.settingsButton.SetToolTip(wx.ToolTip(_('Properties Shortcut'))) self.settingsButton.Bind(wx.EVT_BUTTON, self.onShowProperties) self.startRaceTimeCheckBox = wx.CheckBox( self.leftPanel, label=_('Start Race Automatically at Future Time')) hsSettings = wx.BoxSizer(wx.HORIZONTAL) hsSettings.Add(self.settingsButton, flag=wx.ALIGN_CENTER_VERTICAL) hsSettings.Add(self.startRaceTimeCheckBox, flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=12) border = 8 hs = wx.BoxSizer(wx.HORIZONTAL) hs.Add(self.button, border=border, flag=wx.LEFT | wx.TOP) hs.Add(self.raceIntro, 1, border=border, flag=wx.LEFT | wx.TOP | wx.RIGHT | wx.EXPAND) bs.Add(hs, border=border, flag=wx.ALL) hsClock = wx.BoxSizer(wx.HORIZONTAL) hsClock.AddSpacer(26) hsClock.Add(self.clock) hsClock.Add(hsSettings, border=4, flag=wx.LEFT) bs.Add(hsClock, border=4, flag=wx.ALL) bs.Add(self.chipTimingOptions, border=border, flag=wx.ALL) #--------------------------------------------------------------------------------------------- self.rightPanel = wx.Panel(self.splitter) self.rightPanel.SetBackgroundColour(wx.Colour(255, 255, 255)) checklistTitle = wx.StaticText(self.rightPanel, label=_('Checklist:')) checklistTitle.SetFont( wx.Font(14, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.checklist = Checklist.Checklist(self.rightPanel) hsSub = wx.BoxSizer(wx.VERTICAL) hsSub.Add(checklistTitle, 0, flag=wx.ALL, border=4) hsSub.Add(self.checklist, 1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=4) self.rightPanel.SetSizer(hsSub) #--------------------------------------------------------------------------------------------- self.splitter.SplitVertically(self.leftPanel, self.rightPanel) self.splitter.SetMinimumPaneSize(100) wx.CallAfter(self.refresh) wx.CallAfter(self.splitter.SetSashPosition, 650) wx.CallAfter(self.GetSizer().Layout)
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
def setupGame(characterPicked, data): data.time = 0 data.numOfPlayers = 6 data.characterPicked = characterPicked #todo data.current = data.numOfPlayers-1 #index in player order of current player data.currentSuggestion = None #todo data.disproveCount = None #who is disproving data.humanCanDisprove = False #if the human can disprove it data.shown = None data.nextTurn = False #wait before going to next turn data.selectedToShow = None data.tellHumanToShow = False data.humanMoved = False data.pBeingMoved = False #person moved to another room data.winner = None data.disproved = True #initial locations: (by index in player order) data.locations = [(23,7), (17,0), (0,9), (0,14), (6,23), (19,23)] data.checklist = Checklist(data) data.board = GameBoard(data) data.boardMap = BoardMap(data) data.buttons = Buttons(data) data.roll = 6 data.rolled = False #hooman hasn't rolled yet data.moved = False data.gameStarted = False data.losers = [] data.selectedCharac = None #for accusations data.selectedWeapon = None data.selectedRoom = None numCardsPerPlayer = data.numOfCards//data.numOfPlayers usedCards = [] #cards that have been assigned #places cards in envelope: 'solution' envelope = placingInEnvelope(data) data.solution = envelope usedCards += envelope print(data.solution) data.human = Human(data, characterPicked) #initializing 5 AI players: data.p1 = AIPlayer(data, 1) data.p2 = AIPlayer(data, 2) data.p3 = AIPlayer(data, 3) data.p4 = AIPlayer(data, 4) data.p5 = AIPlayer(data, 5) order = [data.p1, data.p2, data.p3, data.p4, data.p5] data.playerOrder = order[:characterPicked] + [data.human] + order[characterPicked:] #they go in that order for player in data.playerOrder: Cards = randomAssignment(usedCards,numCardsPerPlayer,data.numOfCards) usedCards += Cards[0] player.inputInitialInfo(data, Cards[1]) i = data.playerOrder.index(player) player.setInitialLocation(data, data.locations[i][0], data.locations[i][1]) #gives different cards to each one data.img1 = PhotoImage(file = "imagesGIF\%d.gif" %data.human.cards[0]) data.img2 = PhotoImage(file = "imagesGIF\%d.gif" %data.human.cards[1]) data.img3 = PhotoImage(file = "imagesGIF\%d.gif" %data.human.cards[2]) data.cardImgs = [data.img1, data.img2, data.img3]