idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
20,800
private ZapTextField getTxtHeadline ( ) { if ( txtHeadline == null ) { txtHeadline = new ZapTextField ( ) ; txtHeadline . setBorder ( javax . swing . BorderFactory . createEtchedBorder ( javax . swing . border . EtchedBorder . RAISED ) ) ; txtHeadline . setEditable ( false ) ; txtHeadline . setEnabled ( false ) ; txtHe...
Gets text field that shows the name of the selected panel .
20,801
private DefaultTreeModel getTreeModel ( ) { if ( treeModel == null ) { treeModel = new DefaultTreeModel ( getRootNode ( ) ) ; treeModel . setRoot ( getRootNode ( ) ) ; } return treeModel ; }
This method initializes treeModel
20,802
public void removeParamPanel ( AbstractParamPanel panel ) { if ( currentShownPanel == panel ) { currentShownPanel = null ; nameLastSelectedPanel = null ; if ( isShowing ( ) ) { if ( tablePanel . isEmpty ( ) ) { getTxtHeadline ( ) . setText ( "" ) ; getHelpButton ( ) . setVisible ( false ) ; } else { getTreeParam ( ) . ...
Removes the given panel .
20,803
public void initParam ( Object obj ) { paramObject = obj ; Enumeration < AbstractParamPanel > en = tablePanel . elements ( ) ; AbstractParamPanel panel = null ; while ( en . hasMoreElements ( ) ) { panel = en . nextElement ( ) ; panel . initParam ( obj ) ; } }
Initialises all panels with the given object .
20,804
public void expandParamPanelNode ( String panelName ) { DefaultMutableTreeNode node = getTreeNodeFromPanelName ( panelName ) ; if ( node != null ) { getTreeParam ( ) . expandPath ( new TreePath ( node . getPath ( ) ) ) ; } }
Expands the node of the param panel with the given name .
20,805
public boolean isParamPanelSelected ( String panelName ) { DefaultMutableTreeNode node = getTreeNodeFromPanelName ( panelName ) ; if ( node != null ) { return getTreeParam ( ) . isPathSelected ( new TreePath ( node . getPath ( ) ) ) ; } return false ; }
Tells whether or not the given param panel is selected .
20,806
public boolean isParamPanelOrChildSelected ( String panelName ) { DefaultMutableTreeNode node = getTreeNodeFromPanelName ( panelName ) ; if ( node != null ) { TreePath panelPath = new TreePath ( node . getPath ( ) ) ; if ( getTreeParam ( ) . isPathSelected ( panelPath ) ) { return true ; } TreePath selectedPath = getTr...
Tells whether or not the given param panel or one of its child panels is selected .
20,807
private JScrollPane getJScrollPane1 ( ) { if ( jScrollPane1 == null ) { jScrollPane1 = new JScrollPane ( ) ; jScrollPane1 . setName ( "jScrollPane1" ) ; jScrollPane1 . setViewportView ( getJPanel ( ) ) ; jScrollPane1 . setHorizontalScrollBarPolicy ( javax . swing . JScrollPane . HORIZONTAL_SCROLLBAR_NEVER ) ; jScrollPa...
This method initializes jScrollPane1
20,808
private JButton getHelpButton ( ) { if ( btnHelp == null ) { btnHelp = new JButton ( ) ; btnHelp . setBorder ( null ) ; btnHelp . setIcon ( new ImageIcon ( AbstractParamContainerPanel . class . getResource ( "/resource/icon/16/201.png" ) ) ) ; btnHelp . addActionListener ( getShowHelpAction ( ) ) ; btnHelp . setToolTip...
Gets the button that allows to show the help page of the panel .
20,809
private boolean isExcluded ( String uri ) { if ( excludeList == null || excludeList . isEmpty ( ) ) { return false ; } for ( String ex : excludeList ) { if ( uri . matches ( ex ) ) { return true ; } } return false ; }
Tells whether or not the given URI is excluded .
20,810
private boolean isDomainInScope ( String domain ) { for ( String scope : scopes ) { if ( domain . matches ( scope ) ) { return true ; } } return false ; }
Tells whether or not the given domain is one of the domains in scope .
20,811
private boolean isDomainAlwaysInScope ( String domain ) { for ( DomainAlwaysInScopeMatcher domainInScope : domainsAlwaysInScope ) { if ( domainInScope . matches ( domain ) ) { return true ; } } return false ; }
Tells whether or not the given domain is one of the domains always in scope .
20,812
public void setDomainsAlwaysInScope ( List < DomainAlwaysInScopeMatcher > domainsAlwaysInScope ) { if ( domainsAlwaysInScope == null || domainsAlwaysInScope . isEmpty ( ) ) { this . domainsAlwaysInScope = Collections . emptyList ( ) ; } else { this . domainsAlwaysInScope = domainsAlwaysInScope ; } }
Sets the domains that will be considered as always in scope .
20,813
private boolean paramAppend ( StringBuilder sb , String name , String value , ParameterParser parser ) { boolean isEdited = false ; if ( name != null ) { sb . append ( name ) ; isEdited = true ; } if ( value != null ) { sb . append ( parser . getDefaultKeyValueSeparator ( ) ) ; sb . append ( value ) ; isEdited = true ;...
Set the name value pair into the StringBuilder . If both name and value is null not to append whole parameter .
20,814
private LogPanel getLogPanel ( ) { if ( logPanel == null ) { logPanel = new LogPanel ( getView ( ) ) ; logPanel . setName ( Constant . messages . getString ( "history.panel.title" ) ) ; logPanel . setIcon ( new ImageIcon ( ExtensionHistory . class . getResource ( "/resource/icon/16/025.png" ) ) ) ; logPanel . setHideab...
This method initializes logPanel
20,815
private static boolean isHistoryTypeToShow ( int historyType ) { return historyType == HistoryReference . TYPE_PROXIED || historyType == HistoryReference . TYPE_ZAP_USER || historyType == HistoryReference . TYPE_AUTHENTICATION || historyType == HistoryReference . TYPE_PROXY_CONNECT ; }
Tells whether or not the messages with the given history type should be shown in the History tab .
20,816
public ManualRequestEditorDialog getResendDialog ( ) { if ( resendDialog == null ) { resendDialog = new ManualHttpRequestEditorDialog ( true , "resend" , "ui.dialogs.manreq" ) ; resendDialog . setTitle ( Constant . messages . getString ( "manReq.dialog.title" ) ) ; } return resendDialog ; }
This method initializes resendDialog
20,817
public boolean isDefaultSessionToken ( String token ) { if ( getParam ( ) . getDefaultTokensEnabled ( ) . contains ( token . toLowerCase ( Locale . ENGLISH ) ) ) return true ; return false ; }
Checks if a particular token is part of the default session tokens set by the user using the options panel . The default session tokens are valid for all sites . The check is being performed in a lower - case manner as default session tokens are case - insensitive .
20,818
private boolean isRemovedDefaultSessionToken ( String site , String token ) { if ( removedDefaultTokens == null ) return false ; HashSet < String > removed = removedDefaultTokens . get ( site ) ; if ( removed == null || ! removed . contains ( token ) ) return false ; return true ; }
Checks if a particular default session token was removed by an user as a session token for a site .
20,819
private void markRemovedDefaultSessionToken ( String site , String token ) { if ( removedDefaultTokens == null ) removedDefaultTokens = new HashMap < > ( 1 ) ; HashSet < String > removedSet = removedDefaultTokens . get ( site ) ; if ( removedSet == null ) { removedSet = new HashSet < > ( 1 ) ; removedDefaultTokens . pu...
Marks a default session token as removed for a particular site .
20,820
private void unmarkRemovedDefaultSessionToken ( String site , String token ) { if ( removedDefaultTokens == null ) return ; HashSet < String > removed = removedDefaultTokens . get ( site ) ; if ( removed == null ) return ; removed . remove ( token ) ; }
Unmarks a default session token as removed for a particular site .
20,821
public boolean isSessionToken ( String site , String token ) { if ( ! site . contains ( ":" ) ) { site = site + ( ":80" ) ; } HttpSessionTokensSet siteTokens = sessionTokens . get ( site ) ; if ( siteTokens == null ) return false ; return siteTokens . isSessionToken ( token ) ; }
Checks if a particular token is a session token name for a particular site .
20,822
public void addHttpSessionToken ( String site , String token ) { if ( ! site . contains ( ":" ) ) { site = site + ( ":80" ) ; } HttpSessionTokensSet siteTokens = sessionTokens . get ( site ) ; if ( siteTokens == null ) { siteTokens = new HttpSessionTokensSet ( ) ; sessionTokens . put ( site , siteTokens ) ; } if ( log ...
Adds a new session token for a particular site .
20,823
public List < HttpSession > getHttpSessionsForContext ( Context context ) { List < HttpSession > sessions = new LinkedList < > ( ) ; if ( this . sessions == null ) { return sessions ; } synchronized ( sessionLock ) { for ( Entry < String , HttpSessionsSite > e : this . sessions . entrySet ( ) ) { String siteName = e . ...
Builds and returns a list of http sessions that correspond to a given context .
20,824
public HttpSessionTokensSet getHttpSessionTokensSetForContext ( Context context ) { for ( Entry < String , HttpSessionTokensSet > e : this . sessionTokens . entrySet ( ) ) { String siteName = e . getKey ( ) ; siteName = "http://" + siteName ; if ( context . isInContext ( siteName ) ) return e . getValue ( ) ; } return ...
Gets the http session tokens set for the first site matching a given Context .
20,825
public List < String > getSites ( ) { List < String > sites = new ArrayList < String > ( ) ; if ( this . sessions == null ) { return sites ; } synchronized ( sessionLock ) { sites . addAll ( this . sessions . keySet ( ) ) ; } return sites ; }
Gets all of the sites with http sessions .
20,826
public void setLength ( int length ) { if ( length < 0 || body . length == length ) { return ; } int oldPos = pos ; pos = Math . min ( pos , length ) ; byte [ ] newBody = new byte [ length ] ; System . arraycopy ( body , 0 , newBody , 0 , pos ) ; body = newBody ; if ( oldPos > pos ) { cachedString = null ; } }
Sets the current length of the body . If the current content is longer the excessive data will be truncated .
20,827
static Pattern createIncludedFilesPattern ( ) { String messagesFilesRegex = LocaleUtils . createResourceFilesRegex ( Constant . MESSAGES_PREFIX , Constant . MESSAGES_EXTENSION ) ; String vulnerabilitiesFilesRegex = LocaleUtils . createResourceFilesRegex ( Constant . VULNERABILITIES_PREFIX , Constant . VULNERABILITIES_E...
Relaxed visibility to allow unit test
20,828
public void setForcedUser ( int contextId , User user ) { if ( user != null ) this . contextForcedUsersMap . put ( contextId , user ) ; else this . contextForcedUsersMap . remove ( contextId ) ; this . updateForcedUserModeToggleButtonState ( ) ; }
Sets the forced user for a context .
20,829
public void setForcedUser ( int contextId , int userId ) throws IllegalStateException { User user = getUserManagementExtension ( ) . getContextUserAuthManager ( contextId ) . getUserById ( userId ) ; if ( user == null ) throw new IllegalStateException ( "No user matching the provided id was found." ) ; setForcedUser ( ...
Sets the forced user for a context based on the user id .
20,830
public byte [ ] getBytes ( ) { if ( ! changed ) { return buf ; } byte [ ] newBuf = new byte [ bufLen ] ; System . arraycopy ( buf , 0 , newBuf , 0 , bufLen ) ; buf = newBuf ; return buf ; }
Return the current byte array containing the bytes .
20,831
private void init ( ) { this . paused = false ; this . stopped = true ; this . tasksDoneCount = 0 ; this . tasksTotalCount = 0 ; this . initialized = false ; defaultFetchFilter = new DefaultFetchFilter ( ) ; this . addFetchFilter ( defaultFetchFilter ) ; for ( FetchFilter filter : extension . getCustomFetchFilters ( ) ...
Initialize the spider .
20,832
public void setExcludeList ( List < String > excludeList ) { log . debug ( "New Exclude list: " + excludeList ) ; defaultFetchFilter . setExcludeRegexes ( excludeList ) ; }
Sets the exclude list which contains a List of strings defining the uris that should be excluded .
20,833
protected synchronized void submitTask ( SpiderTask task ) { if ( isStopped ( ) ) { log . debug ( "Submitting task skipped (" + task + ") as the Spider process is stopped." ) ; return ; } if ( isTerminated ( ) ) { log . debug ( "Submitting task skipped (" + task + ") as the Spider process is terminated." ) ; return ; }...
Submit a new task to the spidering task pool .
20,834
public void start ( ) { log . info ( "Starting spider..." ) ; this . timeStarted = System . currentTimeMillis ( ) ; fetchFilterSeeds ( ) ; if ( seedList == null || seedList . isEmpty ( ) ) { log . warn ( "No seeds available for the Spider. Cancelling scan..." ) ; notifyListenersSpiderComplete ( false ) ; notifyListener...
Starts the Spider crawling .
20,835
private void fetchFilterSeeds ( ) { if ( seedList == null || seedList . isEmpty ( ) ) { return ; } for ( Iterator < URI > it = seedList . iterator ( ) ; it . hasNext ( ) ; ) { URI seed = it . next ( ) ; for ( FetchFilter filter : controller . getFetchFilters ( ) ) { FetchStatus filterReason = filter . checkFilter ( see...
Filters the seed list using the current fetch filters preventing any non - valid seed from being accessed .
20,836
public void stop ( ) { if ( stopped ) { return ; } this . stopped = true ; log . info ( "Stopping spidering process by request." ) ; if ( this . paused ) { this . resume ( ) ; } this . threadPool . shutdown ( ) ; try { if ( ! this . threadPool . awaitTermination ( 2 , TimeUnit . SECONDS ) ) { log . warn ( "Failed to aw...
Stops the Spider crawling . Must not be called from any of the threads in the thread pool .
20,837
private void complete ( ) { if ( stopped ) { return ; } log . info ( "Spidering process is complete. Shutting down..." ) ; this . stopped = true ; if ( httpSender != null ) { this . getHttpSender ( ) . shutdown ( ) ; httpSender = null ; } controller . reset ( ) ; new Thread ( new Runnable ( ) { public void run ( ) { if...
The Spidering process is complete .
20,838
protected void checkPauseAndWait ( ) { pauseLock . lock ( ) ; try { while ( paused && ! stopped ) { pausedCondition . await ( ) ; } } catch ( InterruptedException e ) { } finally { pauseLock . unlock ( ) ; } }
This method is run by Threads in the ThreadPool and checks if the scan is paused and if it is waits until it s unpaused .
20,839
protected synchronized void postTaskExecution ( ) { if ( stopped ) { return ; } tasksDoneCount ++ ; int percentageComplete = tasksDoneCount * 100 / tasksTotalCount ; this . notifyListenersSpiderProgress ( percentageComplete , tasksDoneCount , tasksTotalCount - tasksDoneCount ) ; if ( tasksDoneCount == tasksTotalCount &...
This method is run by each thread in the Thread Pool after the task execution . Particularly it notifies the listeners of the progress and checks if the scan is complete . Called from the SpiderTask .
20,840
public boolean isStopped ( ) { if ( ! stopped && this . spiderParam . getMaxDuration ( ) > 0 ) { if ( TimeUnit . MILLISECONDS . toMinutes ( System . currentTimeMillis ( ) - this . timeStarted ) > this . spiderParam . getMaxDuration ( ) ) { log . info ( "Spidering process has exceeded maxDuration of " + this . spiderPar...
Checks if is stopped i . e . a shutdown was issued or it is not running .
20,841
protected synchronized void notifyListenersSpiderProgress ( int percentageComplete , int numberCrawled , int numberToCrawl ) { for ( SpiderListener l : listeners ) { l . spiderProgress ( percentageComplete , numberCrawled , numberToCrawl ) ; } }
Notifies all the listeners regarding the spider progress .
20,842
protected synchronized void notifyListenersFoundURI ( String uri , String method , FetchStatus status ) { for ( SpiderListener l : listeners ) { l . foundURI ( uri , method , status ) ; } }
Notifies the listeners regarding a found uri .
20,843
public void addContextDataFactory ( ContextDataFactory contextDataFactory ) { if ( contextDataFactory == null ) { throw new IllegalArgumentException ( "Parameter contextDataFactory must not be null." ) ; } this . contextDataFactories . add ( contextDataFactory ) ; if ( postInitialisation ) { for ( Context context : get...
Adds the given context data factory to the model .
20,844
public void importContext ( Context ctx , Configuration config ) throws ConfigurationException { validateContextNotNull ( ctx ) ; validateConfigNotNull ( config ) ; for ( ContextDataFactory cdf : this . contextDataFactories ) { cdf . importContextData ( ctx , config ) ; } }
Import a context from the given configuration
20,845
public void exportContext ( Context ctx , Configuration config ) { validateContextNotNull ( ctx ) ; validateConfigNotNull ( config ) ; for ( ContextDataFactory cdf : this . contextDataFactories ) { cdf . exportContextData ( ctx , config ) ; } }
Export a context into the given configuration
20,846
protected T getRowObject ( int rowIndex ) { int pageIndex = rowIndex - dataOffset ; if ( pageIndex >= 0 && pageIndex < data . size ( ) ) { return data . get ( pageIndex ) ; } return null ; }
Gets the object at the given row .
20,847
private void notifyPostResourceFound ( HttpMessage message , int depth , String url , String requestBody ) { log . debug ( "Submiting form with POST method and message body with form parameters (normal encoding): " + requestBody ) ; notifyListenersPostResourceFound ( message , depth + 1 , url , requestBody ) ; }
Notifies listeners that a new POST resource was found .
20,848
private PopupEncoder2Menu getPopupMenuEncode ( ) { if ( popupEncodeMenu == null ) { popupEncodeMenu = new PopupEncoder2Menu ( ) ; popupEncodeMenu . setText ( Constant . messages . getString ( "enc2.popup" ) ) ; popupEncodeMenu . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerform...
This method initializes popupEncodeMenu
20,849
protected JPanel getWorkPanel ( ) { if ( mainPanel == null ) { mainPanel = new JPanel ( new BorderLayout ( ) ) ; tabbedPane = new JTabbedPane ( ) ; tabbedPane . addTab ( Constant . messages . getString ( "spider.panel.tab.urls" ) , getUrlsTableScrollPane ( ) ) ; tabbedPane . addTab ( Constant . messages . getString ( "...
This method initializes the working Panel .
20,850
private JXTable getUrlsTable ( ) { if ( urlsTable == null ) { urlsTable = new ZapTable ( EMPTY_URLS_TABLE_MODEL ) ; urlsTable . setColumnSelectionAllowed ( false ) ; urlsTable . setCellSelectionEnabled ( false ) ; urlsTable . setRowSelectionAllowed ( true ) ; urlsTable . setAutoCreateRowSorter ( true ) ; urlsTable . se...
Gets the scan results table .
20,851
private JLabel getFoundCountNameLabel ( ) { if ( foundCountNameLabel == null ) { foundCountNameLabel = new JLabel ( ) ; foundCountNameLabel . setText ( Constant . messages . getString ( "spider.toolbar.found.label" ) ) ; } return foundCountNameLabel ; }
Gets the label storing the name of the count of found URIs .
20,852
private JLabel getFoundCountValueLabel ( ) { if ( foundCountValueLabel == null ) { foundCountValueLabel = new JLabel ( ) ; foundCountValueLabel . setText ( ZERO_REQUESTS_LABEL_TEXT ) ; } return foundCountValueLabel ; }
Gets the label storing the value for count of found URIs .
20,853
private JLabel getAddedCountNameLabel ( ) { if ( addedCountNameLabel == null ) { addedCountNameLabel = new JLabel ( ) ; addedCountNameLabel . setText ( Constant . messages . getString ( "spider.toolbar.added.label" ) ) ; } return addedCountNameLabel ; }
Gets the label storing the name of the count of added URIs .
20,854
private JLabel getAddedCountValueLabel ( ) { if ( addedCountValueLabel == null ) { addedCountValueLabel = new JLabel ( ) ; addedCountValueLabel . setText ( ZERO_REQUESTS_LABEL_TEXT ) ; } return addedCountValueLabel ; }
Gets the label storing the value for count of added URIs .
20,855
protected void updateFoundCount ( ) { SpiderScan sc = this . getSelectedScanner ( ) ; if ( sc != null ) { this . getFoundCountValueLabel ( ) . setText ( Integer . toString ( sc . getNumberOfURIsFound ( ) ) ) ; } else { this . getFoundCountValueLabel ( ) . setText ( ZERO_REQUESTS_LABEL_TEXT ) ; } }
Update the count of found URIs .
20,856
protected void updateAddedCount ( ) { SpiderScan sc = this . getSelectedScanner ( ) ; if ( sc != null ) { this . getAddedCountValueLabel ( ) . setText ( Integer . toString ( sc . getNumberOfNodesAdded ( ) ) ) ; } else { this . getAddedCountValueLabel ( ) . setText ( ZERO_REQUESTS_LABEL_TEXT ) ; } }
Update the count of added nodes .
20,857
private void initialize ( ) { this . setLayout ( new CardLayout ( ) ) ; this . setName ( Constant . messages . getString ( "variant.options.title" ) ) ; this . add ( getPanelScanner ( ) , getPanelScanner ( ) . getName ( ) ) ; }
This method initializes the Panel
20,858
public void saveParam ( ScannerParam param ) { int targets = 0 ; if ( this . getChkInjectableQueryString ( ) . isSelected ( ) ) { targets |= ScannerParam . TARGET_QUERYSTRING ; } param . setAddQueryParam ( getChkAddQueryParam ( ) . isSelected ( ) ) ; if ( this . getChkInjectableUrlPath ( ) . isSelected ( ) ) { targets ...
Saves the options shown in the panel to the given options object .
20,859
public void setAllInjectableAndRPC ( boolean enabled ) { this . getChkInjectableQueryString ( ) . setEnabled ( enabled ) ; this . getChkAddQueryParam ( ) . setEnabled ( enabled && getChkInjectableQueryString ( ) . isSelected ( ) ) ; this . getChkInjectableUrlPath ( ) . setEnabled ( enabled ) ; this . getChkInjectablePo...
Set all checkbox to a specific value
20,860
public void setReasonVariantsDisabled ( String reason ) { reasonVariantsDisabled = Objects . requireNonNull ( reason ) ; labelReasonVariantsDisabled . setText ( reasonVariantsDisabled ) ; if ( reasonVariantsDisabled . isEmpty ( ) && labelReasonVariantsDisabled . isVisible ( ) ) { labelReasonVariantsDisabled . setVisibl...
Sets the reason to show when the the variants are disabled .
20,861
public ApiResponse handleApiView ( String name , JSONObject params ) throws ApiException { throw new ApiException ( ApiException . Type . BAD_VIEW , name ) ; }
Override if implementing one or more views
20,862
public ApiResponse handleApiAction ( String name , JSONObject params ) throws ApiException { throw new ApiException ( ApiException . Type . BAD_ACTION , name ) ; }
Override if implementing one or more actions
20,863
public HttpMessage handleApiOther ( HttpMessage msg , String name , JSONObject params ) throws ApiException { throw new ApiException ( ApiException . Type . BAD_OTHER , name ) ; }
Override if implementing one or more other operations - these are operations that _dont_ return structured data
20,864
public void handleApiPersistentConnection ( HttpMessage msg , HttpInputStream httpIn , HttpOutputStream httpOut , String name , JSONObject params ) throws ApiException { throw new ApiException ( ApiException . Type . BAD_PCONN , name ) ; }
Override if implementing one or more persistent connection operations . These are operations that maintain long running connections potentially staying alive as long as the client holds them open .
20,865
public String handleCallBack ( HttpMessage msg ) throws ApiException { throw new ApiException ( ApiException . Type . URL_NOT_FOUND , msg . getRequestHeader ( ) . getURI ( ) . toString ( ) ) ; }
Override if handling callbacks
20,866
protected void notifyListenersResourceFound ( HttpMessage message , int depth , String uri ) { for ( SpiderParserListener l : listeners ) { l . resourceURIFound ( message , depth , uri ) ; } }
Notify the listeners that a resource was found .
20,867
protected void processURL ( HttpMessage message , int depth , String localURL , String baseURL ) { String fullURL = URLCanonicalizer . getCanonicalURL ( localURL , baseURL ) ; if ( fullURL == null ) { return ; } log . debug ( "Canonical URL constructed using '" + localURL + "': " + fullURL ) ; notifyListenersResourceFo...
Builds an url and notifies the listeners .
20,868
public Component getTreeCellRendererComponent ( JTree tree , Object value , boolean sel , boolean expanded , boolean leaf , int row , boolean hasFocus ) { super . getTreeCellRendererComponent ( tree , value , sel , expanded , leaf , row , hasFocus ) ; if ( value instanceof AlertNode ) { AlertNode alertNode = ( AlertNod...
Sets the relevant tree icons .
20,869
public static HttpSession getMatchingHttpSession ( final Collection < HttpSession > sessions , List < HttpCookie > cookies , final HttpSessionTokensSet siteTokens ) { if ( sessions . isEmpty ( ) ) { return null ; } List < HttpSession > matchingSessions = new LinkedList < > ( sessions ) ; for ( String token : siteTokens...
Gets the matching http session if any for a particular message containing a list of cookies from a set of sessions .
20,870
protected String getEscapedValue ( HttpMessage msg , String value ) { return ( value != null ) ? AbstractPlugin . getURLEncode ( value ) : "" ; }
Encode the parameter for a correct URL introduction
20,871
private void writeOutArgs ( List < String > elements , Writer out , boolean hasParams ) throws IOException { if ( elements != null && elements . size ( ) > 0 ) { ArrayList < String > args = new ArrayList < String > ( ) ; for ( String param : elements ) { if ( param . equalsIgnoreCase ( "boolean" ) ) { args . add ( "boo...
Writes the function arguments
20,872
private void writeOutRequestParams ( List < String > elements , Writer out ) throws IOException { if ( elements != null && elements . size ( ) > 0 ) { for ( String param : elements ) { out . write ( "\n\t\t\"" + param + "\": " ) ; if ( param . equalsIgnoreCase ( "boolean" ) ) { addImports = true ; out . write ( "strcon...
Writes the request parameters
20,873
private static void addImports ( Path file , boolean addImports ) throws IOException { Charset charset = StandardCharsets . UTF_8 ; String content = new String ( Files . readAllBytes ( file ) , charset ) ; if ( addImports ) { content = content . replaceAll ( "_imports_" , "import \"strconv\"\n\n" ) ; } else { content =...
or removes it in case there isn t any packages to import
20,874
public List < ImageIcon > getCustomIcons ( ) { List < ImageIcon > iconList = new ArrayList < ImageIcon > ( ) ; if ( justSpidered ) { iconList . add ( new ImageIcon ( Constant . class . getResource ( "/resource/icon/10/spider.png" ) ) ) ; } synchronized ( this . icons ) { if ( ! this . icons . isEmpty ( ) ) { for ( Iter...
Gets any custom icons that have been set for this node
20,875
public void setHistoryReference ( HistoryReference historyReference ) { if ( getHistoryReference ( ) != null ) { if ( this . justSpidered && ( historyReference . getHistoryType ( ) == HistoryReference . TYPE_PROXIED || historyReference . getHistoryType ( ) == HistoryReference . TYPE_ZAP_USER ) ) { this . justSpidered =...
Set current node reference . If there is any existing reference delete if spider record . Otherwise put into past history list .
20,876
public void deleteAllAlerts ( ) { for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { ( ( SiteNode ) getChildAt ( i ) ) . deleteAllAlerts ( ) ; } if ( ! alerts . isEmpty ( ) ) { alerts . clear ( ) ; highestAlert = null ; calculateHighestAlert = false ; if ( this . siteMap != null ) { siteMap . applyFilter ( this ) ; } n...
Deletes all alerts of this node and all child nodes recursively .
20,877
public HttpMessage getHttpMessage ( ) throws HttpMalformedHeaderException , DatabaseException { if ( httpMessage != null ) { return httpMessage ; } RecordHistory history = staticTableHistory . read ( historyId ) ; if ( history == null ) { throw new HttpMalformedHeaderException ( "No history reference for id " + history...
Gets the corresponding http message from the database . Try to minimise calls to this method as much as possible . But also dont cache the HttpMessage either as this can significantly increase ZAP s memory usage .
20,878
public void setTags ( List < String > tags ) { if ( tags == null ) { throw new IllegalArgumentException ( "Parameter tags must not be null." ) ; } for ( String tag : tags ) { if ( ! this . tags . contains ( tag ) ) { insertTagDb ( tag ) ; } } for ( String tag : this . tags ) { if ( ! tags . contains ( tag ) ) { deleteT...
Sets the tags for the HTTP message .
20,879
public static List < String > getTags ( int historyId ) throws DatabaseException { if ( staticTableTag == null ) { return new ArrayList < > ( ) ; } List < String > tags = new ArrayList < > ( ) ; List < RecordTag > rtags = staticTableTag . getTagsForHistoryID ( historyId ) ; for ( RecordTag rtag : rtags ) { tags . add (...
Gets the tags of the message with the given history ID .
20,880
protected static char [ ] encode ( String original , BitSet allowed , String charset ) throws URIException { if ( original == null ) { throw new IllegalArgumentException ( "Original string may not be null" ) ; } if ( allowed == null ) { throw new IllegalArgumentException ( "Allowed bitset may not be null" ) ; } byte [ ...
Encodes URI string .
20,881
protected boolean prevalidate ( String component , BitSet disallowed ) { if ( component == null ) { return false ; } char [ ] target = component . toCharArray ( ) ; for ( int i = 0 ; i < target . length ; i ++ ) { if ( disallowed . get ( target [ i ] ) ) { return false ; } } return true ; }
Pre - validate the unescaped URI string within a specific component .
20,882
protected int indexFirstOf ( char [ ] s , char delim , int offset ) { if ( s == null || s . length == 0 ) { return - 1 ; } if ( offset < 0 ) { offset = 0 ; } else if ( offset > s . length ) { return - 1 ; } for ( int i = offset ; i < s . length ; i ++ ) { if ( s [ i ] == delim ) { return i ; } } return - 1 ; }
Get the earlier index that to be searched for the first occurrance in one of any of the given array .
20,883
protected void parseAuthority ( String original , boolean escaped ) throws URIException { _is_reg_name = _is_server = _is_hostname = _is_IPv4address = _is_IPv6reference = false ; String charset = getProtocolCharset ( ) ; boolean hasPort = true ; int from = 0 ; int next = original . indexOf ( '@' ) ; if ( next != - 1 ) ...
Parse the authority component .
20,884
protected void setURI ( ) { StringBuffer buf = new StringBuffer ( ) ; if ( _scheme != null ) { buf . append ( _scheme ) ; buf . append ( ':' ) ; } if ( _is_net_path ) { buf . append ( "//" ) ; if ( _authority != null ) { buf . append ( _authority ) ; } } if ( _opaque != null && _is_opaque_part ) { buf . append ( _opaqu...
Once it s parsed successfully set this URI .
20,885
public void setRawPath ( char [ ] escapedPath ) throws URIException { if ( escapedPath == null || escapedPath . length == 0 ) { _path = _opaque = escapedPath ; setURI ( ) ; return ; } escapedPath = removeFragmentIdentifier ( escapedPath ) ; if ( _is_net_path || _is_abs_path ) { if ( escapedPath [ 0 ] != '/' ) { throw n...
Set the raw - escaped path .
20,886
public void setEscapedPath ( String escapedPath ) throws URIException { if ( escapedPath == null ) { _path = _opaque = null ; setURI ( ) ; return ; } setRawPath ( escapedPath . toCharArray ( ) ) ; }
Set the escaped path .
20,887
public void setPath ( String path ) throws URIException { if ( path == null || path . length ( ) == 0 ) { _path = _opaque = ( path == null ) ? null : path . toCharArray ( ) ; setURI ( ) ; return ; } String charset = getProtocolCharset ( ) ; if ( _is_net_path || _is_abs_path ) { _path = encode ( path , allowed_abs_path ...
Set the path .
20,888
protected char [ ] resolvePath ( char [ ] basePath , char [ ] relPath ) throws URIException { String base = ( basePath == null ) ? "" : new String ( basePath ) ; if ( relPath == null || relPath . length == 0 ) { return normalize ( basePath ) ; } else if ( relPath [ 0 ] == '/' ) { return normalize ( relPath ) ; } else {...
Resolve the base and relative path .
20,889
public String getEscapedCurrentHierPath ( ) throws URIException { char [ ] path = getRawCurrentHierPath ( ) ; return ( path == null ) ? null : new String ( path ) ; }
Get the escaped current hierarchy level .
20,890
public String getCurrentHierPath ( ) throws URIException { char [ ] path = getRawCurrentHierPath ( ) ; return ( path == null ) ? null : decode ( path , getProtocolCharset ( ) ) ; }
Get the current hierarchy level .
20,891
public char [ ] getRawName ( ) { if ( _path == null ) { return null ; } int at = 0 ; for ( int i = _path . length - 1 ; i >= 0 ; i -- ) { if ( _path [ i ] == '/' ) { at = i + 1 ; break ; } } int len = _path . length - at ; char [ ] basename = new char [ len ] ; System . arraycopy ( _path , at , basename , 0 , len ) ; r...
Get the raw - escaped basename of the path .
20,892
public String getName ( ) throws URIException { char [ ] basename = getRawName ( ) ; return ( basename == null ) ? null : decode ( getRawName ( ) , getProtocolCharset ( ) ) ; }
Get the basename of the path .
20,893
public char [ ] getRawPathQuery ( ) { if ( _path == null && _query == null ) { return null ; } StringBuffer buff = new StringBuffer ( ) ; if ( _path != null ) { buff . append ( _path ) ; } if ( _query != null ) { buff . append ( '?' ) ; buff . append ( _query ) ; } return buff . toString ( ) . toCharArray ( ) ; }
Get the raw - escaped path and query .
20,894
public String getPathQuery ( ) throws URIException { char [ ] rawPathQuery = getRawPathQuery ( ) ; return ( rawPathQuery == null ) ? null : decode ( rawPathQuery , getProtocolCharset ( ) ) ; }
Get the path and query .
20,895
public void setRawQuery ( char [ ] escapedQuery ) throws URIException { if ( escapedQuery == null || escapedQuery . length == 0 ) { _query = escapedQuery ; setURI ( ) ; return ; } escapedQuery = removeFragmentIdentifier ( escapedQuery ) ; if ( ! validate ( escapedQuery , query ) ) { throw new URIException ( URIExceptio...
Set the raw - escaped query .
20,896
public void setEscapedQuery ( String escapedQuery ) throws URIException { if ( escapedQuery == null ) { _query = null ; setURI ( ) ; return ; } setRawQuery ( escapedQuery . toCharArray ( ) ) ; }
Set the escaped query string .
20,897
public void setRawFragment ( char [ ] escapedFragment ) throws URIException { if ( escapedFragment == null || escapedFragment . length == 0 ) { _fragment = escapedFragment ; hash = 0 ; return ; } if ( ! validate ( escapedFragment , fragment ) ) { throw new URIException ( URIException . ESCAPING , "escaped fragment not ...
Set the raw - escaped fragment .
20,898
public void setEscapedFragment ( String escapedFragment ) throws URIException { if ( escapedFragment == null ) { _fragment = null ; hash = 0 ; return ; } setRawFragment ( escapedFragment . toCharArray ( ) ) ; }
Set the escaped fragment string .
20,899
public void setFragment ( String fragment ) throws URIException { if ( fragment == null || fragment . length ( ) == 0 ) { _fragment = ( fragment == null ) ? null : fragment . toCharArray ( ) ; hash = 0 ; return ; } _fragment = encode ( fragment , allowed_fragment , getProtocolCharset ( ) ) ; hash = 0 ; }
Set the fragment .