<s> '''<STR_LIT>''' <EOL> from burp import IBurpExtender <EOL> from burp import IMessageEditorTabFactory <EOL> from burp import IMessageEditorTab <EOL> import re <EOL> class BurpExtender ( IBurpExtender , IMessageEditorTabFactory ) : <EOL> def registerExtenderCallbacks ( self , callbacks ) : <EOL> self . _callbacks = callbacks <EOL> self . _helpers = callbacks . getHelpers ( ) <EOL> callbacks . setExtensionName ( "<STR_LIT>" ) <EOL> callbacks . registerMessageEditorTabFactory ( self ) <EOL> def createNewInstance ( self , controller , editable ) : <EOL> tab = UrlDecoderTab ( self , controller , editable ) <EOL> return tab <EOL> class UrlDecoderTab ( IMessageEditorTab ) : <EOL> def __init__ ( self , extender , controller , editable ) : <EOL> self . _extender = extender <EOL> self . _editable = editable <EOL> self . _txtInput = extender . _callbacks . createTextEditor ( ) <EOL> self . _txtInput . setEditable ( editable ) <EOL> return <EOL> def decodeData ( self , content ) : <EOL> params = self . _extender . _helpers . analyzeRequest ( content ) . getParameters ( ) <EOL> getparams = '<STR_LIT>' <EOL> postparams = '<STR_LIT>' <EOL> cookies = '<STR_LIT>' <EOL> val = '<STR_LIT>' <EOL> for param in params : <EOL> name = param . getName ( ) <EOL> ptype = param . getType ( ) <EOL> value = param . getValue ( ) <EOL> if not value . endswith ( '<STR_LIT>' ) : <EOL> value += '<STR_LIT>' <EOL> value = self . _extender . _helpers . base64Decode ( value ) <EOL> value = self . _extender . _helpers . bytesToString ( value ) <EOL> print repr ( value ) , isinstance ( value , str ) <EOL> m1 = re . search ( r'<STR_LIT>' , value ) <EOL> if m1 is None : <EOL> val = value <EOL> else : <EOL> val = '<STR_LIT>' <EOL> if ptype == param . PARAM_URL : <EOL> getparams = getparams + name + '<STR_LIT:=>' + val + '<STR_LIT:&>' <EOL> if ptype == param . PARAM_BODY : <EOL> postparams = postparams + name + '<STR_LIT:=>' + val + '<STR_LIT:&>' <EOL> if ptype == param . PARAM_COOKIE : <EOL> cookies = cookies + name + '<STR_LIT:=>' + val + '<STR_LIT:;>' <EOL> return cookies , getparams , postparams <EOL> def getTabCaption ( self ) : <EOL> return "<STR_LIT>" <EOL> def getUiComponent ( self ) : <EOL> return self . _txtInput . getComponent ( ) <EOL> def isModified ( self ) : <EOL> return self . _txtInput . isTextModified ( ) <EOL> def getSelectedData ( self ) : <EOL> return self . _txtInput . getSelectedText ( ) <EOL> def isEnabled ( self , content , isRequest ) : <EOL> return isRequest <EOL> def setMessage ( self , content , isRequest ) : <EOL> if content is None : <EOL> self . _txtInput . setText ( None ) <EOL> self . _txtInput . setEditable ( False ) <EOL> else : <EOL> cookies , getparams , postparams = self . decodeData ( content ) <EOL> output = '<STR_LIT>' <EOL> if len ( cookies ) > <NUM_LIT:0> : <EOL> output += '<STR_LIT>' + '<STR_LIT:->' * <NUM_LIT:10> + '<STR_LIT:\n>' + cookies [ : - <NUM_LIT:1> ] + '<STR_LIT:\n>' <EOL> if len ( getparams ) > <NUM_LIT:0> : <EOL> output += '<STR_LIT>' + '<STR_LIT:->' * <NUM_LIT:20> + '<STR_LIT:\n>' + getparams [ : - <NUM_LIT:1> ] + '<STR_LIT:\n>' <EOL> if len ( postparams ) > <NUM_LIT:0> : <EOL> output += '<STR_LIT>' + '<STR_LIT:->' * <NUM_LIT:20> + '<STR_LIT:\n>' + postparams [ : - <NUM_LIT:1> ] + '<STR_LIT:\n>' <EOL> self . _txtInput . setText ( output ) <EOL> self . _txtInput . setEditable ( self . _editable ) <EOL> return <EOL> def getMessage ( self ) : <EOL> return self . _currentMessage </s>
