Package org.parosproxy.paros.network

Examples of org.parosproxy.paros.network.HttpRequestHeader


  }

  private void beginSSL() throws IOException {

        boolean isSecure = true;
        HttpRequestHeader firstHeader = null;

        inSocket = HttpSender.getSSLConnector().createTunnelServerSocket(inSocket);
       
        httpIn = new HttpInputStream(inSocket);
        httpOut = new HttpOutputStream(inSocket.getOutputStream());
View Full Code Here


    }
 
  public void run() {
        proxyThreadList.add(thread);
    boolean isSecure = this instanceof ProxyThreadSSL;
    HttpRequestHeader firstHeader = null;
   
    try {
      httpIn = new HttpInputStream(inSocket);
      httpOut = new HttpOutputStream(inSocket.getOutputStream());
     
      firstHeader = httpIn.readRequestHeader(isSecure);
           
      if (firstHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.CONNECT)) {
        httpOut.write(CONNECT_HTTP_200);
                httpOut.flush();
       
                beginSSL();
                //processForwardPort();
View Full Code Here

     */
    private HttpMessage buildMsg(URI base, String link) throws URIException, HttpMalformedHeaderException {

        URI uri = null;       
        uri = new URI(base, link, true);
        HttpMessage msg = new HttpMessage(new HttpRequestHeader(HttpRequestHeader.GET, uri, HttpHeader.HTTP11));
        return msg;
    }
View Full Code Here

  private Vector getFormQuery(Form form, URI baseURI) {
    Vector qryStrList  = new Vector();
    Vector qryList    = new Vector();
    String queryString = "";
    HttpRequestHeader reqHeader = null;
    HttpBody reqBody = null;
   
    if (form.getAction()==null) {
        return qryList;
    }
   
    int combinationCount = 1;
    for (int i=0; i<form.getSelect().length; i++) {
        // restrict max # of options to 2
      combinationCount *= (form.getSelect()[i].getOption().length > 2) ? 2: form.getSelect()[i].getOption().length;
    }

    if (combinationCount > 512) {
      return qryList;
    }

    try {
      // build all queryString using input tags
      for (int i=0; i<form.getInput().length; i++) {
        Input input = form.getInput()[i];
                if (input.getName()== null || input.getName().length() == 0) {
                    continue;
                }
        if (input.getType() != null) {
          if (//input.getType().equalsIgnoreCase(Input.SUBMIT) ||
                           
                        // submit field should also be sent for better crawling.
                           
            input.getType().equalsIgnoreCase(Input.PASSWORD) ||
            input.getType().equalsIgnoreCase(Input.CHECKBOX) ||
            input.getType().equalsIgnoreCase(Input.RESET)) {
            continue;
          }
        }
        String value = input.getValue();
        if (input.getType().equalsIgnoreCase(Input.TEXT) && value.equals("")) {
            // arbitrary fill a "1" for displayable fields.
            value = "1";
        }
                queryString = buildPostQueryString(queryString, input.getName(), value);
      }

            // build all queryString using textarea tags
            for (int i=0; i<form.getTextArea().length; i++) {
                TextArea textarea = form.getTextArea()[i];
                if (textarea.getName()== null || textarea.getName().length() == 0) {
                    continue;
                }
                String value = textarea.getValue();
                queryString = buildPostQueryString(queryString, textarea.getName(), value);
            }
           
      // build all queryString using SELECT and OPTION tags
      qryStrList.addElement(queryString);
      for (int i=0; i<form.getSelect().length;i++) {
        Select select = form.getSelect()[i];
                if (select.getName()== null || select.getName().length() == 0) {
                    continue;
                }
        qryStrList = addSelectField(qryStrList, select);
      }

      for (int i=0; i<qryStrList.size(); i++) {
          HttpMessage msg = null;
        URI uri = null;
        String qryStr = (String) qryStrList.elementAt(i);
        if (form.getMethod().equalsIgnoreCase(Form.GET)) {
            String action = (form.getAction().indexOf(QUESTION) <0) ? form.getAction()+QUESTION+qryStr : form.getAction()+AMPERSAND+qryStr;           
          uri = new URI(baseURI, action, true);
          reqHeader = new HttpRequestHeader(form.getMethod().trim().toUpperCase(), uri, HttpHeader.HTTP11);
          msg = new HttpMessage(reqHeader);
        } else if (form.getMethod().equalsIgnoreCase(Form.POST)) {
                   
                    if (!parent.getParent().getSpiderParam().isPostForm()) {
                        continue;
                    }
            uri = new URI(baseURI, form.getAction(), true);
            reqHeader = new HttpRequestHeader(form.getMethod().trim().toUpperCase(), uri, HttpHeader.HTTP11);
            reqBody = new HttpBody(qryStr);
            reqHeader.setContentLength(reqBody.length());
            msg = new HttpMessage(reqHeader, reqBody);
        } else {
            continue;
        }
        msg.getRequestHeader().setContentLength(msg.getRequestBody().length());
View Full Code Here

    /* (non-Javadoc)
     * @see com.proofsecure.paros.core.proxy.ProxyListener#onHttpRequestSend(com.proofsecure.paros.network.HttpMessage)
     */
    public void onHttpRequestSend(HttpMessage msg) {
        HttpRequestHeader header = msg.getRequestHeader();
       
        if (header != null ) {
            String cookie = header.getHeader("Cookie");
            synchronized (cookieList){
                if (cookie != null && cookieList.indexOf(cookie)==-1){              
                    URI uri = (URI) header.getURI().clone();
                    try {
                        uri.setQuery(null);
                        String sUri = uri.toString();
                        cookieList.add(cookie);
                        getView().getOutputPanel().append(sUri + DELIM + cookie + "\n");
View Full Code Here

    /* (non-Javadoc)
     * @see com.proofsecure.paros.core.proxy.ProxyListener#onHttpRequestSend(com.proofsecure.paros.network.HttpMessage)
     */
    public void onHttpRequestSend(HttpMessage httpMessage) {

        HttpRequestHeader reqHeader = httpMessage.getRequestHeader();
       
        if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()){
            if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.POST)){
                try{
                   
                    URI uri = reqHeader.getURI();
                   
                    int pos;
                   
                    String firstline;
                   
View Full Code Here

              ManualRequestEditorDialog dialog = getManualRequestEditorDialog();
              if (dialog.getRequestPanel().getTxtHeader().getText().equals("")) {
                  HttpMessage msg = new HttpMessage();
                  try {
                      URI uri = new URI("http://www.any_domain_name.org/path", true);
                            msg.setRequestHeader(new HttpRequestHeader(HttpRequestHeader.GET, uri, HttpHeader.HTTP10));
                            dialog.getRequestPanel().setMessage(msg, true);
                        } catch (Exception e1) {}
                       
              }
              dialog.setVisible(true);
View Full Code Here

    /* (non-Javadoc)
     * @see com.proofsecure.paros.core.proxy.ProxyListener#onHttpRequestSend(com.proofsecure.paros.network.HttpMessage)
     */
    public void onHttpRequestSend(HttpMessage httpMessage) {

        HttpRequestHeader reqHeader = httpMessage.getRequestHeader();
       
        if (reqHeader != null && reqHeader.isText() && !reqHeader.isImage()){
            if (reqHeader.getMethod().equalsIgnoreCase(HttpRequestHeader.GET)){
                try{
                   
                    URI uri = reqHeader.getURI();
                   
                    int pos;
                   
                    String firstline;
                   
View Full Code Here

    /* (non-Javadoc)
     * @see com.proofsecure.paros.core.proxy.ProxyListener#onHttpRequestSend(com.proofsecure.paros.network.HttpMessage)
     */
    public void onHttpRequestSend(HttpMessage httpMessage) {
        HttpRequestHeader reqHeader = httpMessage.getRequestHeader();
        if (!reqHeader.isEmpty() && reqHeader.isText()){
          String ifModifed = reqHeader.getHeader(HttpHeader.IF_MODIFIED_SINCE);
          if (ifModifed != null){   
            reqHeader.setHeader(HttpHeader.IF_MODIFIED_SINCE, null);                  
          }
          String ifNoneMatch = reqHeader.getHeader(HttpHeader.IF_NONE_MATCH);
          if (ifNoneMatch != null){   
            reqHeader.setHeader(HttpHeader.IF_NONE_MATCH, null);                  
          }
         
        }

    }
View Full Code Here

  }

  private void beginSSL() throws IOException {

        boolean isSecure = true;
        HttpRequestHeader firstHeader = null;

        inSocket = HttpSender.getSSLConnector().createTunnelServerSocket(inSocket);
       
        httpIn = new HttpInputStream(inSocket);
        httpOut = new HttpOutputStream(inSocket.getOutputStream());
View Full Code Here

TOP

Related Classes of org.parosproxy.paros.network.HttpRequestHeader

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.