mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
lots of refactoring in config package:
* Config class is now a true singleton * GlobalConfig renamed to ScannerConfig * DimensionsConfig renamed to GUIConfig * all GUI-specific stuff moved to GUIConfig * more config class access through injection git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@256 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
6ba9e439fd
commit
912ad127ec
@ -37,3 +37,10 @@ geolocate
|
||||
geo
|
||||
mac
|
||||
linux
|
||||
pico
|
||||
autodetect
|
||||
pingers
|
||||
preload
|
||||
tm
|
||||
locale
|
||||
int
|
||||
|
||||
@ -44,10 +44,10 @@ public class Main {
|
||||
Display display = Display.getDefault();
|
||||
LOG.finer("SWT initialized after " + (System.currentTimeMillis() - startTime));
|
||||
|
||||
// initalize Labels instance
|
||||
// initialize Labels instance
|
||||
Labels.initialize(new Locale("en")); // TODO: retrieve locale normally
|
||||
// initialize Config instance
|
||||
Config.initialize();
|
||||
Config globalConfig = Config.getConfig();
|
||||
LOG.finer("Labels and Config initialized after " + (System.currentTimeMillis() - startTime));
|
||||
|
||||
ComponentRegistry componentRegistry = new ComponentRegistry();
|
||||
@ -74,7 +74,7 @@ public class Main {
|
||||
}
|
||||
|
||||
// save config on exit
|
||||
Config.store();
|
||||
globalConfig.store();
|
||||
|
||||
// dispose the native objects
|
||||
display.dispose();
|
||||
|
||||
@ -75,11 +75,12 @@ public class ComponentRegistry {
|
||||
ComponentParameter anyComponentParameter = new ComponentParameter();
|
||||
|
||||
// non-GUI
|
||||
container.registerComponentInstance(Config.getPreferences());
|
||||
container.registerComponentInstance(Config.getGlobal());
|
||||
container.registerComponentInstance(Config.getDimensionsConfig());
|
||||
container.registerComponentInstance(Config.getOpenersConfig());
|
||||
container.registerComponentInstance(Config.getFavoritesConfig());
|
||||
Config globalConfig = Config.getConfig();
|
||||
container.registerComponentInstance(globalConfig.getPreferences());
|
||||
container.registerComponentInstance(globalConfig.getScanner());
|
||||
container.registerComponentInstance(globalConfig.getGUI());
|
||||
container.registerComponentInstance(globalConfig.getOpeners());
|
||||
container.registerComponentInstance(globalConfig.getFavorites());
|
||||
container.registerComponentInstance(Labels.getInstance());
|
||||
container.registerComponentImplementation(CommentsConfig.class);
|
||||
container.registerComponentImplementation(ConfigDetector.class);
|
||||
@ -140,7 +141,6 @@ public class ComponentRegistry {
|
||||
container.registerComponentImplementation(MainWindow.class, MainWindow.class, new Parameter[] {
|
||||
new ComponentParameter("mainShell"),
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
new ComponentParameter("feederArea"),
|
||||
new ComponentParameter("controlsArea"),
|
||||
new ComponentParameter("feederSelectionCombo"),
|
||||
@ -160,6 +160,7 @@ public class ComponentRegistry {
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter});
|
||||
container.registerComponentImplementation(StatusBar.class, StatusBar.class, new Parameter[] {
|
||||
new ComponentParameter("mainShell"),
|
||||
|
||||
@ -13,68 +13,75 @@ import java.util.prefs.Preferences;
|
||||
*/
|
||||
public final class Config {
|
||||
|
||||
private static Preferences preferences;
|
||||
/** Singleton instance */
|
||||
private static Config globalConfig;
|
||||
|
||||
/** easily accessible global configuration */
|
||||
private static GlobalConfig globalConfig;
|
||||
private Preferences preferences;
|
||||
|
||||
/** easily accessible scanner configuration */
|
||||
private ScannerConfig scannerConfig;
|
||||
/** various GUI preferences and dimensions are stored here */
|
||||
private GUIConfig guiConfig;
|
||||
/** favorites are stored here */
|
||||
private static NamedListConfig favoritesConfig;
|
||||
private NamedListConfig favoritesConfig;
|
||||
/** openers are stored here */
|
||||
private static OpenersConfig openersConfig;
|
||||
/** various dimensions are stored here */
|
||||
private static DimensionsConfig dimensionsConfig;
|
||||
private OpenersConfig openersConfig;
|
||||
|
||||
private Config() {
|
||||
preferences = Preferences.userRoot().node("ipscan");
|
||||
scannerConfig = new ScannerConfig(preferences);
|
||||
guiConfig = new GUIConfig(preferences);
|
||||
favoritesConfig = new FavoritesConfig(preferences);
|
||||
openersConfig = new OpenersConfig(preferences);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the singleton instance
|
||||
*/
|
||||
public static void initialize() {
|
||||
preferences = Preferences.userRoot().node("ipscan");
|
||||
globalConfig = new GlobalConfig(preferences);
|
||||
favoritesConfig = new FavoritesConfig(preferences);
|
||||
openersConfig = new OpenersConfig(preferences);
|
||||
dimensionsConfig = new DimensionsConfig(preferences);
|
||||
public static Config getConfig() {
|
||||
if (globalConfig == null) {
|
||||
globalConfig = new Config();
|
||||
}
|
||||
return globalConfig;
|
||||
}
|
||||
|
||||
public static void store() {
|
||||
globalConfig.store();
|
||||
public void store() {
|
||||
scannerConfig.store();
|
||||
guiConfig.store();
|
||||
favoritesConfig.store();
|
||||
openersConfig.store();
|
||||
dimensionsConfig.store();
|
||||
}
|
||||
|
||||
public static Preferences getPreferences() {
|
||||
public Preferences getPreferences() {
|
||||
return preferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return GlobalConfig instance (quick access)
|
||||
*/
|
||||
public static GlobalConfig getGlobal() {
|
||||
return globalConfig;
|
||||
public ScannerConfig getScanner() {
|
||||
return scannerConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Favorites config (only local access)
|
||||
*/
|
||||
static NamedListConfig getFavoritesConfig() {
|
||||
NamedListConfig getFavorites() {
|
||||
return favoritesConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Openers config (only local access);
|
||||
*/
|
||||
static OpenersConfig getOpenersConfig() {
|
||||
OpenersConfig getOpeners() {
|
||||
return openersConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Dimensions config (quick access);
|
||||
*/
|
||||
public static DimensionsConfig getDimensionsConfig() {
|
||||
return dimensionsConfig;
|
||||
public GUIConfig getGUI() {
|
||||
return guiConfig;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -28,12 +28,12 @@ public class ConfigDetector {
|
||||
private static final double SUCCESS_PROBABILITY = 0.2;
|
||||
|
||||
private static Logger logger;
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
private DetectorCallback callback;
|
||||
private AtomicInteger expectedConnects;
|
||||
private AtomicInteger actualConnects;
|
||||
|
||||
public ConfigDetector(GlobalConfig config) {
|
||||
public ConfigDetector(ScannerConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
||||
@ -14,10 +14,16 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
*
|
||||
* @author Anton Keks
|
||||
*/
|
||||
public class DimensionsConfig {
|
||||
public class GUIConfig {
|
||||
|
||||
private Preferences preferences;
|
||||
|
||||
public boolean isFirstRun;
|
||||
public int activeFeeder;
|
||||
public DisplayMethod displayMethod;
|
||||
public boolean showScanStats;
|
||||
public boolean askScanConfirmation;
|
||||
|
||||
public int windowHeight;
|
||||
public int windowWidth;
|
||||
public int windowTop;
|
||||
@ -26,28 +32,42 @@ public class DimensionsConfig {
|
||||
/** this one is not saved, just a globally accessed parameter */
|
||||
public int standardButtonHeight = 22;
|
||||
|
||||
public static enum DisplayMethod {ALL, ALIVE, PORTS}
|
||||
|
||||
// package local constructor
|
||||
DimensionsConfig(Preferences preferences) {
|
||||
GUIConfig(Preferences preferences) {
|
||||
this.preferences = preferences;
|
||||
load();
|
||||
}
|
||||
|
||||
private void load() {
|
||||
isFirstRun = preferences.getBoolean("firstRun", true);
|
||||
activeFeeder = preferences.getInt("activeFeeder", 0);
|
||||
displayMethod = DisplayMethod.valueOf(preferences.get("displayMethod", DisplayMethod.ALL.toString()));
|
||||
showScanStats = preferences.getBoolean("showScanStats", true);
|
||||
askScanConfirmation = preferences.getBoolean("askScanConfirmation", true);
|
||||
|
||||
isWindowMaximized = preferences.getBoolean("windowMaximized", false);
|
||||
windowHeight = preferences.getInt("windowHeight", 350);
|
||||
windowWidth = preferences.getInt("windowWidth", 560);
|
||||
windowTop = preferences.getInt("windowTop", 100);
|
||||
windowLeft = preferences.getInt("windowLeft", 100);
|
||||
isWindowMaximized = preferences.getBoolean("windowMaximized", false);
|
||||
}
|
||||
|
||||
public void store() {
|
||||
preferences.putBoolean("firstRun", isFirstRun);
|
||||
preferences.putInt("activeFeeder", activeFeeder);
|
||||
preferences.put("displayMethod", displayMethod.toString());
|
||||
preferences.putBoolean("showScanStats", showScanStats);
|
||||
preferences.putBoolean("askScanConfirmation", askScanConfirmation);
|
||||
|
||||
preferences.putBoolean("windowMaximized", isWindowMaximized);
|
||||
if (!isWindowMaximized) {
|
||||
preferences.putInt("windowHeight", windowHeight);
|
||||
preferences.putInt("windowWidth", windowWidth);
|
||||
preferences.putInt("windowTop", windowTop);
|
||||
preferences.putInt("windowLeft", windowLeft);
|
||||
}
|
||||
preferences.putBoolean("windowMaximized", isWindowMaximized);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -8,18 +8,16 @@ package net.azib.ipscan.config;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
/**
|
||||
* Global configuration holder.
|
||||
* Scanner configuration holder.
|
||||
*
|
||||
* @author Anton Keks
|
||||
*/
|
||||
public final class GlobalConfig {
|
||||
public final class ScannerConfig {
|
||||
|
||||
private Preferences preferences;
|
||||
|
||||
public boolean isFirstRun;
|
||||
public int maxThreads;
|
||||
public int threadDelay;
|
||||
public int activeFeeder;
|
||||
public boolean scanDeadHosts;
|
||||
public String selectedPinger;
|
||||
public int pingTimeout;
|
||||
@ -31,24 +29,17 @@ public final class GlobalConfig {
|
||||
public String portString;
|
||||
public String notAvailableText;
|
||||
public String notScannedText;
|
||||
public DisplayMethod displayMethod;
|
||||
public boolean showScanStats;
|
||||
public boolean askScanConfirmation;
|
||||
|
||||
public static enum DisplayMethod {ALL, ALIVE, PORTS}
|
||||
|
||||
/**
|
||||
* Package local constructor.
|
||||
* It loads all preferences.
|
||||
* @param preferences
|
||||
*/
|
||||
GlobalConfig(Preferences preferences) {
|
||||
ScannerConfig(Preferences preferences) {
|
||||
this.preferences = preferences;
|
||||
|
||||
isFirstRun = preferences.getBoolean("firstRun", true);
|
||||
maxThreads = preferences.getInt("maxThreads", Platform.CRIPPLED_WINDOWS ? 10 : 100);
|
||||
threadDelay = preferences.getInt("threadDelay", 20);
|
||||
activeFeeder = preferences.getInt("activeFeeder", 0);
|
||||
scanDeadHosts = preferences.getBoolean("scanDeadHosts", false);
|
||||
selectedPinger = preferences.get("selectedPinger", "pinger.icmp");
|
||||
pingTimeout = preferences.getInt("pingTimeout", 2000);
|
||||
@ -60,19 +51,14 @@ public final class GlobalConfig {
|
||||
portString = preferences.get("portString", "");
|
||||
notAvailableText = preferences.get("notAvailableText", Labels.getLabel("fetcher.value.notAvailable"));
|
||||
notScannedText = preferences.get("notScannedText", Labels.getLabel("fetcher.value.notScanned"));
|
||||
displayMethod = DisplayMethod.valueOf(preferences.get("displayMethod", DisplayMethod.ALL.toString()));
|
||||
showScanStats = preferences.getBoolean("showScanStats", true);
|
||||
askScanConfirmation = preferences.getBoolean("askScanConfirmation", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores all the internal properties to the storage media
|
||||
*/
|
||||
public void store() {
|
||||
preferences.putBoolean("firstRun", isFirstRun);
|
||||
preferences.putInt("maxThreads", maxThreads);
|
||||
preferences.putInt("threadDelay", threadDelay);
|
||||
preferences.putInt("activeFeeder", activeFeeder);
|
||||
preferences.putBoolean("scanDeadHosts", scanDeadHosts);
|
||||
preferences.put("selectedPinger", selectedPinger);
|
||||
preferences.putInt("pingTimeout", pingTimeout);
|
||||
@ -84,8 +70,5 @@ public final class GlobalConfig {
|
||||
preferences.put("portString", portString);
|
||||
preferences.put("notAvailableText", notAvailableText);
|
||||
preferences.put("notScannedText", notScannedText);
|
||||
preferences.put("displayMethod", displayMethod.toString());
|
||||
preferences.putBoolean("showScanStats", showScanStats);
|
||||
preferences.putBoolean("askScanConfirmation", askScanConfirmation);
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@ package net.azib.ipscan.core;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.state.ScanningState;
|
||||
import net.azib.ipscan.core.state.StateMachine;
|
||||
import net.azib.ipscan.feeders.Feeder;
|
||||
@ -27,11 +27,11 @@ public class ScannerThread extends Thread {
|
||||
private ScanningResultsCallback resultsCallback;
|
||||
private int runningThreads;
|
||||
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
|
||||
public ScannerThread(Feeder feeder, Scanner scanner, StateMachine stateMachine, ScanningProgressCallback progressCallback, ScanningResultList scanningResults, GlobalConfig globalConfig, ScanningResultsCallback resultsCallback) {
|
||||
public ScannerThread(Feeder feeder, Scanner scanner, StateMachine stateMachine, ScanningProgressCallback progressCallback, ScanningResultList scanningResults, ScannerConfig scannerConfig, ScanningResultsCallback resultsCallback) {
|
||||
super("Scanner Thread");
|
||||
this.config = globalConfig;
|
||||
this.config = scannerConfig;
|
||||
this.stateMachine = stateMachine;
|
||||
this.progressCallback = progressCallback;
|
||||
this.resultsCallback = resultsCallback;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.core;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.state.StateMachine;
|
||||
import net.azib.ipscan.feeders.Feeder;
|
||||
|
||||
@ -21,16 +21,16 @@ public class ScannerThreadFactory {
|
||||
private ScanningResultList scanningResults;
|
||||
private Scanner scanner;
|
||||
private StateMachine stateMachine;
|
||||
private GlobalConfig globalConfig;
|
||||
private ScannerConfig scannerConfig;
|
||||
|
||||
public ScannerThreadFactory(ScanningResultList scanningResults, Scanner scanner, StateMachine stateMachine, GlobalConfig globalConfig) {
|
||||
public ScannerThreadFactory(ScanningResultList scanningResults, Scanner scanner, StateMachine stateMachine, ScannerConfig scannerConfig) {
|
||||
this.scanningResults = scanningResults;
|
||||
this.scanner = scanner;
|
||||
this.stateMachine = stateMachine;
|
||||
this.globalConfig = globalConfig;
|
||||
this.scannerConfig = scannerConfig;
|
||||
}
|
||||
|
||||
public ScannerThread createScannerThread(Feeder feeder, ScanningProgressCallback progressCallback, ScanningResultsCallback resultsCallback) {
|
||||
return new ScannerThread(feeder, scanner, stateMachine, progressCallback, scanningResults, globalConfig, resultsCallback);
|
||||
return new ScannerThread(feeder, scanner, stateMachine, progressCallback, scanningResults, scannerConfig, resultsCallback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.Platform;
|
||||
import net.azib.ipscan.fetchers.FetcherException;
|
||||
|
||||
@ -26,13 +26,13 @@ public class PingerRegistryImpl implements PingerRegistry {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(PingerRegistryImpl.class.getName());
|
||||
|
||||
private GlobalConfig globalConfig;
|
||||
private ScannerConfig scannerConfig;
|
||||
|
||||
/** All available Pinger implementations */
|
||||
Map<String, Class<? extends Pinger>> pingers;
|
||||
|
||||
public PingerRegistryImpl(GlobalConfig globalConfig) {
|
||||
this.globalConfig = globalConfig;
|
||||
public PingerRegistryImpl(ScannerConfig scannerConfig) {
|
||||
this.scannerConfig = scannerConfig;
|
||||
|
||||
pingers = new LinkedHashMap<String, Class<? extends Pinger>>();
|
||||
if (Platform.WINDOWS) {
|
||||
@ -54,7 +54,7 @@ public class PingerRegistryImpl implements PingerRegistry {
|
||||
* Creates the configured pinger with configured timeout
|
||||
*/
|
||||
public Pinger createPinger() throws FetcherException {
|
||||
return createPinger(globalConfig.selectedPinger, globalConfig.pingTimeout);
|
||||
return createPinger(scannerConfig.selectedPinger, scannerConfig.pingTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,15 +80,15 @@ public class PingerRegistryImpl implements PingerRegistry {
|
||||
public boolean checkSelectedPinger() {
|
||||
// this method must be fast, so we are not checking all the implementations
|
||||
// currently only icmp pingers may not be supported, so let's check them
|
||||
if (globalConfig.selectedPinger.startsWith("pinger.icmp")) {
|
||||
if (scannerConfig.selectedPinger.startsWith("pinger.icmp")) {
|
||||
try {
|
||||
Pinger icmpPinger = createPinger(globalConfig.selectedPinger, 250);
|
||||
Pinger icmpPinger = createPinger(scannerConfig.selectedPinger, 250);
|
||||
icmpPinger.ping(InetAddress.getLocalHost(), 1);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.info("ICMP pingers fail: " + e);
|
||||
// udp should be supported in all configurations
|
||||
globalConfig.selectedPinger = "pinger.udp";
|
||||
scannerConfig.selectedPinger = "pinger.udp";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ public class NotAvailableValue implements Comparable<Object> {
|
||||
* Displays a user-friendly text string :-)
|
||||
*/
|
||||
public String toString() {
|
||||
return Config.getGlobal().notAvailableText;
|
||||
return Config.getConfig().getScanner().notAvailableText;
|
||||
}
|
||||
|
||||
public int compareTo(Object obj) {
|
||||
|
||||
@ -21,7 +21,7 @@ public class NotScannedValue implements Comparable<Object> {
|
||||
* Displays a user-friendly text string :-)
|
||||
*/
|
||||
public String toString() {
|
||||
return Config.getGlobal().notScannedText;
|
||||
return Config.getConfig().getScanner().notScannedText;
|
||||
}
|
||||
|
||||
public int compareTo(Object obj) {
|
||||
|
||||
@ -7,7 +7,7 @@ package net.azib.ipscan.fetchers;
|
||||
|
||||
import java.util.SortedSet;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.core.values.NotScannedValue;
|
||||
import net.azib.ipscan.core.values.NumericListValue;
|
||||
@ -19,8 +19,8 @@ import net.azib.ipscan.core.values.NumericListValue;
|
||||
*/
|
||||
public class FilteredPortsFetcher extends PortsFetcher {
|
||||
|
||||
public FilteredPortsFetcher(GlobalConfig globalConfig) {
|
||||
super(globalConfig);
|
||||
public FilteredPortsFetcher(ScannerConfig scannerConfig) {
|
||||
super(scannerConfig);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
||||
@ -12,7 +12,7 @@ import java.net.SocketException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.LoggerFactory;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
|
||||
@ -37,9 +37,9 @@ public class NetBIOSInfoFetcher implements Fetcher {
|
||||
private static final int NAME_TYPE_DOMAIN = 0x00;
|
||||
private static final int NAME_TYPE_MESSENGER = 0x03;
|
||||
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
|
||||
public NetBIOSInfoFetcher(GlobalConfig config) {
|
||||
public NetBIOSInfoFetcher(ScannerConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.fetchers;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.net.PingerRegistry;
|
||||
|
||||
/**
|
||||
@ -15,8 +15,8 @@ import net.azib.ipscan.core.net.PingerRegistry;
|
||||
*/
|
||||
public class PacketLossFetcher extends PingFetcher {
|
||||
|
||||
public PacketLossFetcher(PingerRegistry pingerRegistry, GlobalConfig globalConfig) {
|
||||
super(pingerRegistry, globalConfig);
|
||||
public PacketLossFetcher(PingerRegistry pingerRegistry, ScannerConfig scannerConfig) {
|
||||
super(pingerRegistry, scannerConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.LoggerFactory;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
@ -31,7 +31,7 @@ public class PingFetcher implements Fetcher {
|
||||
|
||||
public static final String PARAMETER_PINGER = "pinger";
|
||||
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
|
||||
/** The shared pinger - this one must be static, because PingTTLFetcher will use it as well */
|
||||
private static Pinger pinger;
|
||||
@ -39,9 +39,9 @@ public class PingFetcher implements Fetcher {
|
||||
/** The registry used for creation of Pinger instances */
|
||||
private PingerRegistry pingerRegistry;
|
||||
|
||||
public PingFetcher(PingerRegistry pingerRegistry, GlobalConfig globalConfig) {
|
||||
public PingFetcher(PingerRegistry pingerRegistry, ScannerConfig scannerConfig) {
|
||||
this.pingerRegistry = pingerRegistry;
|
||||
this.config = globalConfig;
|
||||
this.config = scannerConfig;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.fetchers;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
import net.azib.ipscan.core.net.PingResult;
|
||||
@ -18,8 +18,8 @@ import net.azib.ipscan.core.net.PingerRegistry;
|
||||
*/
|
||||
public class PingTTLFetcher extends PingFetcher {
|
||||
|
||||
public PingTTLFetcher(PingerRegistry pingerRegistry, GlobalConfig globalConfig) {
|
||||
super(pingerRegistry, globalConfig);
|
||||
public PingTTLFetcher(PingerRegistry pingerRegistry, ScannerConfig scannerConfig) {
|
||||
super(pingerRegistry, scannerConfig);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
||||
@ -18,7 +18,7 @@ import java.util.logging.Logger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.LoggerFactory;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
@ -31,14 +31,14 @@ import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
public abstract class PortTextFetcher implements Fetcher {
|
||||
private static final Logger LOG = LoggerFactory.getLogger();
|
||||
|
||||
private GlobalConfig globalConfig;
|
||||
private ScannerConfig scannerConfig;
|
||||
|
||||
private int port;
|
||||
private String textToSend;
|
||||
private Pattern matchingRegexp;
|
||||
|
||||
public PortTextFetcher(GlobalConfig globalConfig, int port, String textToSend, String matchingRegexp) {
|
||||
this.globalConfig = globalConfig;
|
||||
public PortTextFetcher(ScannerConfig scannerConfig, int port, String textToSend, String matchingRegexp) {
|
||||
this.scannerConfig = scannerConfig;
|
||||
this.port = port;
|
||||
this.textToSend = textToSend;
|
||||
this.matchingRegexp = Pattern.compile(matchingRegexp);
|
||||
@ -55,9 +55,9 @@ public abstract class PortTextFetcher implements Fetcher {
|
||||
try {
|
||||
// TODO: support multiple ports and check them sequentially
|
||||
// TODO: use adapted port timeout if it is configured to do so
|
||||
socket.connect(new InetSocketAddress(subject.getAddress(), port), globalConfig.portTimeout);
|
||||
socket.connect(new InetSocketAddress(subject.getAddress(), port), scannerConfig.portTimeout);
|
||||
socket.setTcpNoDelay(true);
|
||||
socket.setSoTimeout(globalConfig.portTimeout);
|
||||
socket.setSoTimeout(scannerConfig.portTimeout);
|
||||
socket.setSoLinger(true, 0);
|
||||
|
||||
socket.getOutputStream().write(textToSend.getBytes());
|
||||
|
||||
@ -13,7 +13,7 @@ import java.net.SocketTimeoutException;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.core.PortIterator;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
@ -34,14 +34,14 @@ public class PortsFetcher implements Fetcher {
|
||||
private static final String PARAMETER_OPEN_PORTS = "openPorts";
|
||||
private static final String PARAMETER_FILTERED_PORTS = "filteredPorts";
|
||||
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
|
||||
// initialize preferences for this scan
|
||||
private PortIterator portIteratorPrototype;
|
||||
protected boolean displayAsRanges = true; // TODO: make configurable
|
||||
|
||||
public PortsFetcher(GlobalConfig globalConfig) {
|
||||
this.config = globalConfig;
|
||||
public PortsFetcher(ScannerConfig scannerConfig) {
|
||||
this.config = scannerConfig;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
package net.azib.ipscan.fetchers;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
|
||||
/**
|
||||
* WebDetectFetcher - detects the Web server software running on scanned hosts.
|
||||
@ -15,8 +15,8 @@ import net.azib.ipscan.config.GlobalConfig;
|
||||
*/
|
||||
public class WebDetectFetcher extends PortTextFetcher {
|
||||
|
||||
public WebDetectFetcher(GlobalConfig globalConfig) {
|
||||
super(globalConfig, 80, "HEAD /robots.txt HTTP/1.0\r\n\r\n", "^[Ss]erver:\\s+(.*)$");
|
||||
public WebDetectFetcher(ScannerConfig scannerConfig) {
|
||||
super(scannerConfig, 80, "HEAD /robots.txt HTTP/1.0\r\n\r\n", "^[Ss]erver:\\s+(.*)$");
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
|
||||
@ -66,7 +66,7 @@ public abstract class AbstractModalDialog {
|
||||
Rectangle clientArea = shell.getClientArea();
|
||||
|
||||
Point size = okButton.computeSize(85, SWT.DEFAULT);
|
||||
size.y = Math.max(size.y, Config.getDimensionsConfig().standardButtonHeight);
|
||||
size.y = Math.max(size.y, Config.getConfig().getGUI().standardButtonHeight);
|
||||
|
||||
okButton.setSize(size);
|
||||
|
||||
@ -107,7 +107,7 @@ public abstract class AbstractModalDialog {
|
||||
cancelButton = fooButton;
|
||||
}
|
||||
// both buttons
|
||||
int height = Math.max(okButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, Config.getDimensionsConfig().standardButtonHeight);
|
||||
int height = Math.max(okButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, Config.getConfig().getGUI().standardButtonHeight);
|
||||
int distance = height/2;
|
||||
cancelButton.setLayoutData(LayoutHelper.formData(85, height, null, new FormAttachment(control, 0, SWT.RIGHT), new FormAttachment(control, 8), null));
|
||||
okButton.setLayoutData(LayoutHelper.formData(85, height, null, new FormAttachment(cancelButton, -distance), new FormAttachment(control, 8), null));
|
||||
|
||||
@ -8,7 +8,7 @@ package net.azib.ipscan.gui;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import net.azib.ipscan.config.ConfigDetector;
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.gui.util.LayoutHelper;
|
||||
|
||||
@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Text;
|
||||
*/
|
||||
public class ConfigDetectorDialog extends AbstractModalDialog implements ConfigDetector.DetectorCallback {
|
||||
|
||||
private GlobalConfig config;
|
||||
private ScannerConfig config;
|
||||
private ConfigDetector configDetector;
|
||||
private ProgressBar tryProgressBar;
|
||||
private int tryCount;
|
||||
@ -44,7 +44,7 @@ public class ConfigDetectorDialog extends AbstractModalDialog implements ConfigD
|
||||
private Text hostText;
|
||||
private Text portText;
|
||||
|
||||
public ConfigDetectorDialog(GlobalConfig config, ConfigDetector configDetector) {
|
||||
public ConfigDetectorDialog(ScannerConfig config, ConfigDetector configDetector) {
|
||||
this.config = config;
|
||||
this.configDetector = configDetector;
|
||||
this.configDetector.setCallback(this);
|
||||
|
||||
@ -5,8 +5,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import net.azib.ipscan.config.DimensionsConfig;
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.Platform;
|
||||
import net.azib.ipscan.config.Version;
|
||||
@ -51,8 +50,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||
public class MainWindow {
|
||||
|
||||
private final Shell shell;
|
||||
private final GlobalConfig globalConfig;
|
||||
private final DimensionsConfig dimensionsConfig;
|
||||
private final GUIConfig guiConfig;
|
||||
|
||||
private Composite feederArea;
|
||||
|
||||
@ -64,10 +62,9 @@ public class MainWindow {
|
||||
/**
|
||||
* Creates and initializes the main window.
|
||||
*/
|
||||
public MainWindow(Shell shell, GlobalConfig globalConfig, DimensionsConfig dimensionsConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine, ToolsActions.Preferences preferencesListener, ToolsActions.ChooseFetchers chooseFetchersListsner) {
|
||||
public MainWindow(Shell shell, GUIConfig guiConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, StateMachine stateMachine, ToolsActions.Preferences preferencesListener, ToolsActions.ChooseFetchers chooseFetchersListsner) {
|
||||
this.shell = shell;
|
||||
this.globalConfig = globalConfig;
|
||||
this.dimensionsConfig = dimensionsConfig;
|
||||
this.guiConfig = guiConfig;
|
||||
|
||||
initShell(shell);
|
||||
|
||||
@ -78,18 +75,18 @@ public class MainWindow {
|
||||
initTableAndStatusBar(resultTable, resultsContextMenu, statusBar);
|
||||
|
||||
// after all controls are initialized, resize and open
|
||||
shell.setBounds(dimensionsConfig.getWindowBounds());
|
||||
shell.setBounds(guiConfig.getWindowBounds());
|
||||
shell.open();
|
||||
if (dimensionsConfig.isWindowMaximized) {
|
||||
if (guiConfig.isWindowMaximized) {
|
||||
shell.setMaximized(true);
|
||||
}
|
||||
else {
|
||||
// set bounds twice - a workaround for a bug in SWT GTK + Compiz
|
||||
// (otherwise window gets smaller and smaller each time)
|
||||
shell.setBounds(dimensionsConfig.getWindowBounds());
|
||||
shell.setBounds(guiConfig.getWindowBounds());
|
||||
}
|
||||
|
||||
if (globalConfig.isFirstRun) {
|
||||
if (guiConfig.isFirstRun) {
|
||||
if (Platform.CRIPPLED_WINDOWS) {
|
||||
// inform crippled windows owners of their default configuration
|
||||
MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
|
||||
@ -98,7 +95,7 @@ public class MainWindow {
|
||||
box.open();
|
||||
}
|
||||
new GettingStartedDialog().open();
|
||||
globalConfig.isFirstRun = false;
|
||||
guiConfig.isFirstRun = false;
|
||||
}
|
||||
|
||||
stateMachine.addTransitionListener(new EnablerDisabler());
|
||||
@ -118,7 +115,7 @@ public class MainWindow {
|
||||
shell.addListener(SWT.Close, new Listener() {
|
||||
public void handleEvent(Event event) {
|
||||
// save dimensions!
|
||||
dimensionsConfig.setWindowBounds(shell.getBounds(), shell.getMaximized());
|
||||
guiConfig.setWindowBounds(shell.getBounds(), shell.getMaximized());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -182,7 +179,7 @@ public class MainWindow {
|
||||
IPFeederSelectionListener feederSelectionListener = new IPFeederSelectionListener();
|
||||
feederSelectionCombo.addSelectionListener(feederSelectionListener);
|
||||
// initialize the selected feeder GUI
|
||||
feederSelectionCombo.select(globalConfig.activeFeeder);
|
||||
feederSelectionCombo.select(guiConfig.activeFeeder);
|
||||
feederSelectionCombo.setToolTipText(Labels.getLabel("combobox.feeder.tooltip"));
|
||||
feederSelectionListener.widgetSelected(null);
|
||||
|
||||
@ -193,9 +190,9 @@ public class MainWindow {
|
||||
controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo});
|
||||
|
||||
// initialize global standard button height
|
||||
dimensionsConfig.standardButtonHeight = feederSelectionCombo.getBounds().height;
|
||||
guiConfig.standardButtonHeight = feederSelectionCombo.getBounds().height;
|
||||
|
||||
int toolbarHeight = dimensionsConfig.standardButtonHeight;
|
||||
int toolbarHeight = guiConfig.standardButtonHeight;
|
||||
int toolbarWidth = toolbarHeight;
|
||||
|
||||
prefsButton = new Label(controlsArea, SWT.CENTER);
|
||||
|
||||
@ -5,9 +5,10 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.GlobalConfig.DisplayMethod;
|
||||
import net.azib.ipscan.config.GUIConfig.DisplayMethod;
|
||||
import net.azib.ipscan.core.PortIterator;
|
||||
import net.azib.ipscan.core.net.PingerRegistry;
|
||||
import net.azib.ipscan.fetchers.FetcherException;
|
||||
@ -43,7 +44,8 @@ import org.eclipse.swt.widgets.Text;
|
||||
public class PreferencesDialog extends AbstractModalDialog {
|
||||
|
||||
private PingerRegistry pingerRegistry;
|
||||
private GlobalConfig globalConfig;
|
||||
private ScannerConfig scannerConfig;
|
||||
private GUIConfig guiConfig;
|
||||
private ConfigDetectorDialog configDetectorDialog;
|
||||
|
||||
private Button okButton;
|
||||
@ -73,9 +75,10 @@ public class PreferencesDialog extends AbstractModalDialog {
|
||||
private Button showInfoCheckbox;
|
||||
private Button askConfirmationCheckbox;
|
||||
|
||||
public PreferencesDialog(PingerRegistry pingerRegistry, GlobalConfig globalConfig, ConfigDetectorDialog configDetectorDialog) {
|
||||
public PreferencesDialog(PingerRegistry pingerRegistry, ScannerConfig scannerConfig, GUIConfig guiConfig, ConfigDetectorDialog configDetectorDialog) {
|
||||
this.pingerRegistry = pingerRegistry;
|
||||
this.globalConfig = globalConfig;
|
||||
this.scannerConfig = scannerConfig;
|
||||
this.guiConfig = guiConfig;
|
||||
this.configDetectorDialog = configDetectorDialog;
|
||||
}
|
||||
|
||||
@ -382,28 +385,28 @@ public class PreferencesDialog extends AbstractModalDialog {
|
||||
}
|
||||
|
||||
private void loadPreferences() {
|
||||
maxThreadsText.setText(Integer.toString(globalConfig.maxThreads));
|
||||
threadDelayText.setText(Integer.toString(globalConfig.threadDelay));
|
||||
maxThreadsText.setText(Integer.toString(scannerConfig.maxThreads));
|
||||
threadDelayText.setText(Integer.toString(scannerConfig.threadDelay));
|
||||
String[] pingerNames = pingerRegistry.getRegisteredNames();
|
||||
for (int i = 0; i < pingerNames.length; i++) {
|
||||
if (globalConfig.selectedPinger.equals(pingerNames[i])) {
|
||||
if (scannerConfig.selectedPinger.equals(pingerNames[i])) {
|
||||
pingersCombo.select(i);
|
||||
}
|
||||
}
|
||||
pingingCountText.setText(Integer.toString(globalConfig.pingCount));
|
||||
pingingTimeoutText.setText(Integer.toString(globalConfig.pingTimeout));
|
||||
deadHostsCheckbox.setSelection(globalConfig.scanDeadHosts);
|
||||
skipBroadcastsCheckbox.setSelection(globalConfig.skipBroadcastAddresses);
|
||||
portTimeoutText.setText(Integer.toString(globalConfig.portTimeout));
|
||||
adaptTimeoutCheckbox.setSelection(globalConfig.adaptPortTimeout);
|
||||
minPortTimeoutText.setText(Integer.toString(globalConfig.minPortTimeout));
|
||||
minPortTimeoutText.setEnabled(globalConfig.adaptPortTimeout);
|
||||
portsText.setText(globalConfig.portString);
|
||||
notAvailableText.setText(globalConfig.notAvailableText);
|
||||
notScannedText.setText(globalConfig.notScannedText);
|
||||
displayMethod[globalConfig.displayMethod.ordinal()].setSelection(true);
|
||||
showInfoCheckbox.setSelection(globalConfig.showScanStats);
|
||||
askConfirmationCheckbox.setSelection(globalConfig.askScanConfirmation);
|
||||
pingingCountText.setText(Integer.toString(scannerConfig.pingCount));
|
||||
pingingTimeoutText.setText(Integer.toString(scannerConfig.pingTimeout));
|
||||
deadHostsCheckbox.setSelection(scannerConfig.scanDeadHosts);
|
||||
skipBroadcastsCheckbox.setSelection(scannerConfig.skipBroadcastAddresses);
|
||||
portTimeoutText.setText(Integer.toString(scannerConfig.portTimeout));
|
||||
adaptTimeoutCheckbox.setSelection(scannerConfig.adaptPortTimeout);
|
||||
minPortTimeoutText.setText(Integer.toString(scannerConfig.minPortTimeout));
|
||||
minPortTimeoutText.setEnabled(scannerConfig.adaptPortTimeout);
|
||||
portsText.setText(scannerConfig.portString);
|
||||
notAvailableText.setText(scannerConfig.notAvailableText);
|
||||
notScannedText.setText(scannerConfig.notScannedText);
|
||||
displayMethod[guiConfig.displayMethod.ordinal()].setSelection(true);
|
||||
showInfoCheckbox.setSelection(guiConfig.showScanStats);
|
||||
askConfirmationCheckbox.setSelection(guiConfig.askScanConfirmation);
|
||||
}
|
||||
|
||||
private void savePreferences() {
|
||||
@ -417,31 +420,31 @@ public class PreferencesDialog extends AbstractModalDialog {
|
||||
throw new FetcherException("unparseablePortString", e);
|
||||
}
|
||||
|
||||
globalConfig.selectedPinger = (String) pingersCombo.getData(Integer.toString(pingersCombo.getSelectionIndex()));
|
||||
scannerConfig.selectedPinger = (String) pingersCombo.getData(Integer.toString(pingersCombo.getSelectionIndex()));
|
||||
if (!pingerRegistry.checkSelectedPinger()) {
|
||||
tabFolder.setSelection(scanningTabItem);
|
||||
pingersCombo.forceFocus();
|
||||
throw new FetcherException("unsupportedPinger");
|
||||
}
|
||||
|
||||
globalConfig.maxThreads = parseIntValue(maxThreadsText);
|
||||
globalConfig.threadDelay = parseIntValue(threadDelayText);
|
||||
globalConfig.pingCount = parseIntValue(pingingCountText);
|
||||
globalConfig.pingTimeout = parseIntValue(pingingTimeoutText);
|
||||
globalConfig.scanDeadHosts = deadHostsCheckbox.getSelection();
|
||||
globalConfig.skipBroadcastAddresses = skipBroadcastsCheckbox.getSelection();
|
||||
globalConfig.portTimeout = parseIntValue(portTimeoutText);
|
||||
globalConfig.adaptPortTimeout = adaptTimeoutCheckbox.getSelection();
|
||||
globalConfig.minPortTimeout = parseIntValue(minPortTimeoutText);
|
||||
globalConfig.portString = portsText.getText();
|
||||
globalConfig.notAvailableText = notAvailableText.getText();
|
||||
globalConfig.notScannedText = notScannedText.getText();
|
||||
scannerConfig.maxThreads = parseIntValue(maxThreadsText);
|
||||
scannerConfig.threadDelay = parseIntValue(threadDelayText);
|
||||
scannerConfig.pingCount = parseIntValue(pingingCountText);
|
||||
scannerConfig.pingTimeout = parseIntValue(pingingTimeoutText);
|
||||
scannerConfig.scanDeadHosts = deadHostsCheckbox.getSelection();
|
||||
scannerConfig.skipBroadcastAddresses = skipBroadcastsCheckbox.getSelection();
|
||||
scannerConfig.portTimeout = parseIntValue(portTimeoutText);
|
||||
scannerConfig.adaptPortTimeout = adaptTimeoutCheckbox.getSelection();
|
||||
scannerConfig.minPortTimeout = parseIntValue(minPortTimeoutText);
|
||||
scannerConfig.portString = portsText.getText();
|
||||
scannerConfig.notAvailableText = notAvailableText.getText();
|
||||
scannerConfig.notScannedText = notScannedText.getText();
|
||||
for (int i = 0; i < displayMethod.length; i++) {
|
||||
if (displayMethod[i].getSelection())
|
||||
globalConfig.displayMethod = DisplayMethod.values()[i];
|
||||
guiConfig.displayMethod = DisplayMethod.values()[i];
|
||||
}
|
||||
globalConfig.showScanStats = showInfoCheckbox.getSelection();
|
||||
globalConfig.askScanConfirmation = askConfirmationCheckbox.getSelection();
|
||||
guiConfig.showScanStats = showInfoCheckbox.getSelection();
|
||||
guiConfig.askScanConfirmation = askConfirmationCheckbox.getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -492,7 +495,7 @@ public class PreferencesDialog extends AbstractModalDialog {
|
||||
|
||||
class CheckButtonListener implements Listener {
|
||||
public void handleEvent(Event event) {
|
||||
globalConfig.maxThreads = Integer.parseInt(maxThreadsText.getText());
|
||||
scannerConfig.maxThreads = Integer.parseInt(maxThreadsText.getText());
|
||||
configDetectorDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ package net.azib.ipscan.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningResult;
|
||||
import net.azib.ipscan.core.ScanningResultList;
|
||||
@ -37,6 +37,7 @@ import org.eclipse.swt.widgets.TableItem;
|
||||
public class ResultTable extends Table implements FetcherRegistryUpdateListener {
|
||||
|
||||
private ScanningResultList scanningResults;
|
||||
private GUIConfig guiConfig;
|
||||
|
||||
private Image[] listImages = new Image[ResultType.values().length];
|
||||
|
||||
@ -44,8 +45,9 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
|
||||
private Listener columnResizeListener;
|
||||
|
||||
public ResultTable(Composite parent, FetcherRegistry fetcherRegistry, ScanningResultList scanningResultList, StateMachine stateMachine, ColumnsActions.ColumnClick columnClickListener, ColumnsActions.ColumnResize columnResizeListener, ToolsActions.TableSelection selectionListener) {
|
||||
public ResultTable(Composite parent, GUIConfig guiConfig, FetcherRegistry fetcherRegistry, ScanningResultList scanningResultList, StateMachine stateMachine, ColumnsActions.ColumnClick columnClickListener, ColumnsActions.ColumnResize columnResizeListener, ToolsActions.TableSelection selectionListener) {
|
||||
super(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
|
||||
this.guiConfig = guiConfig;
|
||||
this.scanningResults = scanningResultList;
|
||||
|
||||
setHeaderVisible(true);
|
||||
@ -90,7 +92,7 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
for (Fetcher fetcher : fetcherRegistry.getSelectedFetchers()) {
|
||||
TableColumn tableColumn = new TableColumn(this, SWT.NONE);
|
||||
String fetcherName = Labels.getLabel(fetcher.getLabel());
|
||||
tableColumn.setWidth(Config.getDimensionsConfig().getColumnWidth(fetcherName));
|
||||
tableColumn.setWidth(guiConfig.getColumnWidth(fetcherName));
|
||||
tableColumn.setText(fetcherName);
|
||||
tableColumn.setData(fetcher); // this is used in some listeners in ColumnsActions
|
||||
tableColumn.addListener(SWT.Selection, columnClickListener);
|
||||
@ -99,7 +101,7 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
}
|
||||
|
||||
protected void checkSubclass() {
|
||||
// This method is overriden and does nothing in order to
|
||||
// This method is overridden and does nothing in order to
|
||||
// be able to subclass the Table. We are not going to
|
||||
// override anything important, so this should be safe (tm)
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.gui.util.LayoutHelper;
|
||||
|
||||
@ -31,10 +31,10 @@ public class StatusBar {
|
||||
private Label threadsText;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private GlobalConfig globalConfig;
|
||||
private GUIConfig guiConfig;
|
||||
|
||||
public StatusBar(Shell shell, GlobalConfig globalConfig) {
|
||||
this.globalConfig = globalConfig;
|
||||
public StatusBar(Shell shell, GUIConfig guiConfig) {
|
||||
this.guiConfig = guiConfig;
|
||||
|
||||
composite = new Composite(shell, SWT.NONE);
|
||||
FormData formData = new FormData();
|
||||
@ -67,7 +67,7 @@ public class StatusBar {
|
||||
* Updates config text according to the latest changes in the GlobalConfig
|
||||
*/
|
||||
public void updateConfigText() {
|
||||
configText.setText(Labels.getLabel("text.display." + globalConfig.displayMethod));
|
||||
configText.setText(Labels.getLabel("text.display." + guiConfig.displayMethod));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7,7 +7,7 @@ package net.azib.ipscan.gui.actions;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.Platform;
|
||||
import net.azib.ipscan.core.ScanningResultList;
|
||||
@ -38,6 +38,12 @@ import org.eclipse.swt.widgets.TableColumn;
|
||||
public class ColumnsActions {
|
||||
|
||||
public static final class ColumnResize implements Listener {
|
||||
private GUIConfig guiConfig;
|
||||
|
||||
public ColumnResize(GUIConfig guiConfig) {
|
||||
this.guiConfig = guiConfig;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
TableColumn column = (TableColumn) event.widget;
|
||||
// do not save the width of the last column on Linux, because in GTK
|
||||
@ -46,7 +52,7 @@ public class ColumnsActions {
|
||||
return;
|
||||
|
||||
// save column width
|
||||
Config.getDimensionsConfig().setColumnWidth(column.getText(), column.getWidth());
|
||||
guiConfig.setColumnWidth(column.getText(), column.getWidth());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ package net.azib.ipscan.gui.actions;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScannerThread;
|
||||
import net.azib.ipscan.core.ScannerThreadFactory;
|
||||
@ -41,7 +41,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
|
||||
private ScannerThreadFactory scannerThreadFactory;
|
||||
private ScannerThread scannerThread;
|
||||
private GlobalConfig globalConfig;
|
||||
private GUIConfig guiConfig;
|
||||
private PingerRegistry pingerRegistry;
|
||||
|
||||
private StatusBar statusBar;
|
||||
@ -59,7 +59,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
* Creates internal stuff independent from all other external dependencies
|
||||
*/
|
||||
StartStopScanningAction() {
|
||||
// pre-load button images
|
||||
// preload button images
|
||||
buttonImages[ScanningState.IDLE.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.start.img"));
|
||||
buttonImages[ScanningState.SCANNING.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.stop.img"));
|
||||
buttonImages[ScanningState.STARTING.ordinal()] = buttonImages[ScanningState.SCANNING.ordinal()];
|
||||
@ -67,7 +67,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
buttonImages[ScanningState.STOPPING.ordinal()] = new Image(null, Labels.getInstance().getImageAsStream("button.kill.img"));
|
||||
buttonImages[ScanningState.KILLING.ordinal()] = buttonImages[ScanningState.STOPPING.ordinal()];
|
||||
|
||||
// pre-load button texts
|
||||
// preload button texts
|
||||
buttonTexts[ScanningState.IDLE.ordinal()] = Labels.getLabel("button.start");
|
||||
buttonTexts[ScanningState.SCANNING.ordinal()] = Labels.getLabel("button.stop");
|
||||
buttonTexts[ScanningState.STARTING.ordinal()] = buttonTexts[ScanningState.SCANNING.ordinal()];
|
||||
@ -76,7 +76,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
buttonTexts[ScanningState.KILLING.ordinal()] = Labels.getLabel("button.kill");
|
||||
}
|
||||
|
||||
public StartStopScanningAction(ScannerThreadFactory scannerThreadFactory, StateMachine stateMachine, ResultTable resultTable, StatusBar statusBar, FeederGUIRegistry feederRegistry, PingerRegistry pingerRegistry, Button startStopButton, GlobalConfig globalConfig) {
|
||||
public StartStopScanningAction(ScannerThreadFactory scannerThreadFactory, StateMachine stateMachine, ResultTable resultTable, StatusBar statusBar, FeederGUIRegistry feederRegistry, PingerRegistry pingerRegistry, Button startStopButton, GUIConfig guiConfig) {
|
||||
this();
|
||||
|
||||
this.scannerThreadFactory = scannerThreadFactory;
|
||||
@ -87,12 +87,12 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
this.button = startStopButton;
|
||||
this.display = button.getDisplay();
|
||||
this.stateMachine = stateMachine;
|
||||
this.globalConfig = globalConfig;
|
||||
this.guiConfig = guiConfig;
|
||||
|
||||
// add listeners to all state changes
|
||||
stateMachine.addTransitionListener(this);
|
||||
|
||||
// set the defaultimage
|
||||
// set the default image
|
||||
ScanningState state = stateMachine.getState();
|
||||
button.setImage(buttonImages[state.ordinal()]);
|
||||
button.setText(buttonTexts[state.ordinal()]);
|
||||
@ -123,7 +123,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
pingerRegistry.checkSelectedPinger();
|
||||
|
||||
// ask user for confirmation if needed
|
||||
if (globalConfig.askScanConfirmation && resultTable.getItemCount() > 0) {
|
||||
if (guiConfig.askScanConfirmation && resultTable.getItemCount() > 0) {
|
||||
MessageBox box = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
|
||||
box.setText(Labels.getLabel("text.scan.new"));
|
||||
box.setMessage(Labels.getLabel("text.scan.confirmation"));
|
||||
@ -196,7 +196,7 @@ public class StartStopScanningAction implements SelectionListener, ScanningProgr
|
||||
* @return the appropriate ResultsCallback instance, depending on the configured display method.
|
||||
*/
|
||||
private final ScanningResultsCallback createResultsCallback() {
|
||||
switch (globalConfig.displayMethod) {
|
||||
switch (guiConfig.displayMethod) {
|
||||
default: return new ScanningResultsCallback() {
|
||||
public void prepareForResults(ScanningResult result) {
|
||||
resultTable.addOrUpdateResultRow(result);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui.actions;
|
||||
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningResultList;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
@ -69,10 +69,10 @@ public class ToolsActions {
|
||||
public static final class ScanInfo implements Listener, StateTransitionListener {
|
||||
|
||||
private final StatisticsDialog statisticsDialog;
|
||||
private final GlobalConfig globalConfig;
|
||||
private final GUIConfig guiConfig;
|
||||
|
||||
public ScanInfo(GlobalConfig globalConfig, StatisticsDialog statisticsDialog, StateMachine stateMachine) {
|
||||
this.globalConfig = globalConfig;
|
||||
public ScanInfo(GUIConfig guiConfig, StatisticsDialog statisticsDialog, StateMachine stateMachine) {
|
||||
this.guiConfig = guiConfig;
|
||||
this.statisticsDialog = statisticsDialog;
|
||||
// register for state changes
|
||||
stateMachine.addTransitionListener(this);
|
||||
@ -84,7 +84,7 @@ public class ToolsActions {
|
||||
|
||||
public void transitionTo(ScanningState state) {
|
||||
// switching to IDLE means the end of scanning
|
||||
if (state == ScanningState.IDLE && globalConfig.showScanStats) {
|
||||
if (state == ScanningState.IDLE && guiConfig.showScanStats) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
handleEvent(null);
|
||||
|
||||
@ -9,15 +9,15 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.GUIConfig;
|
||||
import net.azib.ipscan.feeders.Feeder;
|
||||
import net.azib.ipscan.feeders.FeederException;
|
||||
import net.azib.ipscan.feeders.RescanFeeder;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
|
||||
/**
|
||||
* FeederGUIRegistry
|
||||
*
|
||||
@ -25,14 +25,16 @@ import net.azib.ipscan.feeders.RescanFeeder;
|
||||
*/
|
||||
public class FeederGUIRegistry implements Iterable<AbstractFeederGUI> {
|
||||
|
||||
private List<AbstractFeederGUI> feederGUIList;
|
||||
private Combo feederSelectionCombo;
|
||||
private final List<AbstractFeederGUI> feederGUIList;
|
||||
private final Combo feederSelectionCombo;
|
||||
private final GUIConfig guiConfig;
|
||||
|
||||
private AbstractFeederGUI currentFeederGUI;
|
||||
|
||||
public FeederGUIRegistry(AbstractFeederGUI[] allTheFeeders, Combo feederSelectionCombo) {
|
||||
public FeederGUIRegistry(AbstractFeederGUI[] allTheFeeders, Combo feederSelectionCombo, GUIConfig guiConfig) {
|
||||
this.feederGUIList = Arrays.asList(allTheFeeders);
|
||||
this.feederSelectionCombo = feederSelectionCombo;
|
||||
this.guiConfig = guiConfig;
|
||||
this.currentFeederGUI = allTheFeeders[0];
|
||||
}
|
||||
|
||||
@ -49,7 +51,7 @@ public class FeederGUIRegistry implements Iterable<AbstractFeederGUI> {
|
||||
|
||||
// get new feeder
|
||||
currentFeederGUI = feederGUIList.get(newActiveFeeder);
|
||||
Config.getGlobal().activeFeeder = newActiveFeeder;
|
||||
guiConfig.activeFeeder = newActiveFeeder;
|
||||
|
||||
// make new feeder visible
|
||||
currentFeederGUI.setVisible(true);
|
||||
|
||||
@ -5,7 +5,6 @@ package net.azib.ipscan.config;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -13,14 +12,13 @@ import org.junit.Test;
|
||||
*/
|
||||
public class ConfigTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void globalSetUp() throws Exception {
|
||||
Config.initialize();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitialize() {
|
||||
assertNotNull(Config.getPreferences());
|
||||
assertNotNull(Config.getGlobal());
|
||||
public void testGetters() {
|
||||
Config config = Config.getConfig();
|
||||
assertNotNull(config.getPreferences());
|
||||
assertNotNull(config.getScanner());
|
||||
assertNotNull(config.getGUI());
|
||||
assertNotNull(config.getFavorites());
|
||||
assertNotNull(config.getOpeners());
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,16 +17,16 @@ import org.junit.Test;
|
||||
*
|
||||
* @author Anton Keks
|
||||
*/
|
||||
public class DimensionsConfigTest {
|
||||
public class GUIConfigTest {
|
||||
|
||||
private Preferences preferences;
|
||||
private DimensionsConfig config;
|
||||
private GUIConfig config;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
preferences = Preferences.userRoot().node("ipscan-test");
|
||||
preferences.clear();
|
||||
config = new DimensionsConfig(preferences);
|
||||
config = new GUIConfig(preferences);
|
||||
}
|
||||
|
||||
@After
|
||||
@ -17,7 +17,6 @@ import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
import net.azib.ipscan.core.values.NotAvailableValue;
|
||||
import net.azib.ipscan.core.values.NotScannedValue;
|
||||
@ -42,8 +41,6 @@ public class ScannerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Config.initialize();
|
||||
|
||||
fetcherRegistry = createMock(FetcherRegistry.class);
|
||||
expect(fetcherRegistry.getSelectedFetchers()).andReturn(
|
||||
Arrays.asList(new Fetcher[] {new FakeFetcher(), new AnotherFakeFetcher(), new AbortingFetcher(), new FailingFetcher()})
|
||||
|
||||
@ -20,7 +20,6 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningResult.ResultType;
|
||||
import net.azib.ipscan.core.ScanningResultList.ScanInfo;
|
||||
@ -297,8 +296,6 @@ public class ScanningResultListTest {
|
||||
|
||||
@Test
|
||||
public void testFindText() throws Exception {
|
||||
Config.initialize();
|
||||
|
||||
scanningResults.registerAtIndex(0, scanningResults.createResult(InetAddress.getByName("127.9.9.1")));
|
||||
scanningResults.getResult(0).setValue(1, NotScannedValue.INSTANCE);
|
||||
scanningResults.registerAtIndex(1, scanningResults.createResult(InetAddress.getByName("127.9.9.2")));
|
||||
|
||||
@ -9,7 +9,7 @@ import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.GlobalConfig;
|
||||
import net.azib.ipscan.config.ScannerConfig;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.fetchers.FetcherException;
|
||||
|
||||
@ -55,8 +55,7 @@ public class PingerRegistryImplTest {
|
||||
}
|
||||
|
||||
public void testCreateDefaultPinger() throws Exception {
|
||||
Config.initialize();
|
||||
GlobalConfig config = Config.getGlobal();
|
||||
ScannerConfig config = Config.getConfig().getScanner();
|
||||
PingerRegistry registry = new PingerRegistryImpl(config);
|
||||
config.selectedPinger = "pinger.udp";
|
||||
assertTrue(registry.createPinger() instanceof UDPPinger);
|
||||
@ -64,8 +63,7 @@ public class PingerRegistryImplTest {
|
||||
|
||||
@Test
|
||||
public void checkSelectedPinger() throws Exception {
|
||||
Config.initialize();
|
||||
GlobalConfig config = Config.getGlobal();
|
||||
ScannerConfig config = Config.getConfig().getScanner();
|
||||
PingerRegistryImpl registry = new PingerRegistryImpl(config);
|
||||
|
||||
config.selectedPinger = "pinger.udp";
|
||||
|
||||
@ -23,8 +23,7 @@ public class NotAvailableValueTest {
|
||||
|
||||
@Test
|
||||
public void testToString() throws Exception {
|
||||
Config.initialize();
|
||||
assertEquals(Config.getGlobal().notAvailableText, NotAvailableValue.INSTANCE.toString());
|
||||
assertEquals(Config.getConfig().getScanner().notAvailableText, NotAvailableValue.INSTANCE.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -23,8 +23,7 @@ public class NotScannedValueTest {
|
||||
|
||||
@Test
|
||||
public void testToString() throws Exception {
|
||||
Config.initialize();
|
||||
assertEquals(Config.getGlobal().notScannedText, NotScannedValue.INSTANCE.toString());
|
||||
assertEquals(Config.getConfig().getScanner().notScannedText, NotScannedValue.INSTANCE.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -3,12 +3,10 @@
|
||||
*/
|
||||
package net.azib.ipscan.fetchers;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import net.azib.ipscan.config.Config;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -21,12 +19,6 @@ public abstract class AbstractFetcherTestCase {
|
||||
|
||||
Fetcher fetcher;
|
||||
|
||||
@BeforeClass
|
||||
public static void globalSetUp() {
|
||||
// some fetchers are Configurable and therefore need an initialized Config
|
||||
Config.initialize();
|
||||
}
|
||||
|
||||
@Before
|
||||
public abstract void setUp() throws Exception;
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ public class PingFetcherTest extends AbstractFetcherTestCase {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
fetcher = new PingFetcher(null, Config.getGlobal());
|
||||
fetcher = new PingFetcher(null, Config.getConfig().getScanner());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public class PingTTLFetcherTest extends AbstractFetcherTestCase {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
fetcher = new PingTTLFetcher(null, Config.getGlobal());
|
||||
fetcher = new PingTTLFetcher(null, Config.getConfig().getScanner());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public class PortsFetcherTest extends AbstractFetcherTestCase {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
fetcher = new PortsFetcher(Config.getGlobal());
|
||||
fetcher = new PortsFetcher(Config.getConfig().getScanner());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@ import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningResult;
|
||||
import net.azib.ipscan.core.ScanningResultList;
|
||||
@ -25,7 +24,6 @@ import net.azib.ipscan.feeders.Feeder;
|
||||
import net.azib.ipscan.fetchers.Fetcher;
|
||||
import net.azib.ipscan.fetchers.FetcherRegistry;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -35,11 +33,6 @@ import org.junit.Test;
|
||||
*/
|
||||
public class OpenerLauncherTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Config.initialize();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplaceValues() throws UnknownHostException {
|
||||
FetcherRegistry fetcherRegistry = createMock(FetcherRegistry.class);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user