idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
20,700 | private AbstractParamContainerPanel getJSplitPane ( ) { if ( jSplitPane == null ) { jSplitPane = new AbstractParamContainerPanel ( ) ; jSplitPane . setVisible ( true ) ; if ( this . rootName != null ) { jSplitPane . getRootNode ( ) . setUserObject ( rootName ) ; } } return jSplitPane ; } | This method initializes jSplitPane |
20,701 | public static List < ApiImplementor > getAllImplementors ( ) { List < ApiImplementor > imps = new ArrayList < > ( ) ; ApiImplementor api ; imps . add ( new AlertAPI ( null ) ) ; api = new AntiCsrfAPI ( null ) ; api . addApiOptions ( new AntiCsrfParam ( ) ) ; imps . add ( api ) ; imps . add ( new PassiveScanAPI ( null )... | Return all of the available ApiImplementors . If you implement a new ApiImplementor then you must add it to this class . |
20,702 | public String generateForm ( HttpMessage msg ) throws UnsupportedEncodingException { String requestUri = msg . getRequestHeader ( ) . getURI ( ) . toString ( ) ; StringBuilder sb = new StringBuilder ( 300 ) ; sb . append ( "<html>\n" ) ; sb . append ( "<body>\n" ) ; sb . append ( "<h3>" ) ; sb . append ( requestUri ) ;... | Generates a HTML form from the given message . |
20,703 | private void zzScanError ( int errorCode ) { String message ; try { message = ZZ_ERROR_MSG [ errorCode ] ; } catch ( ArrayIndexOutOfBoundsException e ) { message = ZZ_ERROR_MSG [ ZZ_UNKNOWN_ERROR ] ; } throw new Error ( message ) ; } | Reports an error that occured while scanning . |
20,704 | public void addProxyServer ( ProxyServer proxyServer ) { proxyServers . add ( proxyServer ) ; extensionHooks . values ( ) . forEach ( extHook -> hookProxyServer ( extHook , proxyServer ) ) ; } | Adds the given proxy server to be automatically updated with proxy related listeners . |
20,705 | public void removeProxyServer ( ProxyServer proxyServer ) { proxyServers . remove ( proxyServer ) ; extensionHooks . values ( ) . forEach ( extHook -> unhookProxyServer ( extHook , proxyServer ) ) ; } | Removes the given proxy server . |
20,706 | public void startLifeCycle ( Extension ext ) throws DatabaseException , DatabaseUnsupportedException { ext . init ( ) ; ext . databaseOpen ( model . getDb ( ) ) ; ext . initModel ( model ) ; ext . initXML ( model . getSession ( ) , model . getOptionsParam ( ) ) ; ext . initView ( view ) ; ExtensionHook extHook = new Ex... | Initialize a specific Extension |
20,707 | public void hookCommandLineListener ( CommandLine cmdLine ) throws Exception { List < CommandLineArgument [ ] > allCommandLineList = new ArrayList < > ( ) ; Map < String , CommandLineListener > extMap = new HashMap < > ( ) ; for ( Map . Entry < Extension , ExtensionHook > entry : extensionHooks . entrySet ( ) ) { Exten... | Hook command line listener with the command line processor |
20,708 | private void initAllExtension ( double progressFactor ) { double factorPerc = progressFactor / getExtensionCount ( ) ; for ( int i = 0 ; i < getExtensionCount ( ) ; i ++ ) { Extension extension = getExtension ( i ) ; try { extension . init ( ) ; extension . databaseOpen ( Model . getSingleton ( ) . getDb ( ) ) ; if ( v... | Init all extensions |
20,709 | private void initModelAllExtension ( Model model , double progressFactor ) { double factorPerc = progressFactor / getExtensionCount ( ) ; for ( int i = 0 ; i < getExtensionCount ( ) ; i ++ ) { Extension extension = getExtension ( i ) ; try { extension . initModel ( model ) ; if ( view != null ) { view . addSplashScreen... | Init all extensions with the same Model |
20,710 | private void initViewAllExtension ( final View view , double progressFactor ) { if ( view == null ) { return ; } final double factorPerc = progressFactor / getExtensionCount ( ) ; for ( int i = 0 ; i < getExtensionCount ( ) ; i ++ ) { final Extension extension = getExtension ( i ) ; try { EventQueue . invokeAndWait ( n... | Init all extensions with the same View |
20,711 | public List < String > getUnsavedResources ( ) { List < String > list = new ArrayList < > ( ) ; List < String > l ; for ( int i = 0 ; i < getExtensionCount ( ) ; i ++ ) { l = getExtension ( i ) . getUnsavedResources ( ) ; if ( l != null ) { list . addAll ( l ) ; } } return list ; } | Gets the names of all unsaved resources of all the extensions . |
20,712 | private int addScriptsFromDir ( File dir , ScriptType type , String targetEngineName ) { int addedScripts = 0 ; File typeDir = new File ( dir , type . getName ( ) ) ; if ( typeDir . exists ( ) ) { for ( File f : typeDir . listFiles ( ) ) { String ext = f . getName ( ) . substring ( f . getName ( ) . lastIndexOf ( "." )... | Adds the scripts from the given directory of the given script type and optionally for the engine with the given name . |
20,713 | private static boolean isSavedInDir ( ScriptWrapper scriptWrapper , File directory ) { File file = scriptWrapper . getFile ( ) ; if ( file == null ) { return false ; } return file . getParentFile ( ) . equals ( directory ) ; } | Tells whether or not the given script is saved in the given directory . |
20,714 | public int getScriptCount ( File dir ) { int scripts = 0 ; for ( ScriptType type : this . getScriptTypes ( ) ) { File locDir = new File ( dir , type . getName ( ) ) ; if ( locDir . exists ( ) ) { for ( File f : locDir . listFiles ( ) ) { String ext = f . getName ( ) . substring ( f . getName ( ) . lastIndexOf ( "." ) +... | Gets the numbers of scripts for the given directory for the currently registered script engines and types . |
20,715 | public ScriptWrapper loadScript ( ScriptWrapper script , Charset charset ) throws IOException { if ( script == null ) { throw new IllegalArgumentException ( "Parameter script must not be null." ) ; } if ( charset == null ) { throw new IllegalArgumentException ( "Parameter charset must not be null." ) ; } script . loadS... | Loads the script from the file using the given charset . |
20,716 | public boolean isAllowed ( String classname ) { Objects . requireNonNull ( classname ) ; if ( ! restrictedClassnames . isEmpty ( ) ) { for ( String restrictedClassname : restrictedClassnames ) { if ( classname . startsWith ( restrictedClassname ) ) { return false ; } } } if ( ! allowedClassnames . isEmpty ( ) ) { for (... | Tells whether or not the given classname is allowed thus can be loaded . |
20,717 | private String getEscapedValue ( String value ) { if ( value != null ) { try { return URLEncoder . encode ( value , "UTF-8" ) ; } catch ( UnsupportedEncodingException ex ) { } } return "" ; } | Encode the parameter value for a correct URL introduction |
20,718 | public static String entityEncode ( String text ) { String result = text ; if ( result == null ) { return result ; } return StringEscapeUtils . escapeXml10 ( XMLStringUtil . escapeControlChrs ( result ) ) ; } | Encode entity for HTML or XML output . |
20,719 | static void init ( boolean includeAddOns ) { loadedPlugins = new ArrayList < > ( CoreFunctionality . getBuiltInActiveScanRules ( ) ) ; if ( includeAddOns ) { loadedPlugins . addAll ( ExtensionFactory . getAddOnLoader ( ) . getActiveScanRules ( ) ) ; } Collections . sort ( loadedPlugins , riskComparator ) ; mapLoadedPlu... | Helper method to ease tests . |
20,720 | private Plugin probeNextPlugin ( ) { Plugin plugin = null ; int i = 0 ; while ( i < listPending . size ( ) ) { plugin = listPending . get ( i ) ; if ( isAllDependencyCompleted ( plugin ) ) { return plugin ; } i ++ ; } return null ; } | Get next test ready to be run . Null = none . Test dependendent on others will not be obtained . |
20,721 | synchronized Plugin nextPlugin ( ) { if ( ! init ) { this . reset ( ) ; } Plugin plugin = probeNextPlugin ( ) ; if ( plugin == null ) { return null ; } listPending . remove ( plugin ) ; plugin . setTimeStarted ( ) ; listRunning . add ( plugin ) ; return plugin ; } | Get next plugin ready to be run without any dependency outstanding . |
20,722 | private void saveToContext ( Context context , boolean updateSiteStructure ) { ParameterParser urlParamParser = context . getUrlParamParser ( ) ; ParameterParser formParamParser = context . getPostParamParser ( ) ; List < String > structParams = new ArrayList < String > ( ) ; List < StructuralNodeModifier > ddns = new ... | Save the data from this panel to the provided context . |
20,723 | protected ExtensionHttpSessions getExtensionHttpSessions ( ) { if ( extensionHttpSessions == null ) { extensionHttpSessions = Control . getSingleton ( ) . getExtensionLoader ( ) . getExtension ( ExtensionHttpSessions . class ) ; } return extensionHttpSessions ; } | Gets the ExtensionHttpSessions if it s enabled |
20,724 | private void runScan ( ) { spiderDone = 0 ; Date start = new Date ( ) ; log . info ( "Starting spidering scan on " + site + " at " + start ) ; startSpider ( ) ; this . isAlive = true ; } | Runs the scan . |
20,725 | private void startSpider ( ) { spider = new Spider ( id , extension , spiderParams , extension . getModel ( ) . getOptionsParam ( ) . getConnectionParam ( ) , extension . getModel ( ) , this . scanContext ) ; spider . addSpiderListener ( this ) ; for ( SpiderListener l : pendingSpiderListeners ) { spider . addSpiderLis... | Start spider . |
20,726 | private void addSeed ( SiteNode node ) { try { if ( ! node . isRoot ( ) && node . getHistoryReference ( ) != null ) { HttpMessage msg = node . getHistoryReference ( ) . getHttpMessage ( ) ; if ( ! msg . getResponseHeader ( ) . isImage ( ) ) { spider . addSeed ( msg ) ; } } } catch ( Exception e ) { log . error ( "Error... | Adds the given node as seed if the corresponding message is not an image . |
20,727 | private void addMessageToSitesTree ( final HistoryReference historyReference , final HttpMessage message ) { if ( View . isInitialised ( ) && ! EventQueue . isDispatchThread ( ) ) { EventQueue . invokeLater ( new Runnable ( ) { public void run ( ) { addMessageToSitesTree ( historyReference , message ) ; } } ) ; return ... | Adds the given message to the sites tree . |
20,728 | public void addSpiderListener ( SpiderListener listener ) { if ( spider != null ) { this . spider . addSpiderListener ( listener ) ; } else { this . pendingSpiderListeners . add ( listener ) ; } } | Adds a new spider listener . |
20,729 | private PopupContextMenuItemFactory getPopupFlagLoggedInIndicatorMenu ( ) { if ( this . popupFlagLoggedInIndicatorMenuFactory == null ) { popupFlagLoggedInIndicatorMenuFactory = new PopupContextMenuItemFactory ( "dd - " + Constant . messages . getString ( "context.flag.popup" ) ) { private static final long serialVersi... | Gets the popup menu for flagging the Logged in pattern . |
20,730 | private PopupContextMenuItemFactory getPopupFlagLoggedOutIndicatorMenu ( ) { if ( this . popupFlagLoggedOutIndicatorMenuFactory == null ) { popupFlagLoggedOutIndicatorMenuFactory = new PopupContextMenuItemFactory ( "dd - " + Constant . messages . getString ( "context.flag.popup" ) ) { private static final long serialVe... | Gets the popup menu for flagging the Logged out pattern . |
20,731 | private void loadAuthenticationMethodTypes ( ExtensionHook hook ) { this . authenticationMethodTypes = new ArrayList < > ( ) ; this . authenticationMethodTypes . add ( new FormBasedAuthenticationMethodType ( ) ) ; this . authenticationMethodTypes . add ( new HttpAuthenticationMethodType ( ) ) ; this . authenticationMet... | Loads the authentication method types and hooks them up . |
20,732 | public AuthenticationMethodType getAuthenticationMethodTypeForIdentifier ( int id ) { for ( AuthenticationMethodType t : getAuthenticationMethodTypes ( ) ) if ( t . getUniqueIdentifier ( ) == id ) return t ; return null ; } | Gets the authentication method type for a given identifier . |
20,733 | public URI getLoginRequestURIForContext ( Context ctx ) { if ( ! ( ctx . getAuthenticationMethod ( ) instanceof FormBasedAuthenticationMethod ) ) return null ; FormBasedAuthenticationMethod method = ( FormBasedAuthenticationMethod ) ctx . getAuthenticationMethod ( ) ; try { return new URI ( method . getLoginRequestURL ... | Gets the URI for the login request that corresponds to a given context if any . |
20,734 | public static String getLocalDisplayName ( String locale ) { String desc = "" + locale ; if ( locale != null ) { String [ ] langArray = locale . split ( "_" ) ; Locale loc = null ; if ( langArray . length == 1 ) { loc = new Locale ( langArray [ 0 ] ) ; } else if ( langArray . length == 2 ) { loc = new Locale ( langArra... | Gets the name of the language of and for the given locale . |
20,735 | public void setScanFuzzerMessages ( boolean scanFuzzerMessages ) { this . scanFuzzerMessages = scanFuzzerMessages ; getConfig ( ) . setProperty ( SCAN_FUZZER_MESSAGES_KEY , scanFuzzerMessages ) ; setFuzzerOptin ( scanFuzzerMessages ) ; } | Sets whether or not the passive scan should be performed on traffic from the fuzzer . |
20,736 | public void addHttpSession ( HttpSession session ) { synchronized ( this . sessions ) { this . sessions . add ( session ) ; } this . model . addHttpSession ( session ) ; } | Adds a new http session to this site . |
20,737 | public void removeHttpSession ( HttpSession session ) { if ( session == activeSession ) { activeSession = null ; } synchronized ( this . sessions ) { this . sessions . remove ( session ) ; } this . model . removeHttpSession ( session ) ; session . invalidate ( ) ; } | Removes an existing session . |
20,738 | public void setActiveSession ( HttpSession activeSession ) { if ( log . isInfoEnabled ( ) ) { log . info ( "Setting new active session for site '" + site + "': " + activeSession ) ; } if ( activeSession == null ) { throw new IllegalArgumentException ( "When settting an active session, a non-null session has to be provi... | Sets the active session . |
20,739 | public void unsetActiveSession ( ) { if ( log . isInfoEnabled ( ) ) { log . info ( "Setting no active session for site '" + site + "'." ) ; } if ( this . activeSession != null ) { this . activeSession . setActive ( false ) ; if ( this . activeSession . getTokenValuesCount ( ) == 0 ) { this . removeHttpSession ( this . ... | Unset any active session for this site . |
20,740 | public void processHttpRequestMessage ( HttpMessage message ) { HttpSessionTokensSet siteTokensSet = extension . getHttpSessionTokensSet ( getSite ( ) ) ; if ( siteTokensSet == null ) { log . debug ( "No session tokens for: " + this . getSite ( ) ) ; return ; } List < HttpCookie > requestCookies = message . getRequestH... | Process the http request message before being sent . |
20,741 | private HttpSession getMatchingHttpSession ( List < HttpCookie > cookies , final HttpSessionTokensSet siteTokens ) { Collection < HttpSession > sessionsCopy ; synchronized ( sessions ) { sessionsCopy = new ArrayList < > ( sessions ) ; } return CookieBasedSessionManagementHelper . getMatchingHttpSession ( sessionsCopy ,... | Gets the matching http session for a particular message containing a list of cookies . |
20,742 | protected void cleanupSessionToken ( String token ) { if ( sessions . isEmpty ( ) ) { return ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Removing duplicates and cleaning up sessions for site - token: " + site + " - " + token ) ; } synchronized ( this . sessions ) { HttpSessionTokensSet siteTokensSet = extensio... | Cleans up the sessions eliminating the given session token . |
20,743 | public boolean renameHttpSession ( String oldName , String newName ) { if ( newName == null || newName . isEmpty ( ) ) { log . warn ( "Trying to rename session from " + oldName + " illegal name: " + newName ) ; return false ; } HttpSession session = getHttpSession ( oldName ) ; if ( session == null ) { return false ; }... | Renames a http session making sure the new name is unique for the site . |
20,744 | private static int indexOf ( final String s , final char searchChar , final int beginIndex , final int endIndex ) { for ( int i = beginIndex ; i < endIndex ; i ++ ) { if ( s . charAt ( i ) == searchChar ) { return i ; } } return - 1 ; } | Returns the index within the specified string of the first occurrence of the specified search character . |
20,745 | void setExtensionsState ( Map < String , Boolean > extensionsState ) { if ( extensionsState == null ) { throw new IllegalArgumentException ( "Parameter extensionsState must not be null." ) ; } ( ( HierarchicalConfiguration ) getConfig ( ) ) . clearTree ( ALL_EXTENSIONS_KEY ) ; int enabledCount = 0 ; for ( Iterator < Ma... | Sets the extensions state to be saved in the configuration file . |
20,746 | public void centerFrame ( ) { final Dimension screenSize = Toolkit . getDefaultToolkit ( ) . getScreenSize ( ) ; final Dimension frameSize = this . getSize ( ) ; if ( frameSize . height > screenSize . height ) { frameSize . height = screenSize . height ; } if ( frameSize . width > screenSize . width ) { frameSize . wid... | Centre this frame . |
20,747 | private SimpleWindowState restoreWindowState ( ) { SimpleWindowState laststate = null ; final String statestr = preferences . get ( prefnzPrefix + PREF_WINDOW_STATE , null ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Restoring preference " + PREF_WINDOW_STATE + "=" + statestr ) ; if ( statestr != null ) { S... | Loads and sets the last window state of the frame . Additionally the last state will be returned . |
20,748 | private void saveWindowSize ( Dimension size ) { if ( size != null ) { if ( getExtendedState ( ) == Frame . NORMAL ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Saving preference " + PREF_WINDOW_SIZE + "=" + size . width + "," + size . height ) ; this . preferences . put ( prefnzPrefix + PREF_WINDOW_SIZE , s... | Saves the size of this frame but only if window state is normal . If window state is iconfied or maximized the size is not saved! |
20,749 | private Dimension restoreWindowSize ( ) { Dimension result = null ; final String sizestr = preferences . get ( prefnzPrefix + PREF_WINDOW_SIZE , null ) ; if ( sizestr != null ) { int width = 0 ; int height = 0 ; final String [ ] sizes = sizestr . split ( "[,]" ) ; try { width = Integer . parseInt ( sizes [ 0 ] . trim (... | Loads and set the saved size preferences for this frame . |
20,750 | private void saveWindowLocation ( Point point ) { if ( point != null ) { if ( getExtendedState ( ) == Frame . NORMAL ) { if ( logger . isDebugEnabled ( ) ) logger . debug ( "Saving preference " + PREF_WINDOW_POSITION + "=" + point . x + "," + point . y ) ; this . preferences . put ( prefnzPrefix + PREF_WINDOW_POSITION ... | Saves the location of this frame but only if window state is normal . If window state is iconfied or maximized the location is not saved! |
20,751 | private Point restoreWindowLocation ( ) { Point result = null ; final String sizestr = preferences . get ( prefnzPrefix + PREF_WINDOW_POSITION , null ) ; if ( sizestr != null ) { int x = 0 ; int y = 0 ; final String [ ] sizes = sizestr . split ( "[,]" ) ; try { x = Integer . parseInt ( sizes [ 0 ] . trim ( ) ) ; y = In... | Loads and set the saved position preferences for this frame . |
20,752 | public boolean includesAny ( Tech ... techs ) { if ( techs == null || techs . length == 0 ) { return false ; } for ( Tech tech : techs ) { if ( includes ( tech ) ) { return true ; } } return false ; } | Tells whether or not any of the given technologies is included . |
20,753 | public void print ( ) { System . out . println ( "TechSet: " + this . hashCode ( ) ) ; for ( Tech tech : includeTech ) { System . out . println ( "\tInclude: " + tech ) ; } for ( Tech tech : excludeTech ) { System . out . println ( "\tExclude: " + tech ) ; } } | Useful for debuging ; ) |
20,754 | public ImageIcon getIcon ( ) { if ( confidence == Alert . CONFIDENCE_FALSE_POSITIVE ) { return DisplayUtils . getScaledIcon ( Constant . OK_FLAG_IMAGE_URL ) ; } switch ( risk ) { case Alert . RISK_INFO : return DisplayUtils . getScaledIcon ( Constant . INFO_FLAG_IMAGE_URL ) ; case Alert . RISK_LOW : return DisplayUtils... | Gets the correctly scaled icon for this alert . |
20,755 | private boolean notifyListenerRequestSend ( HttpMessage httpMessage ) { ProxyListener listener = null ; List < ProxyListener > listenerList = parentServer . getListenerList ( ) ; for ( int i = 0 ; i < listenerList . size ( ) ; i ++ ) { listener = listenerList . get ( i ) ; try { if ( ! listener . onHttpRequestSend ( ht... | Go through each observers to process a request in each observers . The method can be modified in each observers . |
20,756 | public void setIncludeInContextRegexs ( List < String > includeRegexs ) { validateRegexs ( includeRegexs ) ; if ( includeInRegexs . size ( ) == includeRegexs . size ( ) ) { boolean changed = false ; for ( int i = 0 ; i < includeInRegexs . size ( ) ; i ++ ) { if ( ! includeInRegexs . get ( i ) . equals ( includeRegexs .... | Sets the regular expressions used to include a URL in context . |
20,757 | public void setExcludeFromContextRegexs ( List < String > excludeRegexs ) { validateRegexs ( excludeRegexs ) ; if ( excludeFromRegexs . size ( ) == excludeRegexs . size ( ) ) { boolean changed = false ; for ( int i = 0 ; i < excludeFromRegexs . size ( ) ; i ++ ) { if ( ! excludeFromRegexs . get ( i ) . equals ( exclude... | Sets the regular expressions used to exclude a URL from the context . |
20,758 | public void setName ( String name ) { if ( name == null || name . isEmpty ( ) ) { throw new IllegalContextNameException ( IllegalContextNameException . Reason . EMPTY_NAME , "The context name must not be null nor empty." ) ; } this . name = name ; } | Sets the name of the context . |
20,759 | private List < SiteNode > getChildren ( SiteNode siteNode ) { int childCount = siteNode . getChildCount ( ) ; if ( childCount == 0 ) { return Collections . emptyList ( ) ; } List < SiteNode > children = new ArrayList < > ( childCount ) ; for ( int i = 0 ; i < childCount ; i ++ ) { children . add ( ( SiteNode ) siteNode... | Gets the child nodes of the given site node . |
20,760 | public Context duplicate ( ) { Context newContext = new Context ( session , getIndex ( ) ) ; newContext . description = this . description ; newContext . name = this . name ; newContext . includeInRegexs = new ArrayList < > ( this . includeInRegexs ) ; newContext . includeInPatterns = new ArrayList < > ( this . include... | Creates a copy of the Context . The copy is deep with the exception of the TechSet . |
20,761 | private ZapMenuItem getMenuToolsFilter ( ) { if ( menuToolsFilter == null ) { menuToolsFilter = new ZapMenuItem ( "menu.tools.filter" ) ; menuToolsFilter . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent e ) { FilterDialog dialog = new Fil... | This method initializes menuToolsFilter |
20,762 | public void destroy ( ) { if ( timerFilterThread != null ) { timerFilterThread . setStopped ( ) ; timerFilterThread = null ; } Filter filter = null ; for ( int i = 0 ; i < filterFactory . getAllFilter ( ) . size ( ) ; i ++ ) { filter = filterFactory . getAllFilter ( ) . get ( i ) ; try { filter . destroy ( ) ; } catch ... | Destroy every filter during extension destroy . |
20,763 | static boolean canBeLoaded ( Map < Class < ? extends Extension > , Extension > extensions , Extension extension ) { return canBeLoaded ( extensions , extension , new ArrayList < > ( ) ) ; } | Relax visibility to ease the tests . |
20,764 | private javax . swing . JPanel getPanelCommand ( ) { if ( panelCommand == null ) { panelCommand = new javax . swing . JPanel ( ) ; panelCommand . setLayout ( new java . awt . GridBagLayout ( ) ) ; panelCommand . setName ( Constant . messages . getString ( "httpsessions.panel.title" ) ) ; GridBagConstraints toolbarGridB... | This method initializes the main panel . |
20,765 | private JButton getNewSessionButton ( ) { if ( newSessionButton == null ) { newSessionButton = new JButton ( ) ; newSessionButton . setText ( Constant . messages . getString ( "httpsessions.toolbar.newsession.label" ) ) ; newSessionButton . setIcon ( DisplayUtils . getScaledIcon ( new ImageIcon ( HttpSessionsPanel . cl... | Gets the new session button . |
20,766 | private javax . swing . JToolBar getPanelToolbar ( ) { if ( panelToolbar == null ) { panelToolbar = new javax . swing . JToolBar ( ) ; panelToolbar . setLayout ( new java . awt . GridBagLayout ( ) ) ; panelToolbar . setEnabled ( true ) ; panelToolbar . setFloatable ( false ) ; panelToolbar . setRollover ( true ) ; pane... | Gets the panel s toolbar . |
20,767 | private JScrollPane getWorkPane ( ) { if ( jScrollPane == null ) { jScrollPane = new JScrollPane ( ) ; jScrollPane . setViewportView ( getHttpSessionsTable ( ) ) ; } return jScrollPane ; } | Gets the work pane where data is shown . |
20,768 | private void setSessionsTableColumnSizes ( ) { sessionsTable . getColumnModel ( ) . getColumn ( 0 ) . setMinWidth ( 60 ) ; sessionsTable . getColumnModel ( ) . getColumn ( 0 ) . setPreferredWidth ( 60 ) ; sessionsTable . getColumnModel ( ) . getColumn ( 1 ) . setMinWidth ( 120 ) ; sessionsTable . getColumnModel ( ) . g... | Sets the sessions table column sizes . |
20,769 | private JXTable getHttpSessionsTable ( ) { if ( sessionsTable == null ) { sessionsTable = new JXTable ( sessionsModel ) ; sessionsTable . setColumnSelectionAllowed ( false ) ; sessionsTable . setCellSelectionEnabled ( false ) ; sessionsTable . setRowSelectionAllowed ( true ) ; sessionsTable . setAutoCreateRowSorter ( t... | Gets the http sessions table . |
20,770 | private JComboBox < String > getSiteSelect ( ) { if ( siteSelect == null ) { siteSelect = new JComboBox < > ( siteModel ) ; siteSelect . addItem ( Constant . messages . getString ( "httpsessions.toolbar.site.select" ) ) ; siteSelect . setSelectedIndex ( 0 ) ; siteSelect . addItemListener ( new ItemListener ( ) { public... | Gets the site select ComboBox . |
20,771 | private void siteSelected ( String site ) { if ( ! site . equals ( currentSite ) ) { this . sessionsModel = extension . getHttpSessionsSite ( site ) . getModel ( ) ; this . getHttpSessionsTable ( ) . setModel ( this . sessionsModel ) ; this . setSessionsTableColumnSizes ( ) ; currentSite = site ; } } | A new Site was selected . |
20,772 | public void nodeSelected ( SiteNode node ) { if ( node != null ) { siteModel . setSelectedItem ( ScanPanel . cleanSiteName ( node , true ) ) ; } } | Node selected . |
20,773 | public void reset ( ) { currentSite = null ; siteModel . removeAllElements ( ) ; siteModel . addElement ( Constant . messages . getString ( "httpsessions.toolbar.site.select" ) ) ; sessionsModel = new HttpSessionsTableModel ( null ) ; getHttpSessionsTable ( ) . setModel ( sessionsModel ) ; } | Reset the panel . |
20,774 | public HttpSession getSelectedSession ( ) { final int selectedRow = this . sessionsTable . getSelectedRow ( ) ; if ( selectedRow == - 1 ) { return null ; } final int rowIndex = sessionsTable . convertRowIndexToModel ( selectedRow ) ; return this . sessionsModel . getHttpSessionAt ( rowIndex ) ; } | Gets the selected http session . |
20,775 | public void setEnabled ( boolean enabled ) { if ( this . enabled != enabled ) { this . enabled = enabled ; setProperty ( "enabled" , Boolean . toString ( enabled ) ) ; if ( enabled && getAlertThreshold ( ) == AlertThreshold . OFF ) { setAlertThreshold ( AlertThreshold . DEFAULT ) ; } } } | Enable this test |
20,776 | public int compareTo ( Object obj ) { int result = - 1 ; if ( obj instanceof AbstractPlugin ) { AbstractPlugin test = ( AbstractPlugin ) obj ; if ( getId ( ) < test . getId ( ) ) { result = - 1 ; } else if ( getId ( ) > test . getId ( ) ) { result = 1 ; } else { result = 0 ; } } return result ; } | Compare if 2 plugin is the same . |
20,777 | protected boolean matchHeaderPattern ( HttpMessage msg , String header , Pattern pattern ) { if ( msg . getResponseHeader ( ) . isEmpty ( ) ) { return false ; } String val = msg . getResponseHeader ( ) . getHeader ( header ) ; if ( val == null ) { return false ; } Matcher matcher = pattern . matcher ( val ) ; return ma... | Check if the given pattern can be found in the header . |
20,778 | protected boolean matchBodyPattern ( HttpMessage msg , Pattern pattern , StringBuilder sb ) { Matcher matcher = pattern . matcher ( msg . getResponseBody ( ) . toString ( ) ) ; boolean result = matcher . find ( ) ; if ( result ) { if ( sb != null ) { sb . append ( matcher . group ( ) ) ; } } return result ; } | Check if the given pattern can be found in the msg body . If the supplied StringBuilder is not null append the result to the StringBuilder . |
20,779 | public void setHost ( String host ) throws IllegalStateException { if ( host == null ) { throw new IllegalArgumentException ( "host parameter is null" ) ; } assertNotOpen ( ) ; hostName = host ; } | Sets the host to connect to . |
20,780 | protected boolean isStale ( ) throws IOException { boolean isStale = true ; if ( isOpen ) { isStale = false ; try { if ( inputStream . available ( ) <= 0 ) { try { socket . setSoTimeout ( 1 ) ; inputStream . mark ( 1 ) ; int byteRead = inputStream . read ( ) ; if ( byteRead == - 1 ) { isStale = true ; } else { inputStr... | Determines whether this connection is stale which is to say that either it is no longer open or an attempt to read the connection would fail . |
20,781 | public void tunnelCreated ( ) throws IllegalStateException , IOException { LOG . trace ( "enter HttpConnection.tunnelCreated()" ) ; if ( ! isTunnelRequired ( ) ) { throw new IllegalStateException ( "Connection must be secure " + "and proxied or a tunnel requested to use this feature" ) ; } if ( usingSecureSocket ) { th... | Instructs the proxy to establish a secure tunnel to the host . The socket will be switched to the secure socket . Subsequent communication is done via the secure socket . The method can only be called once on a proxied secure connection . |
20,782 | public boolean isResponseAvailable ( int timeout ) throws IOException { LOG . trace ( "enter HttpConnection.isResponseAvailable(int)" ) ; if ( ! this . isOpen ) { return false ; } boolean result = false ; if ( this . inputStream . available ( ) > 0 ) { result = true ; } else { try { this . socket . setSoTimeout ( timeo... | Tests if input data becomes available within the given period time in milliseconds . |
20,783 | public void write ( byte [ ] data ) throws IOException , IllegalStateException { LOG . trace ( "enter HttpConnection.write(byte[])" ) ; this . write ( data , 0 , data . length ) ; } | Writes the specified bytes to the output stream . |
20,784 | public void releaseConnection ( ) { LOG . trace ( "enter HttpConnection.releaseConnection()" ) ; if ( locked ) { LOG . debug ( "Connection is locked. Call to releaseConnection() ignored." ) ; } else if ( httpConnectionManager != null ) { LOG . debug ( "Releasing connection back to connection manager." ) ; httpConnecti... | Releases the connection . If the connection is locked or does not have a connection manager associated with it this method has no effect . Note that it is completely safe to call this method multiple times . |
20,785 | protected void closeSocketAndStreams ( ) { LOG . trace ( "enter HttpConnection.closeSockedAndStreams()" ) ; isOpen = false ; lastResponseInputStream = null ; if ( null != outputStream ) { OutputStream temp = outputStream ; outputStream = null ; try { temp . close ( ) ; } catch ( Exception ex ) { LOG . debug ( "Exceptio... | Closes everything out . |
20,786 | private KeyPair createKeyPair ( ) throws NoSuchAlgorithmException { final KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "RSA" ) ; final SecureRandom random = SecureRandom . getInstance ( "SHA1PRNG" ) ; random . setSeed ( Long . toString ( System . currentTimeMillis ( ) ) . getBytes ( ) ) ; keyGen . initial... | Generates a 2048 bit RSA key pair using SHA1PRNG . |
20,787 | public void cleanExpiredCallbacks ( ) { long now = System . currentTimeMillis ( ) ; synchronized ( regCallbacks ) { Iterator < Map . Entry < String , RegisteredCallback > > it = regCallbacks . entrySet ( ) . iterator ( ) ; Map . Entry < String , RegisteredCallback > entry ; while ( it . hasNext ( ) ) { entry = it . nex... | Expire callbacks cleaning method . When called it remove from the received callbacks list all the sent challenge which haven t received any answer till now according to an expiring constraint . Currently the cleaning is done for every new inserting and every received callback but it can be done also with a scheduled cl... |
20,788 | public String getCallbackUrl ( String challenge ) { return "http://" + Model . getSingleton ( ) . getOptionsParam ( ) . getProxyParam ( ) . getProxyIp ( ) + ":" + Model . getSingleton ( ) . getOptionsParam ( ) . getProxyParam ( ) . getProxyPort ( ) + "/" + getPrefix ( ) + "/" + challenge ; } | Gets the ZAP API URL to a challenge endpoint . |
20,789 | public HttpMessage handleShortcut ( HttpMessage msg ) throws ApiException { try { String path = msg . getRequestHeader ( ) . getURI ( ) . getPath ( ) ; String challenge = path . substring ( path . indexOf ( getPrefix ( ) ) + getPrefix ( ) . length ( ) + 1 ) ; if ( challenge . charAt ( challenge . length ( ) - 1 ) == '/... | Handles the given message which might contain a challenge request . |
20,790 | public void registerCallback ( String challenge , ChallengeCallbackPlugin plugin , HttpMessage attack ) { cleanExpiredCallbacks ( ) ; regCallbacks . put ( challenge , new RegisteredCallback ( plugin , attack ) ) ; } | Registers a new ZAP API challenge . |
20,791 | public void setConfirmDropMessage ( boolean confirmDrop ) { if ( confirmDropMessage != confirmDrop ) { this . confirmDropMessage = confirmDrop ; getConfig ( ) . setProperty ( PARAM_CONFIRM_DROP_MESSAGE_KEY , confirmDrop ) ; } } | Sets whether the user should confirm the drop of the trapped message . |
20,792 | protected void notifyListenersDatabaseOpen ( Collection < DatabaseListener > listeners , DatabaseServer databaseServer ) throws DatabaseException { for ( DatabaseListener databaseListener : listeners ) { try { databaseListener . databaseOpen ( databaseServer ) ; } catch ( DatabaseUnsupportedException e ) { logger . err... | Notifies the given listeners that the given database server was opened . |
20,793 | public Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int rowIndex , int vColIndex ) { if ( isSelected ) { } if ( hasFocus ) { } JComponent result = label ; if ( ! value . toString ( ) . equals ( "" ) ) { result = button ; ( ( JButton ) button ) . setText... | using this renderer needs to be rendered . |
20,794 | public boolean isPermittedAddress ( String addr ) { if ( addr == null || addr . isEmpty ( ) ) { return false ; } for ( DomainMatcher permAddr : permittedAddressesEnabled ) { if ( permAddr . matches ( addr ) ) { return true ; } } return false ; } | Tells whether or not the given client address is allowed to access the API . |
20,795 | public void setPermittedAddresses ( List < DomainMatcher > addrs ) { if ( addrs == null || addrs . isEmpty ( ) ) { ( ( HierarchicalConfiguration ) getConfig ( ) ) . clearTree ( ADDRESS_KEY ) ; this . permittedAddresses = Collections . emptyList ( ) ; this . permittedAddressesEnabled = Collections . emptyList ( ) ; retu... | Sets the client addresses that will be allowed to access the API . |
20,796 | protected void pauseScan ( Context context ) { log . debug ( "Access Control pause on Context: " + context ) ; threadManager . getScannerThread ( context . getIndex ( ) ) . pauseScan ( ) ; } | Method called when the pause button is pressed . Base implementation forward the calls to the Scanner Thread that corresponds to the provided Context and obtained via the Thread Manager specified in the constructor . |
20,797 | protected void resumeScan ( Context context ) { log . debug ( "Access Control resume on Context: " + context ) ; threadManager . getScannerThread ( context . getIndex ( ) ) . resumeScan ( ) ; } | Method called when the resume button is pressed . Base implementation forward the calls to the Scanner Thread that corresponds to the provided Context and obtained via the Thread Manager specified in the constructor . |
20,798 | protected void stopScan ( Context context ) { log . debug ( "Access Control stop on Context: " + context ) ; threadManager . getScannerThread ( context . getIndex ( ) ) . stopScan ( ) ; } | Method called when the stop button is pressed . Base implementation forward the calls to the Scanner Thread that corresponds to the provided Context and obtained via the Thread Manager specified in the constructor . |
20,799 | private JTree getTreeParam ( ) { if ( treeParam == null ) { treeParam = new JTree ( ) ; treeParam . setModel ( getTreeModel ( ) ) ; treeParam . setShowsRootHandles ( true ) ; treeParam . setRootVisible ( true ) ; treeParam . addTreeSelectionListener ( new javax . swing . event . TreeSelectionListener ( ) { public void ... | This method initializes treeParam |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.