Package org.owasp.webscarab.model

Examples of org.owasp.webscarab.model.HttpUrl


    public void loadTemplateFromConversation(ConversationID id) {
        if (_model.isBusyFuzzing()) {
            stopFuzzing();
        }
        Request request = _framework.getModel().getRequest(id);
        HttpUrl url = request.getURL();
        if (url.getParameters()!=null)
            url = url.getParentUrl();
        _model.setFuzzMethod(request.getMethod());
        _model.setFuzzUrl(url.toString());
        _model.setFuzzVersion(request.getVersion());
        while(_model.getFuzzHeaderCount()>0) {
            _model.removeFuzzHeader(0);
        }
        while(_model.getFuzzParameterCount()>0) {
View Full Code Here


        }
        if (request == null) {
            _logger.severe("Asked to fetch a null request");
            return null;
        }
        HttpUrl url = request.getURL();
        if (url == null) {
            _logger.severe("Asked to fetch a request with a null URL");
            return null;
        }

        // if the previous auth method was not "Basic", force a new connection
        if (_authCreds != null && !_authCreds.startsWith("Basic"))
            _lastRequestTime = 0;
        if (_proxyAuthCreds != null && !_proxyAuthCreds.startsWith("Basic"))
            _lastRequestTime = 0;

        // Get any provided credentials from the request
        _authCreds = request.getHeader("Authorization");
        _proxyAuthCreds = request.getHeader("Proxy-Authorization");
        String keyFingerprint = request.getHeader("X-SSLClientCertificate");
        request.deleteHeader("X-SSLClientCertificate");
        if (keyFingerprint == null && _keyFingerprint == null) {
            // no problem
        } else if (keyFingerprint != null && _keyFingerprint != null && keyFingerprint.equals(_keyFingerprint)) {
            // no problem
        } else {
            // force a new connection, and change the fingerprint
            _keyFingerprint = keyFingerprint;
            _lastRequestTime = 0;
        }

        String status;

        String oldProxyAuthHeader = null;
        if (_proxyAuthCreds == null && _authenticator!= null && useProxy(url))
            _proxyAuthCreds = _authenticator.getProxyCredentials(url.toString().startsWith("https") ? _httpsProxy : _httpProxy, null);
        String proxyAuthHeader = constructAuthenticationHeader(null, _proxyAuthCreds);

        String oldAuthHeader = null;
        if (_authCreds == null && _authenticator!= null)
            _authCreds = _authenticator.getCredentials(url, null);
View Full Code Here

    }
   
    public Signature(String signature) throws MalformedURLException {
        String[] parts = signature.split(" ");
        _method = parts[0];
        _url = new HttpUrl(parts[1]);
        _contentType = parts[2].substring(1, parts[2].length()-1);
        if (_contentType.equals("null"))
            _contentType = null;
        List parameters = new ArrayList();
        for (int i=3; i<parts.length; i++) {
View Full Code Here

    }
    String[] listeners = value.trim().split(" *,+ *");

    String addr;
    int port = 0;
    HttpUrl base;
    boolean primary = false;

    for (int i = 0; i < listeners.length; i++) {
      addr = listeners[i].substring(0, listeners[i].indexOf(":"));
      try {
        port = Integer.parseInt(listeners[i].substring(
            listeners[i].indexOf(":") + 1).trim());
      } catch (NumberFormatException nfe) {
        System.err.println("Error parsing port for " + listeners[i]
            + ", skipping it!");
        continue;
      }
      prop = "Proxy.listener." + listeners[i] + ".base";
      value = Preferences.getPreference(prop, "");
      if (value.equals("")) {
        base = null;
      } else {
        try {
          base = new HttpUrl(value);
        } catch (MalformedURLException mue) {
          _logger.severe("Malformed 'base' parameter for listener '"
              + listeners[i] + "'");
          break;
        }
View Full Code Here

        return _model.getChildCount((HttpUrl) parent);
    }
   
    public boolean isLeaf(Object node) {
        if (node == getRoot()) return false;
        HttpUrl url = (HttpUrl) node;
        if (url.getParameters() != null) return true;
        if (url.getPath().endsWith("/")) return false;
        return getChildCount(url) == 0;
    }
View Full Code Here

   
    private class Listener implements UrlListener {
       
        public void urlAdded(final UrlEvent evt) {
            if (SwingUtilities.isEventDispatchThread()) {
                HttpUrl url = evt.getUrl();
                HttpUrl parent = url.getParentUrl();
                int index = getIndexOfChild(parent, url);
                fireChildAdded(urlTreePath(parent), index, url);
            } else {
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {
View Full Code Here

            }
        }
       
        public void urlChanged(final UrlEvent evt) {
            if (SwingUtilities.isEventDispatchThread()) {
                HttpUrl url = evt.getUrl();
                HttpUrl parent = url.getParentUrl();
                int index = getIndexOfChild(parent, url);
                fireChildChanged(urlTreePath(parent), index, url);
            } else {
                if (true) return;
                try {
View Full Code Here

            }
        }
       
        public void urlRemoved(final UrlEvent evt) {
            if (SwingUtilities.isEventDispatchThread()) {
                HttpUrl url = evt.getUrl();
                HttpUrl parent = url.getParentUrl();
                int pos = 0;
                int count = getChildCount(parent);
                for (int i=0; i<count; i++) {
                    HttpUrl sibling = (HttpUrl) getChild(parent, i);
                    if (url.compareTo(sibling)<0) {
                        break;
                    } else {
                        pos++;
                    }
View Full Code Here

        }
        if (links.size() == max) return;
        UrlModel urlModel = _model.getUrlModel();
        int count = urlModel.getChildCount(url);
        for (int i=0; i<count; i++) {
            HttpUrl child = urlModel.getChildAt(url, i);
            queueLinksUnder(child, links, max);
            if (links.size() == max) return;
        }
    }
View Full Code Here

    public void clearQueue() {
        _model.clearLinkQueue();
    }
   
    private Request newGetRequest(Link link) {
        HttpUrl url = link.getURL();
        String referer = link.getReferer();
        Request req = new Request();
        req.setMethod("GET");
        req.setURL(url);
        req.setVersion("HTTP/1.0"); // 1.1 or 1.0?
        if (referer != null) {
            req.setHeader("Referer", referer);
        }
        req.setHeader("Host", url.getHost() + ":" + url.getPort());
        if (req.getVersion().equals("HTTP/1.0"))
            req.setHeader("Connection", "Keep-Alive");
        NamedValue[] headers = _model.getExtraHeaders();
        if (headers != null && headers.length > 0) {
            for (int i=0; i< headers.length; i++) {
View Full Code Here

TOP

Related Classes of org.owasp.webscarab.model.HttpUrl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.