<s> from burp import IBurpExtender <EOL> from burp import ITab <EOL> from burp import IMessageEditorController <EOL> from burp import IContextMenuFactory <EOL> from java . awt import Component ; <EOL> from java . awt import GridLayout ; <EOL> from java . io import ObjectOutputStream ; <EOL> from java . io import FileOutputStream ; <EOL> from java . io import ObjectInputStream ; <EOL> from java . io import FileInputStream ; <EOL> from java . util import ArrayList ; <EOL> from java . lang import Boolean ; <EOL> from javax . swing import JScrollPane ; <EOL> from javax . swing import JSplitPane ; <EOL> from javax . swing import JTabbedPane ; <EOL> from javax . swing import JPanel ; <EOL> from javax . swing import JButton ; <EOL> from javax . swing import JTable ; <EOL> from javax . swing import JOptionPane ; <EOL> from javax . swing import JMenuItem ; <EOL> from javax . swing import JCheckBox ; <EOL> from javax . swing import JLabel ; <EOL> from javax . swing import JFileChooser ; <EOL> from javax . swing import JPopupMenu ; <EOL> from javax . swing import JTextField ; <EOL> from javax . swing . table import AbstractTableModel ; <EOL> from javax . swing . table import TableCellRenderer ; <EOL> from javax . swing . table import JTableHeader ; <EOL> from java . awt import Color ; <EOL> from java . awt . event import MouseAdapter ; <EOL> from java . awt . event import ActionListener ; <EOL> import java . lang ; <EOL> from org . python . core . util import StringUtil <EOL> from threading import Lock <EOL> from threading import Thread <EOL> import traceback <EOL> import re <EOL> class BurpExtender ( IBurpExtender , ITab , IMessageEditorController , IContextMenuFactory ) : <EOL> def registerExtenderCallbacks ( self , callbacks ) : <EOL> self . _callbacks = callbacks <EOL> self . _helpers = callbacks . getHelpers ( ) <EOL> callbacks . setExtensionName ( "<STR_LIT>" ) <EOL> self . _db = MatrixDB ( ) <EOL> self . _fc = JFileChooser ( ) <EOL> selfExtender = self <EOL> self . _selectedColumn = - <NUM_LIT:1> <EOL> self . _selectedRow = - <NUM_LIT:1> <EOL> self . _userTable = UserTable ( self , model = UserTableModel ( self . _db ) ) <EOL> roleScrollPane = JScrollPane ( self . _userTable ) <EOL> self . _userTable . redrawTable ( ) <EOL> self . _messageTable = MessageTable ( self , model = MessageTableModel ( self . _db ) ) <EOL> messageScrollPane = JScrollPane ( self . _messageTable ) <EOL> self . _messageTable . redrawTable ( ) <EOL> def addPopup ( component , popup ) : <EOL> class genericMouseListener ( MouseAdapter ) : <EOL> def mousePressed ( self , e ) : <EOL> if e . isPopupTrigger ( ) : <EOL> self . showMenu ( e ) <EOL> def mouseReleased ( self , e ) : <EOL> if e . isPopupTrigger ( ) : <EOL> self . showMenu ( e ) <EOL> def showMenu ( self , e ) : <EOL> if type ( component ) is JTableHeader : <EOL> table = component . getTable ( ) <EOL> column = component . columnAtPoint ( e . getPoint ( ) ) <EOL> if type ( table ) is MessageTable and column >= selfExtender . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT or type ( table ) is UserTable and column >= selfExtender . _db . STATIC_USER_TABLE_COLUMN_COUNT : <EOL> selfExtender . _selectedColumn = column <EOL> else : <EOL> return <EOL> else : <EOL> selfExtender . _selectedRow = component . rowAtPoint ( e . getPoint ( ) ) <EOL> popup . show ( e . getComponent ( ) , e . getX ( ) , e . getY ( ) ) <EOL> component . addMouseListener ( genericMouseListener ( ) ) <EOL> class actionRunMessage ( ActionListener ) : <EOL> def actionPerformed ( self , e ) : <EOL> if selfExtender . _selectedRow >= <NUM_LIT:0> : <EOL> if selfExtender . _selectedRow not in selfExtender . _messageTable . getSelectedRows ( ) : <EOL> indexes = [ selfExtender . _db . getMessageByRow ( selfExtender . _selectedRow ) . _index ] <EOL> else : <EOL> indexes = [ selfExtender . _db . getMessageByRow ( rowNum ) . _index for rowNum in selfExtender . _messageTable . getSelectedRows ( ) ] <EOL> t = Thread ( target = selfExtender . runMessagesThread , args = [ indexes ] ) <EOL> t . start ( ) <EOL> selfExtender . _selectedColumn = - <NUM_LIT:1> <EOL> class actionRemoveMessage ( ActionListener ) : <EOL> def actionPerformed ( self , e ) : <EOL> if selfExtender . _selectedRow >= <NUM_LIT:0> : <EOL> if selfExtender . _selectedRow not in selfExtender . _messageTable . getSelectedRows ( ) : <EOL> indexes = [ selfExtender . _db . getMessageByRow ( selfExtender . _selectedRow ) . _index ] <EOL> else : <EOL> indexes = [ selfExtender . _db . getMessageByRow ( rowNum ) . _index for rowNum in selfExtender . _messageTable . getSelectedRows ( ) ] <EOL> for i in indexes : <EOL> selfExtender . _db . deleteMessage ( i ) <EOL> selfExtender . _selectedColumn = - <NUM_LIT:1> <EOL> selfExtender . _messageTable . redrawTable ( ) <EOL> class actionRemoveUser ( ActionListener ) : <EOL> def actionPerformed ( self , e ) : <EOL> if selfExtender . _selectedRow >= <NUM_LIT:0> : <EOL> if selfExtender . _selectedRow not in selfExtender . _userTable . getSelectedRows ( ) : <EOL> indexes = [ selfExtender . _db . getUserByRow ( selfExtender . _selectedRow ) . _index ] <EOL> else : <EOL> indexes = [ selfExtender . _db . getUserByRow ( rowNum ) . _index for rowNum in selfExtender . _userTable . getSelectedRows ( ) ] <EOL> for i in indexes : <EOL> selfExtender . _db . deleteUser ( i ) <EOL> selfExtender . _selectedColumn = - <NUM_LIT:1> <EOL> selfExtender . _userTable . redrawTable ( ) <EOL> class actionRemoveRoleHeaderFromMessageTable ( ActionListener ) : <EOL> def actionPerformed ( self , e ) : <EOL> if selfExtender . _selectedColumn >= <NUM_LIT:0> : <EOL> selfExtender . _db . deleteRole ( selfExtender . _db . getRoleByMessageTableColumn ( selfExtender . _selectedColumn ) . _index ) <EOL> selfExtender . _selectedColumn = - <NUM_LIT:1> <EOL> selfExtender . _userTable . redrawTable ( ) <EOL> selfExtender . _messageTable . redrawTable ( ) <EOL> class actionRemoveRoleHeaderFromUserTable ( ActionListener ) : <EOL> def actionPerformed ( self , e ) : <EOL> if selfExtender . _selectedColumn >= <NUM_LIT:0> : <EOL> selfExtender . _db . deleteRole ( selfExtender . _db . getRoleByUserTableColumn ( selfExtender . _selectedColumn ) . _index ) <EOL> selfExtender . _selectedColumn = - <NUM_LIT:1> <EOL> selfExtender . _userTable . redrawTable ( ) <EOL> selfExtender . _messageTable . redrawTable ( ) <EOL> messagePopup = JPopupMenu ( ) <EOL> addPopup ( self . _messageTable , messagePopup ) <EOL> messageRun = JMenuItem ( "<STR_LIT>" ) <EOL> messageRun . addActionListener ( actionRunMessage ( ) ) <EOL> messagePopup . add ( messageRun ) <EOL> messageRemove = JMenuItem ( "<STR_LIT>" ) <EOL> messageRemove . addActionListener ( actionRemoveMessage ( ) ) <EOL> messagePopup . add ( messageRemove ) <EOL> messageHeaderPopup = JPopupMenu ( ) <EOL> addPopup ( self . _messageTable . getTableHeader ( ) , messageHeaderPopup ) <EOL> roleRemoveFromMessageTable = JMenuItem ( "<STR_LIT>" ) <EOL> roleRemoveFromMessageTable . addActionListener ( actionRemoveRoleHeaderFromMessageTable ( ) ) <EOL> messageHeaderPopup . add ( roleRemoveFromMessageTable ) <EOL> userPopup = JPopupMenu ( ) <EOL> addPopup ( self . _userTable , userPopup ) <EOL> userRemove = JMenuItem ( "<STR_LIT>" ) <EOL> userRemove . addActionListener ( actionRemoveUser ( ) ) <EOL> userPopup . add ( userRemove ) <EOL> userHeaderPopup = JPopupMenu ( ) <EOL> addPopup ( self . _userTable . getTableHeader ( ) , userHeaderPopup ) <EOL> roleRemoveFromUserTable = JMenuItem ( "<STR_LIT>" ) <EOL> roleRemoveFromUserTable . addActionListener ( actionRemoveRoleHeaderFromUserTable ( ) ) <EOL> userHeaderPopup . add ( roleRemoveFromUserTable ) <EOL> topPane = JSplitPane ( JSplitPane . VERTICAL_SPLIT , roleScrollPane , messageScrollPane ) <EOL> self . _tabs = JTabbedPane ( ) <EOL> buttons = JPanel ( ) <EOL> runButton = JButton ( "<STR_LIT>" , actionPerformed = self . runClick ) <EOL> newUserButton = JButton ( "<STR_LIT>" , actionPerformed = self . getInputUserClick ) <EOL> newRoleButton = JButton ( "<STR_LIT>" , actionPerformed = self . getInputRoleClick ) <EOL> saveButton = JButton ( "<STR_LIT>" , actionPerformed = self . saveClick ) <EOL> loadButton = JButton ( "<STR_LIT>" , actionPerformed = self . loadClick ) <EOL> clearButton = JButton ( "<STR_LIT>" , actionPerformed = self . clearClick ) <EOL> buttons . add ( runButton ) <EOL> buttons . add ( newUserButton ) <EOL> buttons . add ( newRoleButton ) <EOL> buttons . add ( saveButton ) <EOL> buttons . add ( loadButton ) <EOL> buttons . add ( clearButton ) <EOL> bottomPane = JSplitPane ( JSplitPane . VERTICAL_SPLIT , self . _tabs , buttons ) <EOL> self . _splitpane = JSplitPane ( JSplitPane . VERTICAL_SPLIT , topPane , bottomPane ) <EOL> callbacks . customizeUiComponent ( self . _splitpane ) <EOL> callbacks . customizeUiComponent ( topPane ) <EOL> callbacks . customizeUiComponent ( bottomPane ) <EOL> callbacks . customizeUiComponent ( messageScrollPane ) <EOL> callbacks . customizeUiComponent ( roleScrollPane ) <EOL> callbacks . customizeUiComponent ( self . _messageTable ) <EOL> callbacks . customizeUiComponent ( self . _userTable ) <EOL> callbacks . customizeUiComponent ( self . _tabs ) <EOL> callbacks . customizeUiComponent ( buttons ) <EOL> self . _splitpane . setResizeWeight ( <NUM_LIT:0.5> ) <EOL> topPane . setResizeWeight ( <NUM_LIT> ) <EOL> bottomPane . setResizeWeight ( <NUM_LIT> ) <EOL> self . _messageTable . setDefaultRenderer ( Boolean , SuccessBooleanRenderer ( self . _db ) ) <EOL> callbacks . addSuiteTab ( self ) <EOL> callbacks . registerContextMenuFactory ( self ) <EOL> return <EOL> def getTabCaption ( self ) : <EOL> return "<STR_LIT>" <EOL> def getUiComponent ( self ) : <EOL> return self . _splitpane <EOL> def createMenuItems ( self , invocation ) : <EOL> def addRequestsToTab ( e ) : <EOL> for messageInfo in messages : <EOL> messageIndex = self . _db . createNewMessage ( self . _callbacks . saveBuffersToTempFiles ( messageInfo ) , <EOL> self . _helpers . analyzeRequest ( messageInfo ) . getUrl ( ) ) <EOL> self . _messageTable . redrawTable ( ) <EOL> ret = [ ] <EOL> messages = invocation . getSelectedMessages ( ) <EOL> valid = True <EOL> if invocation . getInvocationContext ( ) == invocation . CONTEXT_TARGET_SITE_MAP_TREE : <EOL> for selected in messages : <EOL> if not selected . getResponse ( ) : <EOL> valid = False <EOL> if valid : <EOL> menuItem = JMenuItem ( "<STR_LIT>" ) ; <EOL> menuItem . addActionListener ( addRequestsToTab ) <EOL> ret . append ( menuItem ) <EOL> return ret <EOL> def getHttpService ( self ) : <EOL> return self . _currentlyDisplayedItem . getHttpService ( ) <EOL> def getRequest ( self ) : <EOL> return self . _currentlyDisplayedItem . getRequest ( ) <EOL> def getResponse ( self ) : <EOL> return self . _currentlyDisplayedItem . getResponse ( ) <EOL> def printDB ( self , e ) : <EOL> out = "<STR_LIT>" <EOL> for a in self . _db . arrayOfUsers : <EOL> out += str ( a . _index ) + "<STR_LIT:U+0020>" + a . _name + "<STR_LIT>" + str ( a . _roles ) + "<STR_LIT:\n>" <EOL> for b in self . _db . arrayOfMessages : <EOL> out += str ( b . _index ) + "<STR_LIT:U+0020>" + str ( b . _roles ) + "<STR_LIT:\n>" <EOL> JOptionPane . showMessageDialog ( self . _splitpane , out ) <EOL> def getInputUserClick ( self , e ) : <EOL> newUser = JOptionPane . showInputDialog ( self . _splitpane , "<STR_LIT>" ) <EOL> if not newUser is None : <EOL> self . _db . getOrCreateUser ( newUser ) <EOL> self . _userTable . redrawTable ( ) <EOL> def getInputRoleClick ( self , e ) : <EOL> newRole = JOptionPane . showInputDialog ( self . _splitpane , "<STR_LIT>" ) <EOL> if not newRole is None : <EOL> self . _db . getOrCreateRole ( newRole ) <EOL> self . _userTable . redrawTable ( ) <EOL> self . _messageTable . redrawTable ( ) <EOL> def saveClick ( self , e ) : <EOL> returnVal = self . _fc . showSaveDialog ( self . _splitpane ) <EOL> if returnVal == JFileChooser . APPROVE_OPTION : <EOL> f = self . _fc . getSelectedFile ( ) <EOL> if f . exists ( ) : <EOL> result = JOptionPane . showConfirmDialog ( self . _splitpane , "<STR_LIT>" , "<STR_LIT>" , JOptionPane . YES_NO_OPTION ) <EOL> if result != JOptionPane . YES_OPTION : <EOL> return <EOL> fileName = f . getPath ( ) <EOL> outs = ObjectOutputStream ( FileOutputStream ( fileName ) ) <EOL> outs . writeObject ( self . _db . getSaveableObject ( ) ) <EOL> outs . close ( ) <EOL> def loadClick ( self , e ) : <EOL> returnVal = self . _fc . showOpenDialog ( self . _splitpane ) <EOL> if returnVal == JFileChooser . APPROVE_OPTION : <EOL> warning = """<STR_LIT>""" <EOL> result = JOptionPane . showOptionDialog ( self . _splitpane , warning , "<STR_LIT>" , JOptionPane . YES_NO_OPTION , JOptionPane . WARNING_MESSAGE , None , [ "<STR_LIT:OK>" , "<STR_LIT>" ] , "<STR_LIT:OK>" ) <EOL> if result != JOptionPane . YES_OPTION : <EOL> return <EOL> f = self . _fc . getSelectedFile ( ) <EOL> fileName = f . getPath ( ) <EOL> ins = ObjectInputStream ( FileInputStream ( fileName ) ) <EOL> dbData = ins . readObject ( ) <EOL> ins . close ( ) <EOL> self . _db . load ( dbData , self ) <EOL> self . _userTable . redrawTable ( ) <EOL> self . _messageTable . redrawTable ( ) <EOL> def clearClick ( self , e ) : <EOL> result = JOptionPane . showConfirmDialog ( self . _splitpane , "<STR_LIT>" , "<STR_LIT>" , JOptionPane . YES_NO_OPTION ) <EOL> if result == JOptionPane . YES_OPTION : <EOL> self . _db . clear ( ) <EOL> self . _tabs . removeAll ( ) <EOL> self . _userTable . redrawTable ( ) <EOL> self . _messageTable . redrawTable ( ) <EOL> def runClick ( self , e ) : <EOL> t = Thread ( target = self . runMessagesThread ) <EOL> self . _tabs . removeAll ( ) <EOL> t . start ( ) <EOL> def changeDomainPopup ( self , oldDomain , index ) : <EOL> hostField = JTextField ( <NUM_LIT> ) <EOL> checkbox = JCheckBox ( ) <EOL> domainPanel = JPanel ( GridLayout ( <NUM_LIT:0> , <NUM_LIT:1> ) ) <EOL> domainPanel . add ( JLabel ( "<STR_LIT>" % ( str ( index ) , oldDomain ) ) ) <EOL> firstline = JPanel ( ) <EOL> firstline . add ( JLabel ( "<STR_LIT>" ) ) <EOL> firstline . add ( hostField ) <EOL> domainPanel . add ( firstline ) <EOL> secondline = JPanel ( ) <EOL> secondline . add ( JLabel ( "<STR_LIT>" ) ) <EOL> secondline . add ( checkbox ) <EOL> domainPanel . add ( secondline ) <EOL> result = JOptionPane . showConfirmDialog ( <EOL> self . _splitpane , domainPanel , "<STR_LIT>" , JOptionPane . OK_CANCEL_OPTION ) <EOL> cancelled = ( result == JOptionPane . CANCEL_OPTION ) <EOL> if cancelled : <EOL> return ( False , None , False ) <EOL> return ( True , hostField . getText ( ) , checkbox . isSelected ( ) ) <EOL> def runMessagesThread ( self , messageIndexes = None ) : <EOL> self . _db . lock . acquire ( ) <EOL> try : <EOL> indexes = messageIndexes <EOL> if not indexes : <EOL> indexes = self . _db . getActiveMessageIndexes ( ) <EOL> self . clearColorResults ( indexes ) <EOL> for index in indexes : <EOL> self . runMessage ( index ) <EOL> except : <EOL> traceback . print_exc ( file = self . _callbacks . getStderr ( ) ) <EOL> finally : <EOL> self . _db . lock . release ( ) <EOL> self . colorCodeResults ( ) <EOL> def getNewHeader ( self , requestInfo , token , isCookie ) : <EOL> headers = requestInfo . getHeaders ( ) <EOL> if isCookie : <EOL> cookieHeader = "<STR_LIT>" <EOL> newheader = cookieHeader <EOL> previousCookies = [ ] <EOL> for header in requestInfo . getHeaders ( ) : <EOL> if str ( header ) . startswith ( cookieHeader ) : <EOL> previousCookies = str ( header ) [ len ( cookieHeader ) : ] . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) . split ( "<STR_LIT:;>" ) <EOL> headers . remove ( header ) <EOL> newCookies = token . replace ( "<STR_LIT:U+0020>" , "<STR_LIT>" ) . split ( "<STR_LIT:;>" ) <EOL> newCookieVariableNames = [ ] <EOL> for newCookie in newCookies : <EOL> equalsToken = newCookie . find ( "<STR_LIT:=>" ) <EOL> if equalsToken >= <NUM_LIT:0> : <EOL> newCookieVariableNames . append ( newCookie [ <NUM_LIT:0> : equalsToken + <NUM_LIT:1> ] ) <EOL> for previousCookie in previousCookies : <EOL> equalsToken = previousCookie . find ( "<STR_LIT:=>" ) <EOL> if equalsToken >= <NUM_LIT:0> : <EOL> if previousCookie [ <NUM_LIT:0> : equalsToken + <NUM_LIT:1> ] not in newCookieVariableNames : <EOL> newCookies . append ( previousCookie ) <EOL> newCookies = [ x for x in newCookies if x ] <EOL> newheader = cookieHeader + "<STR_LIT:U+0020>" + "<STR_LIT:;>" . join ( newCookies ) <EOL> else : <EOL> newheader = token <EOL> colon = newheader . find ( "<STR_LIT::>" ) <EOL> if colon >= <NUM_LIT:0> : <EOL> for header in requestInfo . getHeaders ( ) : <EOL> if str ( header ) . startswith ( newheader [ <NUM_LIT:0> : colon + <NUM_LIT:1> ] ) : <EOL> headers . remove ( header ) <EOL> headers . add ( newheader ) <EOL> return headers <EOL> def runMessage ( self , messageIndex ) : <EOL> messageEntry = self . _db . arrayOfMessages [ messageIndex ] <EOL> messageEntry . _roleResults = { } <EOL> messageEntry . _userRuns = { } <EOL> messageInfo = messageEntry . _requestResponse <EOL> requestInfo = self . _helpers . analyzeRequest ( messageInfo ) <EOL> reqBody = messageInfo . getRequest ( ) [ requestInfo . getBodyOffset ( ) : ] <EOL> for userIndex in self . _db . getActiveUserIndexes ( ) : <EOL> userEntry = self . _db . arrayOfUsers [ userIndex ] <EOL> headers = self . getNewHeader ( requestInfo , userEntry . _token , userEntry . isCookie ( ) ) <EOL> newBody = reqBody <EOL> if userEntry . _staticcsrf and len ( reqBody ) : <EOL> delimeter = userEntry . _staticcsrf . find ( "<STR_LIT:=>" ) <EOL> if delimeter >= <NUM_LIT:0> : <EOL> csrfname = userEntry . _staticcsrf [ <NUM_LIT:0> : delimeter ] <EOL> csrfvalue = userEntry . _staticcsrf [ delimeter + <NUM_LIT:1> : ] <EOL> params = requestInfo . getParameters ( ) <EOL> for param in params : <EOL> if str ( param . getName ( ) ) == csrfname : <EOL> if param . getType ( ) == <NUM_LIT:1> : <EOL> newBody = reqBody [ <NUM_LIT:0> : param . getValueStart ( ) - requestInfo . getBodyOffset ( ) ] + StringUtil . toBytes ( csrfvalue ) + reqBody [ param . getValueEnd ( ) - requestInfo . getBodyOffset ( ) : ] <EOL> if newBody == reqBody : <EOL> newBody = reqBody + StringUtil . toBytes ( "<STR_LIT:&>" + userEntry . _staticcsrf ) <EOL> message = self . _helpers . buildHttpMessage ( headers , newBody ) <EOL> requestResponse = self . _callbacks . makeHttpRequest ( messageInfo . getHttpService ( ) , message ) <EOL> messageEntry . addRunByUserIndex ( userIndex , self . _callbacks . saveBuffersToTempFiles ( requestResponse ) ) <EOL> activeSuccessRoles = [ index for index in messageEntry . _roles . keys ( ) if messageEntry . _roles [ index ] and not self . _db . arrayOfRoles [ index ] . isDeleted ( ) ] <EOL> for roleIndex in self . _db . getActiveRoleIndexes ( ) : <EOL> success = self . checkResult ( messageEntry , roleIndex , activeSuccessRoles ) <EOL> messageEntry . setRoleResultByRoleIndex ( roleIndex , success ) <EOL> def colorCodeResults ( self ) : <EOL> self . _messageTable . redrawTable ( ) <EOL> def clearColorResults ( self , messageIndexArray = None ) : <EOL> if not messageIndexArray : <EOL> messageIndexes = self . _db . getActiveMessageIndexes ( ) <EOL> else : <EOL> messageIndexes = messageIndexArray <EOL> for messageIndex in messageIndexes : <EOL> messageEntry = self . _db . arrayOfMessages [ messageIndex ] <EOL> messageEntry . _roleResults = { } <EOL> messageEntry . _userRuns = { } <EOL> self . _messageTable . redrawTable ( ) <EOL> def checkResult ( self , messageEntry , roleIndex , activeSuccessRoles ) : <EOL> for userIndex in self . _db . getActiveUserIndexes ( ) : <EOL> userEntry = self . _db . arrayOfUsers [ userIndex ] <EOL> ignoreUser = False <EOL> if not userEntry . _roles [ roleIndex ] : <EOL> ignoreUser = True <EOL> for index in userEntry . _roles . keys ( ) : <EOL> if not index == roleIndex and userEntry . _roles [ index ] and index in activeSuccessRoles : <EOL> ignoreUser = True <EOL> if not ignoreUser : <EOL> shouldSucceed = roleIndex in activeSuccessRoles <EOL> requestResponse = messageEntry . _userRuns [ userEntry . _index ] <EOL> resp = StringUtil . fromBytes ( requestResponse . getResponse ( ) ) <EOL> found = re . search ( messageEntry . _successRegex , resp , re . DOTALL ) <EOL> succeeds = found if shouldSucceed else not found <EOL> if not succeeds : <EOL> return False <EOL> return True <EOL> class MatrixDB ( ) : <EOL> def __init__ ( self ) : <EOL> self . STATIC_USER_TABLE_COLUMN_COUNT = <NUM_LIT:3> <EOL> self . STATIC_MESSAGE_TABLE_COLUMN_COUNT = <NUM_LIT:3> <EOL> self . LOAD_TIMEOUT = <NUM_LIT> <EOL> self . lock = Lock ( ) <EOL> self . arrayOfMessages = ArrayList ( ) <EOL> self . arrayOfRoles = ArrayList ( ) <EOL> self . arrayOfUsers = ArrayList ( ) <EOL> self . deletedUserCount = <NUM_LIT:0> <EOL> self . deletedRoleCount = <NUM_LIT:0> <EOL> self . deletedMessageCount = <NUM_LIT:0> <EOL> def getOrCreateUser ( self , name , token = "<STR_LIT>" ) : <EOL> self . lock . acquire ( ) <EOL> userIndex = - <NUM_LIT:1> <EOL> for i in self . getActiveUserIndexes ( ) : <EOL> if self . arrayOfUsers [ i ] . _name == name : <EOL> userIndex = i <EOL> if userIndex < <NUM_LIT:0> : <EOL> userIndex = self . arrayOfUsers . size ( ) <EOL> self . arrayOfUsers . add ( UserEntry ( userIndex , <EOL> userIndex - self . deletedUserCount , <EOL> name , token ) ) <EOL> for roleIndex in self . getActiveRoleIndexes ( ) : <EOL> self . arrayOfUsers [ userIndex ] . addRoleByIndex ( roleIndex ) <EOL> self . lock . release ( ) <EOL> return userIndex <EOL> def getOrCreateRole ( self , role ) : <EOL> self . lock . acquire ( ) <EOL> roleIndex = - <NUM_LIT:1> <EOL> for i in self . getActiveRoleIndexes ( ) : <EOL> if self . arrayOfRoles [ i ] . _name == role : <EOL> roleIndex = i <EOL> if roleIndex < <NUM_LIT:0> : <EOL> roleIndex = self . arrayOfRoles . size ( ) <EOL> self . arrayOfRoles . add ( RoleEntry ( roleIndex , <EOL> roleIndex + self . STATIC_MESSAGE_TABLE_COLUMN_COUNT - self . deletedRoleCount , <EOL> roleIndex + self . STATIC_USER_TABLE_COLUMN_COUNT - self . deletedRoleCount , <EOL> role ) ) <EOL> for userIndex in self . getActiveUserIndexes ( ) : <EOL> self . arrayOfUsers [ userIndex ] . addRoleByIndex ( roleIndex ) <EOL> for messageIndex in self . getActiveMessageIndexes ( ) : <EOL> self . arrayOfMessages [ messageIndex ] . addRoleByIndex ( roleIndex ) <EOL> self . lock . release ( ) <EOL> return roleIndex <EOL> def createNewMessage ( self , messagebuffer , url ) : <EOL> self . lock . acquire ( ) <EOL> messageIndex = self . arrayOfMessages . size ( ) <EOL> self . arrayOfMessages . add ( MessageEntry ( messageIndex , messageIndex - self . deletedMessageCount , messagebuffer , url ) ) <EOL> for roleIndex in self . getActiveRoleIndexes ( ) : <EOL> self . arrayOfMessages [ messageIndex ] . addRoleByIndex ( roleIndex ) <EOL> self . lock . release ( ) <EOL> return messageIndex <EOL> def clear ( self ) : <EOL> self . lock . acquire ( ) <EOL> self . arrayOfMessages = ArrayList ( ) <EOL> self . arrayOfRoles = ArrayList ( ) <EOL> self . arrayOfUsers = ArrayList ( ) <EOL> self . deletedUserCount = <NUM_LIT:0> <EOL> self . deletedRoleCount = <NUM_LIT:0> <EOL> self . deletedMessageCount = <NUM_LIT:0> <EOL> self . lock . release ( ) <EOL> def load ( self , db , extender ) : <EOL> def loadRequestResponse ( index , callbacks , helpers , host , port , protocol , requestData ) : <EOL> try : <EOL> service = helpers . buildHttpService ( host , port , protocol ) <EOL> if service : <EOL> self . tempRequestResponse [ index ] = callbacks . makeHttpRequest ( service , requestData ) <EOL> except java . lang . RuntimeException : <EOL> return <EOL> except : <EOL> traceback . print_exc ( file = callbacks . getStderr ( ) ) <EOL> def replaceDomain ( requestData , oldDomain , newDomain ) : <EOL> reqstr = StringUtil . fromBytes ( requestData ) <EOL> reqstr = reqstr . replace ( oldDomain , newDomain ) <EOL> newreq = StringUtil . toBytes ( reqstr ) <EOL> return newreq <EOL> callbacks = extender . _callbacks <EOL> helpers = extender . _helpers <EOL> self . lock . acquire ( ) <EOL> self . arrayOfRoles = db . arrayOfRoles <EOL> self . arrayOfUsers = db . arrayOfUsers <EOL> self . deletedUserCount = db . deletedUserCount <EOL> self . deletedRoleCount = db . deletedRoleCount <EOL> self . deletedMessageCount = db . deletedMessageCount <EOL> self . arrayOfMessages = ArrayList ( ) <EOL> self . tempRequestResponse = [ ] <EOL> index = <NUM_LIT:0> <EOL> newDomain = None <EOL> replaceForAll = False <EOL> skipped = <NUM_LIT:0> <EOL> for message in db . arrayOfMessages : <EOL> keeptrying = True <EOL> while keeptrying : <EOL> self . tempRequestResponse . append ( None ) <EOL> if newDomain : <EOL> requestData = replaceDomain ( message . _requestData , message . _host , newDomain ) <EOL> host = newDomain <EOL> else : <EOL> requestData = message . _requestData <EOL> host = message . _host <EOL> t = Thread ( target = loadRequestResponse , args = [ index , callbacks , helpers , host , message . _port , message . _protocol , requestData ] ) <EOL> t . start ( ) <EOL> t . join ( self . LOAD_TIMEOUT ) <EOL> if not t . isAlive ( ) and self . tempRequestResponse [ index ] != None : <EOL> self . arrayOfMessages . add ( MessageEntry ( <EOL> message . _index , <EOL> message . _tableRow - skipped , <EOL> callbacks . saveBuffersToTempFiles ( self . tempRequestResponse [ index ] ) , <EOL> message . _url , message . _name , message . _roles , message . _successRegex , message . _deleted ) ) <EOL> keeptrying = False <EOL> if not replaceForAll : <EOL> newDomain = None <EOL> else : <EOL> keeptrying , newDomain , replaceForAll = extender . changeDomainPopup ( host , message . _tableRow ) <EOL> if not keeptrying : <EOL> skipped += <NUM_LIT:1> <EOL> index += <NUM_LIT:1> <EOL> self . lock . release ( ) <EOL> def getSaveableObject ( self ) : <EOL> self . lock . acquire ( ) <EOL> serializedMessages = [ ] <EOL> for message in self . arrayOfMessages : <EOL> serializedMessages . append ( MessageEntryData ( <EOL> message . _index , <EOL> message . _tableRow , <EOL> message . _requestResponse . getRequest ( ) , <EOL> message . _requestResponse . getHttpService ( ) . getHost ( ) , <EOL> message . _requestResponse . getHttpService ( ) . getPort ( ) , <EOL> message . _requestResponse . getHttpService ( ) . getProtocol ( ) , <EOL> message . _url , message . _name , message . _roles , message . _successRegex , message . _deleted ) ) <EOL> ret = MatrixDBData ( serializedMessages , self . arrayOfRoles , self . arrayOfUsers , self . deletedUserCount , self . deletedRoleCount , self . deletedMessageCount ) <EOL> self . lock . release ( ) <EOL> return ret <EOL> def getActiveUserIndexes ( self ) : <EOL> return [ x . _index for x in self . arrayOfUsers if not x . isDeleted ( ) ] <EOL> def getActiveRoleIndexes ( self ) : <EOL> return [ x . _index for x in self . arrayOfRoles if not x . isDeleted ( ) ] <EOL> def getActiveMessageIndexes ( self ) : <EOL> return [ x . _index for x in self . arrayOfMessages if not x . isDeleted ( ) ] <EOL> def getMessageByRow ( self , row ) : <EOL> for m in self . arrayOfMessages : <EOL> if not m . isDeleted ( ) and m . getTableRow ( ) == row : <EOL> return m <EOL> def getUserByRow ( self , row ) : <EOL> for u in self . arrayOfUsers : <EOL> if not u . isDeleted ( ) and u . getTableRow ( ) == row : <EOL> return u <EOL> def getRoleByMessageTableColumn ( self , column ) : <EOL> for r in self . arrayOfRoles : <EOL> if not r . isDeleted ( ) and r . getMTableColumn ( ) == column : <EOL> return r <EOL> def getRoleByUserTableColumn ( self , column ) : <EOL> for r in self . arrayOfRoles : <EOL> if not r . isDeleted ( ) and r . getUTableColumn ( ) == column : <EOL> return r <EOL> def deleteUser ( self , userIndex ) : <EOL> self . lock . acquire ( ) <EOL> userEntry = self . arrayOfUsers [ userIndex ] <EOL> if userEntry : <EOL> userEntry . _deleted = True <EOL> self . deletedUserCount += <NUM_LIT:1> <EOL> if len ( self . arrayOfUsers ) > userIndex + <NUM_LIT:1> : <EOL> for i in self . arrayOfUsers [ userIndex + <NUM_LIT:1> : ] : <EOL> i . _tableRow -= <NUM_LIT:1> <EOL> self . lock . release ( ) <EOL> def deleteRole ( self , roleIndex ) : <EOL> self . lock . acquire ( ) <EOL> roleEntry = self . arrayOfRoles [ roleIndex ] <EOL> if roleEntry : <EOL> roleEntry . _deleted = True <EOL> self . deletedRoleCount += <NUM_LIT:1> <EOL> if len ( self . arrayOfRoles ) > roleIndex + <NUM_LIT:1> : <EOL> for i in self . arrayOfRoles [ roleIndex + <NUM_LIT:1> : ] : <EOL> i . updateMTableColumn ( i . getMTableColumn ( ) - <NUM_LIT:1> ) <EOL> i . updateUTableColumn ( i . getUTableColumn ( ) - <NUM_LIT:1> ) <EOL> self . lock . release ( ) <EOL> def deleteMessage ( self , messageIndex ) : <EOL> self . lock . acquire ( ) <EOL> messageEntry = self . arrayOfMessages [ messageIndex ] <EOL> if messageEntry : <EOL> messageEntry . _deleted = True <EOL> self . deletedMessageCount += <NUM_LIT:1> <EOL> if len ( self . arrayOfMessages ) > messageIndex + <NUM_LIT:1> : <EOL> for i in self . arrayOfMessages [ messageIndex + <NUM_LIT:1> : ] : <EOL> i . _tableRow -= <NUM_LIT:1> <EOL> self . lock . release ( ) <EOL> def getUserEntriesWithinRole ( self , roleIndex ) : <EOL> return [ userEntry for userEntry in self . arrayOfUsers if userEntry . _roles [ roleIndex ] ] <EOL> class UserTableModel ( AbstractTableModel ) : <EOL> def __init__ ( self , db ) : <EOL> self . _db = db <EOL> def getRowCount ( self ) : <EOL> try : <EOL> return len ( self . _db . getActiveUserIndexes ( ) ) <EOL> except : <EOL> return <NUM_LIT:0> <EOL> def getColumnCount ( self ) : <EOL> try : <EOL> return len ( self . _db . getActiveRoleIndexes ( ) ) + self . _db . STATIC_USER_TABLE_COLUMN_COUNT <EOL> except : <EOL> return self . _db . STATIC_USER_TABLE_COLUMN_COUNT <EOL> def getColumnName ( self , columnIndex ) : <EOL> if columnIndex == <NUM_LIT:0> : <EOL> return "<STR_LIT>" <EOL> elif columnIndex == <NUM_LIT:1> : <EOL> return "<STR_LIT>" <EOL> elif columnIndex == <NUM_LIT:2> : <EOL> return "<STR_LIT>" <EOL> else : <EOL> roleEntry = self . _db . getRoleByUserTableColumn ( columnIndex ) <EOL> if roleEntry : <EOL> return roleEntry . _name <EOL> return "<STR_LIT>" <EOL> def getValueAt ( self , rowIndex , columnIndex ) : <EOL> userEntry = self . _db . getUserByRow ( rowIndex ) <EOL> if userEntry : <EOL> if columnIndex == <NUM_LIT:0> : <EOL> return str ( userEntry . _name ) <EOL> elif columnIndex == <NUM_LIT:1> : <EOL> return userEntry . _token <EOL> elif columnIndex == <NUM_LIT:2> : <EOL> return userEntry . _staticcsrf <EOL> else : <EOL> roleEntry = self . _db . getRoleByUserTableColumn ( columnIndex ) <EOL> if roleEntry : <EOL> roleIndex = roleEntry . _index <EOL> return roleIndex in userEntry . _roles and userEntry . _roles [ roleIndex ] <EOL> return "<STR_LIT>" <EOL> def addRow ( self , row ) : <EOL> self . fireTableRowsInserted ( row , row ) <EOL> def setValueAt ( self , val , row , col ) : <EOL> if self . _db . lock . locked ( ) : <EOL> return <EOL> userEntry = self . _db . getUserByRow ( row ) <EOL> if userEntry : <EOL> if col == <NUM_LIT:0> : <EOL> userEntry . _name = val <EOL> elif col == <NUM_LIT:1> : <EOL> userEntry . _token = val <EOL> elif col == <NUM_LIT:2> : <EOL> userEntry . _staticcsrf = val <EOL> else : <EOL> roleIndex = self . _db . getRoleByUserTableColumn ( col ) . _index <EOL> userEntry . addRoleByIndex ( roleIndex , val ) <EOL> self . fireTableCellUpdated ( row , col ) <EOL> def isCellEditable ( self , row , col ) : <EOL> return True <EOL> def getColumnClass ( self , columnIndex ) : <EOL> if columnIndex <= <NUM_LIT:2> : <EOL> return str <EOL> else : <EOL> return Boolean <EOL> class UserTable ( JTable ) : <EOL> def __init__ ( self , extender , model ) : <EOL> self . _extender = extender <EOL> self . setModel ( model ) <EOL> return <EOL> def redrawTable ( self ) : <EOL> self . getModel ( ) . fireTableStructureChanged ( ) <EOL> self . getModel ( ) . fireTableDataChanged ( ) <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:0> ) . setMinWidth ( <NUM_LIT:100> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:0> ) . setMaxWidth ( <NUM_LIT:1000> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:1> ) . setMinWidth ( <NUM_LIT> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:1> ) . setMaxWidth ( <NUM_LIT> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:2> ) . setMinWidth ( <NUM_LIT> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:2> ) . setMaxWidth ( <NUM_LIT> ) ; <EOL> self . getTableHeader ( ) . getDefaultRenderer ( ) . setHorizontalAlignment ( JLabel . CENTER ) <EOL> class MessageTableModel ( AbstractTableModel ) : <EOL> def __init__ ( self , db ) : <EOL> self . _db = db <EOL> def getRowCount ( self ) : <EOL> try : <EOL> return len ( self . _db . getActiveMessageIndexes ( ) ) <EOL> except : <EOL> return <NUM_LIT:0> <EOL> def getColumnCount ( self ) : <EOL> return self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT + len ( self . _db . getActiveRoleIndexes ( ) ) <EOL> def getColumnName ( self , columnIndex ) : <EOL> if columnIndex == <NUM_LIT:0> : <EOL> return "<STR_LIT>" <EOL> elif columnIndex == <NUM_LIT:1> : <EOL> return "<STR_LIT>" <EOL> elif columnIndex == <NUM_LIT:2> : <EOL> return "<STR_LIT>" <EOL> else : <EOL> roleEntry = self . _db . getRoleByMessageTableColumn ( columnIndex ) <EOL> if roleEntry : <EOL> return roleEntry . _name <EOL> return "<STR_LIT>" <EOL> def getValueAt ( self , rowIndex , columnIndex ) : <EOL> messageEntry = self . _db . getMessageByRow ( rowIndex ) <EOL> if messageEntry : <EOL> if columnIndex == <NUM_LIT:0> : <EOL> return str ( messageEntry . getTableRow ( ) ) <EOL> elif columnIndex == <NUM_LIT:1> : <EOL> return messageEntry . _name <EOL> elif columnIndex == <NUM_LIT:2> : <EOL> return messageEntry . _successRegex <EOL> else : <EOL> roleEntry = self . _db . getRoleByMessageTableColumn ( columnIndex ) <EOL> if roleEntry : <EOL> roleIndex = roleEntry . _index <EOL> return roleIndex in messageEntry . _roles and messageEntry . _roles [ roleIndex ] <EOL> return "<STR_LIT>" <EOL> def addRow ( self , row ) : <EOL> self . fireTableRowsInserted ( row , row ) <EOL> def setValueAt ( self , val , row , col ) : <EOL> if self . _db . lock . locked ( ) : <EOL> return <EOL> messageEntry = self . _db . getMessageByRow ( row ) <EOL> if col == self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT - <NUM_LIT:2> : <EOL> messageEntry . _name = val <EOL> elif col == self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT - <NUM_LIT:1> : <EOL> messageEntry . _successRegex = val <EOL> else : <EOL> roleIndex = self . _db . getRoleByMessageTableColumn ( col ) . _index <EOL> messageEntry . addRoleByIndex ( roleIndex , val ) <EOL> self . fireTableCellUpdated ( row , col ) <EOL> def isCellEditable ( self , row , col ) : <EOL> if col >= self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT - <NUM_LIT:2> : <EOL> return True <EOL> return False <EOL> def getColumnClass ( self , columnIndex ) : <EOL> if columnIndex < self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT : <EOL> return str <EOL> else : <EOL> return Boolean <EOL> class MessageTable ( JTable ) : <EOL> def __init__ ( self , extender , model ) : <EOL> self . _extender = extender <EOL> self . setModel ( model ) <EOL> return <EOL> def changeSelection ( self , row , col , toggle , extend ) : <EOL> selectedMessage = self . getModel ( ) . _db . getMessageByRow ( row ) <EOL> self . _extender . _tabs . removeAll ( ) <EOL> if self . getModel ( ) . _db . lock . locked ( ) : <EOL> self . redrawTable ( ) <EOL> return <EOL> originalTab = self . createRequestTabs ( selectedMessage . _requestResponse ) <EOL> originalTab . setSelectedIndex ( <NUM_LIT:0> ) <EOL> self . _extender . _tabs . addTab ( "<STR_LIT>" , originalTab ) <EOL> for userIndex in selectedMessage . _userRuns . keys ( ) : <EOL> if not self . getModel ( ) . _db . arrayOfUsers [ userIndex ] . isDeleted ( ) : <EOL> tabname = str ( self . getModel ( ) . _db . arrayOfUsers [ userIndex ] . _name ) <EOL> self . _extender . _tabs . addTab ( tabname , self . createRequestTabs ( selectedMessage . _userRuns [ userIndex ] ) ) <EOL> self . _extender . _currentlyDisplayedItem = selectedMessage . _requestResponse <EOL> JTable . changeSelection ( self , row , col , toggle , extend ) <EOL> return <EOL> def createRequestTabs ( self , requestResponse ) : <EOL> requestTabs = JTabbedPane ( ) <EOL> requestViewer = self . _extender . _callbacks . createMessageEditor ( self . _extender , False ) <EOL> responseViewer = self . _extender . _callbacks . createMessageEditor ( self . _extender , False ) <EOL> requestTabs . addTab ( "<STR_LIT>" , requestViewer . getComponent ( ) ) <EOL> requestTabs . addTab ( "<STR_LIT>" , responseViewer . getComponent ( ) ) <EOL> self . _extender . _callbacks . customizeUiComponent ( requestTabs ) <EOL> requestViewer . setMessage ( requestResponse . getRequest ( ) , True ) <EOL> if requestResponse . getResponse ( ) : <EOL> responseViewer . setMessage ( requestResponse . getResponse ( ) , False ) <EOL> requestTabs . setSelectedIndex ( <NUM_LIT:1> ) <EOL> return requestTabs <EOL> def redrawTable ( self ) : <EOL> self . getModel ( ) . fireTableStructureChanged ( ) <EOL> self . getModel ( ) . fireTableDataChanged ( ) <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:0> ) . setMinWidth ( <NUM_LIT:30> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:0> ) . setMaxWidth ( <NUM_LIT:30> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:1> ) . setMinWidth ( <NUM_LIT> ) ; <EOL> self . getColumnModel ( ) . getColumn ( <NUM_LIT:2> ) . setMinWidth ( <NUM_LIT> ) ; <EOL> class SuccessBooleanRenderer ( JCheckBox , TableCellRenderer ) : <EOL> def __init__ ( self , db ) : <EOL> self . setOpaque ( True ) <EOL> self . setHorizontalAlignment ( JLabel . CENTER ) <EOL> self . _db = db <EOL> def getTableCellRendererComponent ( self , table , value , isSelected , hasFocus , row , column ) : <EOL> if value : <EOL> self . setSelected ( True ) <EOL> else : <EOL> self . setSelected ( False ) <EOL> if isSelected : <EOL> self . setForeground ( table . getSelectionForeground ( ) ) <EOL> self . setBackground ( table . getSelectionBackground ( ) ) <EOL> else : <EOL> self . setForeground ( table . getForeground ( ) ) <EOL> self . setBackground ( table . getBackground ( ) ) <EOL> if column >= self . _db . STATIC_MESSAGE_TABLE_COLUMN_COUNT : <EOL> messageEntry = self . _db . getMessageByRow ( row ) <EOL> if messageEntry : <EOL> roleEntry = self . _db . getRoleByMessageTableColumn ( column ) <EOL> if roleEntry : <EOL> roleIndex = roleEntry . _index <EOL> if not roleIndex in messageEntry . _roleResults : <EOL> self . setBackground ( table . getBackground ( ) ) <EOL> else : <EOL> if messageEntry . _roleResults [ roleIndex ] : <EOL> self . setBackground ( Color . GREEN ) <EOL> else : <EOL> self . setBackground ( Color . RED ) <EOL> return self <EOL> class MessageEntry : <EOL> def __init__ ( self , index , tableRow , requestResponse , url , name = "<STR_LIT>" , roles = { } , regex = "<STR_LIT>" , deleted = False ) : <EOL> self . _index = index <EOL> self . _tableRow = tableRow <EOL> self . _requestResponse = requestResponse <EOL> self . _url = url <EOL> self . _name = url . getPath ( ) if not name else name <EOL> self . _roles = roles . copy ( ) <EOL> self . _successRegex = regex <EOL> self . _deleted = deleted <EOL> self . _userRuns = { } <EOL> self . _roleResults = { } <EOL> return <EOL> def addRoleByIndex ( self , roleIndex , enabled = False ) : <EOL> self . _roles [ roleIndex ] = enabled ; <EOL> def addRunByUserIndex ( self , userIndex , requestResponse ) : <EOL> self . _userRuns [ userIndex ] = requestResponse <EOL> def setRoleResultByRoleIndex ( self , roleIndex , roleResult ) : <EOL> self . _roleResults [ roleIndex ] = roleResult <EOL> def isDeleted ( self ) : <EOL> return self . _deleted <EOL> def updateTableRow ( self , row ) : <EOL> self . _tableRow = row <EOL> def getTableRow ( self ) : <EOL> return self . _tableRow <EOL> class UserEntry : <EOL> def __init__ ( self , index , rowIndex , name , token = "<STR_LIT>" ) : <EOL> self . _index = index <EOL> self . _name = name <EOL> self . _roles = { } <EOL> self . _deleted = False <EOL> self . _tableRow = rowIndex <EOL> self . _token = token <EOL> self . _staticcsrf = "<STR_LIT>" <EOL> return <EOL> def addRoleByIndex ( self , roleIndex , enabled = False ) : <EOL> self . _roles [ roleIndex ] = enabled <EOL> def isDeleted ( self ) : <EOL> return self . _deleted <EOL> def updateTableRow ( self , row ) : <EOL> self . _tableRow = row <EOL> def getTableRow ( self ) : <EOL> return self . _tableRow <EOL> def isCookie ( self ) : <EOL> return self . _token . find ( "<STR_LIT:=>" ) > <NUM_LIT:0> and ( self . _token . find ( "<STR_LIT::>" ) == - <NUM_LIT:1> or self . _token . find ( "<STR_LIT:=>" ) < self . _token . find ( "<STR_LIT::>" ) ) <EOL> class RoleEntry : <EOL> def __init__ ( self , index , mTableColumnIndex , uTableColumnIndex , name ) : <EOL> self . _index = index <EOL> self . _name = name <EOL> self . _deleted = False <EOL> self . _mTableColumn = mTableColumnIndex <EOL> self . _uTableColumn = uTableColumnIndex <EOL> return <EOL> def isDeleted ( self ) : <EOL> return self . _deleted <EOL> def updateMTableColumn ( self , column ) : <EOL> self . _mTableColumn = column <EOL> def getMTableColumn ( self ) : <EOL> return self . _mTableColumn <EOL> def updateUTableColumn ( self , column ) : <EOL> self . _uTableColumn = column <EOL> def getUTableColumn ( self ) : <EOL> return self . _uTableColumn <EOL> class MatrixDBData ( ) : <EOL> def __init__ ( self , arrayOfMessages , arrayOfRoles , arrayOfUsers , deletedUserCount , deletedRoleCount , deletedMessageCount ) : <EOL> self . arrayOfMessages = arrayOfMessages <EOL> self . arrayOfRoles = arrayOfRoles <EOL> self . arrayOfUsers = arrayOfUsers <EOL> self . deletedUserCount = deletedUserCount <EOL> self . deletedRoleCount = deletedRoleCount <EOL> self . deletedMessageCount = deletedMessageCount <EOL> class MessageEntryData : <EOL> def __init__ ( self , index , tableRow , requestData , host , port , protocol , url , name , roles , successRegex , deleted ) : <EOL> self . _index = index <EOL> self . _tableRow = tableRow <EOL> self . _requestData = requestData <EOL> self . _host = host <EOL> self . _port = port <EOL> self . _protocol = protocol <EOL> self . _url = url <EOL> self . _name = name <EOL> self . _roles = roles <EOL> self . _successRegex = successRegex <EOL> self . _deleted = deleted <EOL> return </s>
