Skip to content

Commit f5bf9ab

Browse files
committed
Release v2.0.0
1 parent 28c4b01 commit f5bf9ab

File tree

12 files changed

+143
-100
lines changed

12 files changed

+143
-100
lines changed

README.md

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,78 @@
11
# winfoom
2-
### Basic Proxy Facade for NTLM, Kerberos and SOCKS 5 proxies
2+
### Basic Proxy Facade for NTLM, Kerberos, SOCKS and Proxy Auto Config file proxies
33

44
[![Build Status](https://travis-ci.com/ecovaci/winfoom.svg?branch=master)](https://travis-ci.com/github/ecovaci/winfoom)
55

6-
Winfoom is an HTTP(s) proxy server facade that allows applications to authenticate through a NTML/Kerberos HTTP authenticated proxy server or SOCKS 5 proxy server, typically used in corporate environments,
7-
without having to deal with the actual handshake.
6+
# Overview
7+
Winfoom is an HTTP(s) proxy server facade that allows applications to authenticate through the following proxies:
88

9-
A lot of software applications have problems when dealing with an authenticated proxy server's protocol. Winfoom sits between the corporate proxy and applications and offloads the authentication and the proxy's protocol, acting as a facade. This way, the software application will only have to deal with a basic proxy with no authentication.
9+
* NTML or Kerberos HTTP authenticated proxy
10+
* SOCKS version 4 or 5, with or without authentication
11+
* Proxy Auto Config files
12+
13+
typically used in corporate environments, without having to deal with the actual handshake.
14+
15+
A lot of software applications have problems when dealing with an authenticated proxy server's protocol.
16+
Winfoom sits between the corporate proxy and applications and offloads the authentication and the proxy's protocol, acting as a facade.
17+
This way, the software application will only have to deal with a basic proxy with no authentication.
1018

1119
An example of such a facade for NTLM proxies is [CNTLM](http://cntlm.sourceforge.net/)
1220

13-
### Instalation
21+
# Getting Started
22+
## Download Winfoom
23+
### Download prepackaged
24+
To try out Winfoom without needing to download the source and package it, check out the [releases](https://github.com/ecovaci/winfoom/releases) for a prepackaged `winfoom.zip`.
25+
Winfoom is a Java application and comes with a release that includes a Java environment [AdoptOpenJDK](https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.5%2B10/OpenJDK11U-jdk_x64_windows_hotspot_11.0.5_10.msi),
26+
so you don't have to install anything.
27+
28+
### Build from source code
29+
If you decide to build the executable *jar* file from the source code, you would need these prerequisites:
30+
* Java JDK 11(+)
31+
* Maven 3.x version
32+
33+
First download the source code from [releases](https://github.com/ecovaci/winfoom/releases) and unzip it.
34+
35+
Then open a terminal and execute this command inside the `winfoom-x.x.x` directory:
1436

37+
```
38+
mvn clean package
39+
```
40+
41+
Now you should have the generated executable *jar* file under the *target* directory.
42+
43+
## Run Winfoom
1544
> 👉 Note: Winfoom only works on Windows OS!
1645
17-
Winfoom is a Java application and comes with a release that includes a Java environment [AdoptOpenJDK](https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.5%2B10/OpenJDK11U-jdk_x64_windows_hotspot_11.0.5_10.msi),
18-
so you don't have to install anything.
46+
The prepackaged `winfoom.zip` contains a single executable file: `launch.bat`.
1947

20-
Starting with v1.5.1, the release contains a single executable file: `launch.bat`.
2148
Available commands:
22-
2349
* `launch.bat` launches the application using the bundled JRE.
2450
* `launch.bat --debug` launches the application using the bundled JRE in debug mode.
2551
* `launch.bat --systemjre` launches the application using your system JRE - you'll need a JRE v.11 (at least).
2652
* `launch.bat --debug --systemjre` launches the application using your system JRE in debug mode.
2753

28-
The installation is pretty basic, just unzip the content of the released archive then double-click on `launch.bat` file.
54+
The fastest way to run Winfoom is by double-click on `launch.bat` file.
2955

30-
The application log file is placed under `logs` directory.
56+
## Winfoom's logs
57+
The application log file is placed under `<user.home.dir>/.winfoom/logs` directory.
3158

32-
### Configuration
33-
34-
Winfoom has a graphical user interface that allows the user to configure the proxy type (HTTP or SOCKS5), the proxy host, port and the URL for testing the settings.
35-
These fields are pre-filled with the values gathered from your system.
36-
37-
![winfoom_gui](https://github.com/ecovaci/winfoom/blob/master/assets/img/winfoom_gui.png)
59+
## Configuration
60+
Winfoom has a graphical user interface that allows configuration.
61+
62+
The first thing to select is the proxy type:
63+
1) `HTTP` - if the remote proxy is NTLM, KERBEROS or any other HTTP proxy
64+
2) `SOCKS4` - if the remote proxy is SOCKS version 4
65+
3) `SOCKS5` - if the remote proxy is SOCKS version 5
66+
4) `PAC` - if the proxy is using a Proxy Auto Config file
67+
5) `DIRECT` - no proxy, used for various testing environments
3868

39-
For SOCKS proxy type, if authentication is required use the `Config` button to provide user/password.
69+
Then fill in the required fields. You can use the field's tooltip to get more information.
4070

41-
> 👉 Note: For HTTP proxy type, Winfoom uses the current user credentials to authenticate to the remote proxy, there is no need to provide them!
71+
### Authentication
72+
* For HTTP proxy type, Winfoom uses the current Windows user credentials to authenticate to the remote proxy.
73+
* For SOCKS5 proxy type, the user/password need the be provided when required.
4274

75+
### Test
4376
To test it, open a browser, let's say Firefox and configure proxy like this:
4477

4578
![firefox](https://github.com/ecovaci/winfoom/blob/master/assets/img/firefox.png)
@@ -49,34 +82,18 @@ Now you should be able to access any URL without Firefox asking for credentials.
4982
_If you don't have an available proxy, you still can test WinFoom by installing [WinGate](https://www.wingate.com/) and configure it to act
5083
as a NTML proxy._
5184

52-
### Build from source code
53-
54-
If you decide to build the executable *jar* file from source code, you would need these prerequisites:
55-
56-
* Java JDK 11(+)
57-
* Maven 3.x version
58-
* Git for Windows
59-
60-
Then open a terminal and execute the commands:
61-
62-
1) `git clone https://github.com/ecovaci/winfoom.git`
63-
2) `cd winfoom`
64-
3) `mvn clean package`
65-
66-
Now you should have the generated executable *jar* file under the *target* directory.
67-
68-
### Todo
6985

