/ghostme4j

:ghost: Ghost Me - Java HTTP Proxifier

Primary LanguageJavaApache License 2.0Apache-2.0

ghostme4j

👻 Ghostme4j - HTTP Proxifier Search and use proxies in an easy way.

Apache License Build Status Maven Central

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>org.brunocvcunha.ghostme4j</groupId>
  <artifactId>ghostme4j</artifactId>
  <version>0.2</version>
</dependency>

or Gradle:

compile 'org.brunocvcunha.ghostme4j:ghostme4j:0.2'

Snapshots of the development version are available in Sonatype's snapshots repository.

ghostme4j requires at minimum Java 6.

Usage Example

  Proxy used = GhostMe.ghostMySystemProperties(true); //true if it needs to test proxy connectivity/anonymity
  URL url = new URL("https://github.com/brunocvcunha/ghostme4j");
  URLConnection conn = url.openConnection(used.getJavaNetProxy());

or apply to the system properties (http.proxyHost and http.proxyPort), and no need to pass it in parameters:

  Proxy used = GhostMe.getProxy(true);  //true if it needs to test proxy connectivity/anonymity
  URL url = new URL("https://github.com/brunocvcunha/ghostme4j");
  URLConnection conn = url.openConnection();

You can also get a random User-Agent, to fake a real browser connection (e.g. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36)

To apply in the system properties:

  GhostMe.applyUserAgent();

Or to get an User-Agent:

  String userAgent = GhostMe.getRandomUserAgent();

Full GhostMe example:

  Proxy used = GhostMe.ghostMySystemProperties(true); //true if it needs to test proxy connectivity/anonymity

  URL url = new URL("https://github.com/brunocvcunha/ghostme4j");
  URLConnection conn = url.openConnection(used.getJavaNetProxy());
  conn.addRequestProperty(HttpHeaders.USER_AGENT, GhostMe.getRandomUserAgent());