mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
Fetcher info and Fetcher options context menu items implemented.
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@115 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
873b547ff0
commit
a5782f9e42
@ -39,7 +39,7 @@ menu.help.about=&About...
|
||||
menu.columns.sortBy=Sort by
|
||||
menu.columns.sortDirection=Change sort direction
|
||||
menu.columns.info=Fetcher info
|
||||
menu.columns.options=Fetcher options
|
||||
menu.columns.options=Fetcher options...
|
||||
state.ready=Ready
|
||||
state.scanning=Scanning
|
||||
state.waitForThreads=Wait for all threads to terminate...
|
||||
@ -83,6 +83,8 @@ text.openers.hintText=You may use any scanned values returned by fetchers in the
|
||||
text.fetchers.select=Here you can select fetchers for scanning. Fetchers are represented by columns.
|
||||
text.fetchers.selectedList=Selected fetchers
|
||||
text.fetchers.availableList=Available fetchers
|
||||
text.fetchers.info=Fetcher information:
|
||||
text.fetchers.info.notAvailable=Unfortunately, no additional information about this fetcher is available.
|
||||
text.about=%NAME\n\nVersion %VERSION\n%COPYLEFT\n\n<a>%WEBSITE</a>\n<a>%MAILTO</a>\n\nThis is an Open Source Software released under the GPL.
|
||||
text.gettingStarted=Dummy
|
||||
text.gettingStarted1=Angry IP Scanner is an IP address scanner tool.\n\nIt is used for scanning IP addresses for finding alive hosts, gathering any kind of needed information about each host.
|
||||
@ -138,12 +140,19 @@ feeder.random.mask=IP Mask:
|
||||
feeder.random.hostname=Hostname:
|
||||
feeder.random.count=Count:
|
||||
fetcher.ip=IP
|
||||
fetcher.ip.info=Displays the scanned IP address.\nThis fetcher is mandatory and cannot be removed from the list.
|
||||
fetcher.ping=Ping
|
||||
fetcher.ping.info=Shows whether the host replies to ping requests and shows average packet roundtrip time to the host and back if it was detected (depending on the pinging method selected in the Options dialog).
|
||||
fetcher.ping.ttl=TTL
|
||||
fetcher.ping.ttl.info=Shows the TTL (Time To Live) value in response IP packets to pings.\n\nThis value is usually decremented by each node in the network that forwards the packet, so if initial value is guessable (usually 64, 128, or 255), then the difference shows the distance to the host (in number of hosts).
|
||||
fetcher.hostname=Hostname
|
||||
fetcher.hostname.info=Shows the hostname of the host obtained by the reverse DNS lookup.\n\nThis is the registered host name on the DNS server and may be different from the host name configured on the machine itself.
|
||||
fetcher.ports=Ports
|
||||
fetcher.ports.info=Shows the list of open ports from the ones that were scanned.\n\nA port is open when it is possible to complete TCP handshake with it and estabilish a connection.\nYou can select scanned ports in the Options dialog.
|
||||
fetcher.ports.filtered=Filtered Ports
|
||||
fetcher.ports.filtered.info=Shows the list of filtered ports from the ones that were scanned.\n\nA port is filtered when no response is being received to the connection attempt within specified amount of time. If a port is filtered, then it is probably blocked by a firewall.
|
||||
fetcher.comment=Comments
|
||||
fetcher.comment.info=Allows writing of comments for each host.\nThe comments are persisted and always shown then the host is scanned.
|
||||
fetcher.value.ms= ms
|
||||
fetcher.value.notAvailable=[n/a]
|
||||
fetcher.value.notScanned=[n/s]
|
||||
@ -177,6 +186,7 @@ exception.FeederException.random.invalidCount=Random address count must be great
|
||||
exception.FeederException.file.notExists=Specified file doesn't exist or you don't have permissions to read it
|
||||
exception.FeederException.file.errorWhileReading=Error while reading the file
|
||||
exception.FeederException.file.nothingFound=No IP addresses found in the file
|
||||
exception.FetcherException.options.notAvailable=This fetcher doesn't have any options.
|
||||
exception.ExporterException.failed=Exporting failed
|
||||
exception.ExporterException.exporter.unknown=Unknown file type, please specify correct extension in the file name.
|
||||
exception.ExporterException.xml.noAppend=Appending to XML files is not supported.
|
||||
|
||||
@ -139,6 +139,7 @@ public class ComponentRegistry {
|
||||
new ComponentParameter("mainShell"),
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter});
|
||||
container.registerComponentImplementation(StatusBar.class, StatusBar.class, new Parameter[] {
|
||||
new ComponentParameter("mainShell")});
|
||||
@ -150,6 +151,8 @@ public class ComponentRegistry {
|
||||
new ConstantParameter(container)});
|
||||
container.registerComponentImplementation(MainMenu.ColumnsMenu.class, MainMenu.ColumnsMenu.class, new Parameter[] {
|
||||
new ComponentParameter("mainShell"),
|
||||
anyComponentParameter,
|
||||
anyComponentParameter,
|
||||
anyComponentParameter});
|
||||
|
||||
container.registerComponentImplementation(OptionsDialog.class);
|
||||
@ -158,6 +161,10 @@ public class ComponentRegistry {
|
||||
// various actions / listener
|
||||
container.registerComponentImplementation(StartStopScanningAction.class);
|
||||
container.registerComponentImplementation(ColumnsActions.SortBy.class);
|
||||
container.registerComponentImplementation(ColumnsActions.FetcherOptions.class);
|
||||
container.registerComponentImplementation(ColumnsActions.FetcherInfo.class);
|
||||
container.registerComponentImplementation(ColumnsActions.ColumnClick.class);
|
||||
container.registerComponentImplementation(ColumnsActions.ColumnResize.class);
|
||||
}
|
||||
|
||||
public MainWindow createMainWindow() {
|
||||
|
||||
@ -77,7 +77,7 @@ public class ScanningResultList {
|
||||
details.append(fetcherName).append(":\t");
|
||||
Object value = iterator.next();
|
||||
details.append(value != null ? value : "");
|
||||
details.append(newLine).append("--------------------------------------------------------------------------------------").append(newLine);
|
||||
details.append(newLine);
|
||||
}
|
||||
return details.toString();
|
||||
}
|
||||
|
||||
@ -18,4 +18,12 @@ public class FetcherException extends RuntimeException {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public FetcherException(String label, Throwable cause) {
|
||||
super(label, cause);
|
||||
}
|
||||
|
||||
public FetcherException(String label) {
|
||||
super(label);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public class DetailsDialog extends AbstractModalDialog {
|
||||
private void createShell(Shell parent) {
|
||||
shell = new Shell(parent, SWT.TOOL | SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
|
||||
shell.setText(Labels.getLabel("title.details"));
|
||||
shell.setSize(new Point(300, 300));
|
||||
shell.setSize(new Point(300, 200));
|
||||
shell.setImage(parent.getImage());
|
||||
FillLayout fillLayout = new FillLayout();
|
||||
fillLayout.spacing = 3;
|
||||
@ -41,7 +41,7 @@ public class DetailsDialog extends AbstractModalDialog {
|
||||
fillLayout.marginWidth = 3;
|
||||
shell.setLayout(fillLayout);
|
||||
|
||||
Text detailsText = new Text(shell, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
Text detailsText = new Text(shell, SWT.BORDER | SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL);
|
||||
detailsText.setText(resultTable.getIPDetails());
|
||||
detailsText.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
|
||||
detailsText.setTabs(32);
|
||||
|
||||
@ -50,7 +50,7 @@ public class MainMenu {
|
||||
|
||||
container.registerComponentImplementation(CommandsActions.EditOpeners.class);
|
||||
container.registerComponentImplementation(CommandsActions.SelectOpener.class);
|
||||
container.registerComponentImplementation(CommandsActions.ShowOpenersMenu.class);
|
||||
container.registerComponentImplementation(CommandsActions.ShowOpenersMenu.class);
|
||||
// this one is not cached because we need 2 instances of it - in the Commands menu and in the context menu
|
||||
container.registerComponent(new ConstructorInjectionComponentAdapter(OpenersMenu.class, OpenersMenu.class));
|
||||
|
||||
@ -219,12 +219,12 @@ public class MainMenu {
|
||||
* This is the menu when clicking on a column header.
|
||||
*/
|
||||
public static class ColumnsMenu extends Menu {
|
||||
public ColumnsMenu(Decorations parent, ColumnsActions.SortBy sortByListener) {
|
||||
public ColumnsMenu(Decorations parent, ColumnsActions.SortBy sortByListener, ColumnsActions.FetcherInfo infoListener, ColumnsActions.FetcherOptions optionsListener) {
|
||||
super(parent, SWT.POP_UP);
|
||||
|
||||
initMenuItem(this, "menu.columns.sortBy", null, null, sortByListener);
|
||||
initMenuItem(this, "menu.columns.info", null, null, null);
|
||||
initMenuItem(this, "menu.columns.options", null, null, null);
|
||||
initMenuItem(this, "menu.columns.options", null, null, optionsListener);
|
||||
initMenuItem(this, "menu.columns.info", null, null, infoListener);
|
||||
}
|
||||
protected void checkSubclass() { } // allow extending of Menu class
|
||||
}
|
||||
|
||||
@ -60,9 +60,18 @@ public class OptionsDialog extends AbstractModalDialog {
|
||||
}
|
||||
|
||||
public void open() {
|
||||
openTab(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the specified tab of options dialog
|
||||
* @param tabIndex
|
||||
*/
|
||||
public void openTab(int tabIndex) {
|
||||
// widgets are created on demand
|
||||
createShell();
|
||||
loadOptions();
|
||||
tabFolder.setSelection(tabIndex);
|
||||
super.open();
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@ import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.fetchers.Fetcher;
|
||||
import net.azib.ipscan.fetchers.FetcherRegistry;
|
||||
import net.azib.ipscan.fetchers.FetcherRegistryUpdateListener;
|
||||
import net.azib.ipscan.gui.MainMenu.ColumnsMenu;
|
||||
import net.azib.ipscan.gui.actions.ColumnsActions;
|
||||
import net.azib.ipscan.gui.actions.CommandsActions;
|
||||
|
||||
@ -48,15 +47,15 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
|
||||
private Listener columnResizeListener;
|
||||
|
||||
public ResultTable(Composite parent, ColumnsMenu columnsMenu, FetcherRegistry fetcherRegistry, ScanningResultList scanningResultList) {
|
||||
public ResultTable(Composite parent, FetcherRegistry fetcherRegistry, ScanningResultList scanningResultList, ColumnsActions.ColumnClick columnClickListener, ColumnsActions.ColumnResize columnResizeListener) {
|
||||
super(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
|
||||
this.scanningResults = scanningResultList;
|
||||
|
||||
setHeaderVisible(true);
|
||||
setLinesVisible(true);
|
||||
|
||||
columnClickListener = new ColumnsActions.ColumnClick(columnsMenu);
|
||||
columnResizeListener = new ColumnsActions.ColumnResize();
|
||||
this.columnClickListener = columnClickListener;
|
||||
this.columnResizeListener = columnResizeListener;
|
||||
fetcherRegistry.addListener(this);
|
||||
handleUpdateOfSelectedFetchers(fetcherRegistry);
|
||||
|
||||
@ -103,6 +102,7 @@ public class ResultTable extends Table implements FetcherRegistryUpdateListener
|
||||
String fetcherName = Labels.getLabel(fetcher.getLabel());
|
||||
tableColumn.setWidth(Config.getDimensionsConfig().getColumnWidth(fetcherName));
|
||||
tableColumn.setText(fetcherName);
|
||||
tableColumn.setData(fetcher); // this is used in some listeners in ColumnsActions
|
||||
tableColumn.addListener(SWT.Selection, columnClickListener);
|
||||
tableColumn.addListener(SWT.Resize, columnResizeListener);
|
||||
}
|
||||
|
||||
@ -5,9 +5,16 @@
|
||||
*/
|
||||
package net.azib.ipscan.gui.actions;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
import net.azib.ipscan.config.Config;
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.config.Platform;
|
||||
import net.azib.ipscan.fetchers.Fetcher;
|
||||
import net.azib.ipscan.fetchers.FetcherException;
|
||||
import net.azib.ipscan.fetchers.PingFetcher;
|
||||
import net.azib.ipscan.fetchers.PortsFetcher;
|
||||
import net.azib.ipscan.gui.OptionsDialog;
|
||||
import net.azib.ipscan.gui.MainMenu.ColumnsMenu;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
@ -15,6 +22,7 @@ import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
@ -57,8 +65,8 @@ public class ColumnsActions {
|
||||
sortMenuItem.setText(Labels.getLabel("menu.columns.sortBy") + tableColumn.getText());
|
||||
}
|
||||
|
||||
// remember the clicked column (see SortBy below)
|
||||
sortMenuItem.setData(tableColumn);
|
||||
// remember the clicked column (see SortBy, FetcherOptions, and FetcherInfo below)
|
||||
columnsMenu.setData(tableColumn);
|
||||
|
||||
// show the menu
|
||||
columnsMenu.setLocation(e.display.getCursorLocation());
|
||||
@ -70,7 +78,7 @@ public class ColumnsActions {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
// retrieve the clicked column (see ColumnClick above)
|
||||
TableColumn tableColumn = (TableColumn) event.widget.getData();
|
||||
TableColumn tableColumn = (TableColumn) ((MenuItem)event.widget).getParent().getData();
|
||||
|
||||
Table table = tableColumn.getParent();
|
||||
|
||||
@ -84,7 +92,54 @@ public class ColumnsActions {
|
||||
|
||||
// TODO: execute ScanningResultList.sort() here!!!
|
||||
}
|
||||
}
|
||||
|
||||
public static class FetcherOptions implements Listener {
|
||||
|
||||
private OptionsDialog optionsDialog;
|
||||
|
||||
public FetcherOptions(OptionsDialog optionsDialog) {
|
||||
this.optionsDialog = optionsDialog;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
// retrieve the clicked column (see ColumnClick above)
|
||||
TableColumn tableColumn = (TableColumn) ((MenuItem)event.widget).getParent().getData();
|
||||
|
||||
Fetcher fetcher = (Fetcher) tableColumn.getData();
|
||||
|
||||
// some hardcodes here for 'special' fetchers
|
||||
if (fetcher instanceof PingFetcher) {
|
||||
optionsDialog.open();
|
||||
}
|
||||
else
|
||||
if (fetcher instanceof PortsFetcher) {
|
||||
optionsDialog.openTab(1);
|
||||
}
|
||||
else {
|
||||
throw new FetcherException("options.notAvailable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class FetcherInfo implements Listener {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
// retrieve the clicked column (see ColumnClick above)
|
||||
TableColumn tableColumn = (TableColumn) ((MenuItem)event.widget).getParent().getData();
|
||||
|
||||
Fetcher fetcher = (Fetcher) tableColumn.getData();
|
||||
|
||||
MessageBox messageBox = new MessageBox(event.display.getActiveShell(), SWT.ICON_INFORMATION);
|
||||
messageBox.setText(Labels.getLabel("text.fetchers.info") + Labels.getLabel(fetcher.getLabel()));
|
||||
try {
|
||||
messageBox.setMessage(Labels.getLabel(fetcher.getLabel() + ".info"));
|
||||
}
|
||||
catch (MissingResourceException e) {
|
||||
messageBox.setMessage(Labels.getLabel("text.fetchers.info.notAvailable"));
|
||||
}
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -20,14 +20,14 @@ public class ToolsActions {
|
||||
|
||||
public static class Options implements Listener {
|
||||
|
||||
private OptionsDialog optionsWindow;
|
||||
private OptionsDialog optionsDialog;
|
||||
|
||||
public Options(OptionsDialog optionsWindow) {
|
||||
this.optionsWindow = optionsWindow;
|
||||
public Options(OptionsDialog optionsDialog) {
|
||||
this.optionsDialog = optionsDialog;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
optionsWindow.open();
|
||||
optionsDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user