70-
- Performance tests.
86+
# Todo
87+
- Linux/MacOS porting.
7188

72-
### Coding Guidance
89+
# Coding Guidance
7390

7491
Please review these docs below about coding practices.
7592

7693
* [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html)
7794
* [Java Code Conventions](https://www.oracle.com/technetwork/java/codeconventions-150003.pdf)
7895

79-
### Feedback
96+
# Feedback
8097

8198
Any feedback or suggestions are welcome.
8299
It is hosted with an Apache 2.0 license so issues, forks and PRs are most appreciated.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</parent>
2424
<groupId>org.kpax</groupId>
2525
<artifactId>winfoom</artifactId>
26-
<version>2.0.0-SNAPSHOT</version>
26+
<version>2.0.0-RELEASE</version>
2727

2828
<name>winfoom</name>
2929
<url>https://github.com/ecovaci/winfoom</url>

src/main/java/org/kpax/winfoom/FoomApplication.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212

1313
package org.kpax.winfoom;
1414

15-
import org.apache.commons.io.IOUtils;
1615
import org.kpax.winfoom.config.ProxyConfig;
1716
import org.kpax.winfoom.config.SystemConfig;
18-
import org.kpax.winfoom.util.InputOutputs;
1917
import org.kpax.winfoom.util.JarUtils;
2018
import org.kpax.winfoom.util.SwingUtils;
2119
import org.kpax.winfoom.view.AppFrame;
@@ -98,12 +96,12 @@ private static void checkAppVersion() throws IOException {
9896
if (Files.exists(systemPropertiesPath)) {
9997
Properties systemProperties = PropertiesLoaderUtils.loadProperties(
10098
new FileSystemResource(systemPropertiesPath.toFile()));
101-
String existingVersion = systemProperties.getProperty("releaseVersion");
102-
logger.debug("existingVersion [{}]", existingVersion);
103-
String actualVersion = JarUtils.getVersion(FoomApplication.class);
104-
logger.debug("actualVersion [{}]", actualVersion);
99+
String existingVersion = systemProperties.getProperty("app.version");
100+
logger.info("existingVersion [{}]", existingVersion);
101+
String actualVersion = FoomApplication.class.getPackage().getImplementationVersion();
102+
logger.info("actualVersion [{}]", actualVersion);
105103

106-
if (!actualVersion.equals(existingVersion)) {
104+
if (actualVersion != null && !actualVersion.equals(existingVersion)) {
107105
logger.info("Different versions found: existent = {} , actual = {}", existingVersion, actualVersion);
108106

109107
Path backupDirPath = appHomePath.resolve(existingVersion);

src/main/java/org/kpax/winfoom/config/ProxyConfig.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public void save() throws IOException, ConfigurationException {
257257
config.setProperty("local.port", this.localPort);
258258
config.setProperty("proxy.test.url", this.proxyTestUrl);
259259
config.setProperty("proxy.username", proxyType.isSocks5() ? this.proxyUsername : null);
260-
config.setProperty("proxy.storePassword", proxyType.isSocks5() ? this.proxyStorePassword : null);
260+
config.setProperty("proxy.storePassword", proxyType.isSocks5() ? this.proxyStorePassword : false);
261261
config.setProperty("proxy.pac.fileLocation", proxyType.isPac() ? this.proxyPacFileLocation : null);
262262

263263
if (proxyType.isPac()) {
@@ -276,6 +276,16 @@ public void save() throws IOException, ConfigurationException {
276276
}
277277

278278
propertiesBuilder.save();
279+
280+
//
281+
// Refresh config values
282+
//
283+
setProxyHost(config.getString("proxy.host"));
284+
setProxyPort(config.getInt("proxy.port"));
285+
setProxyUsername(config.getString("proxy.username"));
286+
setProxyStorePassword(config.getBoolean("proxy.storePassword"));
287+
setProxyPacFileLocation(config.getString("proxy.pac.fileLocation"));
288+
this.proxyPassword = config.getString("proxy.password");
279289
}
280290

281291
@Override

src/main/java/org/kpax/winfoom/config/SystemConfig.java

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.apache.commons.configuration2.builder.fluent.Configurations;
1919
import org.apache.commons.configuration2.ex.ConfigurationException;
2020
import org.apache.http.client.config.RequestConfig;
21-
import org.kpax.winfoom.util.JarUtils;
2221
import org.slf4j.Logger;
2322
import org.slf4j.LoggerFactory;
2423
import org.springframework.beans.factory.annotation.Autowired;
@@ -111,18 +110,8 @@ public class SystemConfig {
111110
@Value("${useSystemProperties:false}")
112111
private boolean useSystemProperties;
113112

114-
@Value("${releaseVersion:Unknown}")
115-
private String releaseVersion;
116-
117-
@PostConstruct
118-
public void init() {
119-
try {
120-
logger.info("Get application version from manifest file");
121-
releaseVersion = JarUtils.getVersion(getClass());
122-
} catch (Exception e) {
123-
logger.warn("Error on getting application version from MANIFEST file, using Unknown");
124-
}
125-
}
113+
@Value("${app.version}")
114+
private String appVersion;
126115

127116
public Integer getMaxConnectionsPerRoute() {
128117
return maxConnectionsPerRoute;
@@ -132,8 +121,8 @@ public Integer getMaxConnections() {
132121
return maxConnections;
133122
}
134123

135-
public String getReleaseVersion() {
136-
return releaseVersion;
124+
public String getAppVersion() {
125+
return appVersion;
137126
}
138127

139128
public boolean isUseSystemProperties() {
@@ -193,8 +182,7 @@ public void save() throws ConfigurationException, IOException, IllegalAccessExce
193182
for (Field field : this.getClass().getDeclaredFields()) {
194183
Value valueAnnotation = field.getAnnotation(Value.class);
195184
if (valueAnnotation != null) {
196-
String value = valueAnnotation.value();
197-
String propName = value.replaceAll("[${}]", "").split(":")[0];
185+
String propName = valueAnnotation.value().replaceAll("[${}]", "").split(":")[0];
198186
config.setProperty(propName, field.get(this));
199187
}
200188
}

src/main/java/org/kpax/winfoom/proxy/ProxyBlacklist.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ProxyBlacklist {
4747
private ProxyConfig proxyConfig;
4848

4949
/**
50-
* Attempts to blacklist proxy. Does nothing if the blacklisting is disabled.<br>
50+
* Attempts to blacklist a proxy. Does nothing if the blacklisting is disabled.<br>
5151
* If the proxy is already blacklisted, it keeps the existent timeout.
5252
*
5353
* @param proxyInfo the proxy to be blacklisted.

src/main/java/org/kpax/winfoom/util/JarUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ private JarUtils() {
2323

2424
/**
2525
* Gets the {@code Implementation-Version} attribute from jar's MANIFEST.MF file.
26+
* Only accurate when the application is packaged as JAR file.
2627
*
27-
* @param cls the class
2828
* @return the application's version as it appears in the pom.xml file.
2929
* @throws IOException
3030
*/
31-
public static String getVersion(Class<?> cls) throws IOException {
32-
Object version = new Manifest(cls.getResourceAsStream("/META-INF/MANIFEST.MF"))
31+
@Deprecated
32+
public static String getAppVersion() throws IOException {
33+
Object version = new Manifest(JarUtils.class.getResourceAsStream("/META-INF/MANIFEST.MF"))
3334
.getMainAttributes()
3435
.get(Attributes.Name.IMPLEMENTATION_VERSION);
3536
if (version != null) {

src/main/java/org/kpax/winfoom/util/Message.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,21 @@
1313
package org.kpax.winfoom.util;
1414

1515
/**
16+
* It encapsulates a GUI message.
17+
*
1618
* @author Eugen Covaci {@literal [email protected]}
1719
* Created on 2/28/2020
1820
*/
1921
public final class Message {
2022

23+
/**
24+
* The message type.
25+
*/
2126
private final MessageType type;
2227

28+
/**
29+
* The message text.
30+
*/
2331
private final String text;
2432

2533
private Message(MessageType type, String text) {

src/main/java/org/kpax/winfoom/util/SwingUtils.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,12 @@ public class SwingUtils {
3737

3838
private static final String DLG_WARN_TITLE = "Warning";
3939

40-
public static void setFont(final Component component, final Font font) {
41-
component.setFont(font);
42-
if (component instanceof JMenu) {
43-
JMenu menu = (JMenu) component;
44-
for (int i = 0; i < menu.getItemCount(); i++) {
45-
setFont(menu.getItem(i), font);
46-
}
47-
} else if (component instanceof Container) {
48-
for (Component child : ((Container) component).getComponents()) {
49-
setFont(child, font);
50-
}
51-
}
52-
}
53-
40+
/**
41+
* Enable/disable a component and all it's sub-components.
42+
*
43+
* @param component the {@link Component} to be enabled/disabled.
44+
* @param enabled {@code true} or {@code false}.
45+
*/
5446
public static void setEnabled(final Component component, final boolean enabled) {
5547
component.setEnabled(enabled);
5648
if (component instanceof Container) {
@@ -60,6 +52,11 @@ public static void setEnabled(final Component component, final boolean enabled)
6052
}
6153
}
6254

55+
/**
56+
* Accepts an input value only if it is valid.
57+
*
58+
* @param spinner the {@link JSpinner} instance.
59+
*/
6360
public static void commitsOnValidEdit(final JSpinner spinner) {
6461
JComponent comp = spinner.getEditor();
6562
JFormattedTextField field = (JFormattedTextField) comp.getComponent(0);
@@ -94,6 +91,12 @@ public static void showWarningMessage(Component parentComponent, String title, S
9491
showMessage(parentComponent, title, message, JOptionPane.WARNING_MESSAGE);
9592
}
9693

94+
/**
95+
* It executes a {@link Runnable}, showing a waiting cursor until the execution ends.
96+
*
97+
* @param runnable the {@link Runnable} instance (not null)
98+
* @param frame the current {@link JFrame}
99+
*/
97100
public static void executeRunnable(final Runnable runnable, final JFrame frame) {
98101
Validate.notNull(runnable, "runnable cannot be null");
99102
Validate.notNull(frame, "frame cannot be null");
@@ -110,6 +113,13 @@ public static void executeRunnable(final Runnable runnable, final JFrame frame)
110113
thread.start();
111114
}
112115

116+
/**
117+
* It loads an image from a specified classpath location.
118+
*
119+
* @param cls used to localize the image URL.
120+
* @param filename the image's filename.
121+
* @return the loaded {@link Image}.
122+
*/
113123
public static Image loadImage(Class<?> cls, String filename) {
114124
try {
115125
URL resource = cls.getResource("/img/" + filename);

src/main/java/org/kpax/winfoom/view/AppFrame.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ private JMenuItem getMntmAbout() {
573573
mntmAbout = new JMenuItem("About");
574574
mntmAbout.setIcon(new TunedImageIcon("dialog-information.png"));
575575
mntmAbout.addActionListener(e -> SwingUtils.showInfoMessage(this, "About", "Winfoom - Basic Proxy Facade" +
576-
"\nVersion: " + systemConfig.getReleaseVersion()
576+
"\nVersion: " + systemConfig.getAppVersion()
577577
+ "\nProject home page: https://github.com/ecovaci/winfoom"
578578
+ "\nLicense: Apache 2.0"));
579579
}
@@ -583,10 +583,9 @@ private JMenuItem getMntmAbout() {
583583
// ------- End Menu
584584

585585
private JTextField createTextField(String text) {
586-
JTextField textField = new JTextField();
586+
JTextField textField = new JTextField(text);
587587
textField.setPreferredSize(new Dimension(220, 25));
588588
textField.setMinimumSize(new Dimension(6, 25));
589-
textField.setText(text);
590589
return textField;
591590
}
592591

@@ -599,6 +598,7 @@ private JSpinner createJSpinner(Integer value) {
599598
return jSpinner;
600599
}
601600

601+
602602
private void disableAll() {
603603
SwingUtils.setEnabled(getContentPane(), false);
604604
}

0 commit comments

Comments
 (0)