All Downloads are FREE. Search and download functionalities are using the official Maven repository.

burp.impl.HttpService Maven / Gradle / Ivy

Go to download

The Burp Suite Utils project provides developers with APIs for building Burp Suite Extensions.

The newest version!
/*
 * Copyright 2016 augustd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package burp.impl;

import burp.IHttpService;
import java.net.URL;

/**
 *
 * @author adetlefsen
 */
public class HttpService implements IHttpService {
    
    public static final String PROTOCOL_HTTP = "http";
    public static final String PROTOCOL_HTTPS = "https";
    
    private String host;
    private int port;
    private String protocol;

    public HttpService(String host, int port, String protocol) {
        this.host = host;
        this.port = port;
        this.protocol = protocol;
    }
    
    public HttpService(URL url) {
        this.host = url.getHost();
        this.protocol = url.getProtocol();
        this.port = (url.getPort() > 0) ? url.getPort() : url.getDefaultPort();
    }

    public HttpService(IHttpService service) {
        this.host = service.getHost();
        this.port = service.getPort();
        this.protocol = service.getProtocol();
    }
    
    @Override
    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    @Override
    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }
    
    public boolean useHttps() {
        return PROTOCOL_HTTPS.equalsIgnoreCase(protocol);
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy