mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
Goto functionality implemented (including searching)
git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/ipscan@3 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
parent
13ea42acd4
commit
cfc7968694
@ -9,7 +9,7 @@
|
||||
<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
|
||||
<classpathentry kind="lib" path="ext/rocksaw/lib/tmp.jar">
|
||||
<attributes>
|
||||
<attribute value="ipscan3/ext/rocksaw/lib" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/>
|
||||
<attribute value="ipscan/ext/rocksaw/lib" name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry sourcepath="/swt/src" kind="lib" path="/swt/swt-gtk.jar">
|
||||
|
||||
@ -9,7 +9,6 @@ menu.goto=&Go to
|
||||
menu.goto.aliveHost=Next alive &host Ctrl+H
|
||||
menu.goto.deadHost=Next d&ead host Ctrl+E
|
||||
menu.goto.openPort=Next open &port Ctrl+P
|
||||
menu.goto.closedPort=Next &closed port Ctrl+L
|
||||
menu.goto.find=Find... Ctrl+F
|
||||
menu.commands=&Commands
|
||||
menu.commands.details=&Show details Dbl-Clk
|
||||
@ -44,6 +43,7 @@ state.scanning=Scanning
|
||||
state.waitForThreads=Wait for all threads to terminate...
|
||||
state.killingThreads=Killing all threads...
|
||||
state.saving=Exporting results...
|
||||
state.searching=Searching...
|
||||
title.about=About
|
||||
title.options=Options
|
||||
title.options.scanning=Scanning
|
||||
@ -56,10 +56,14 @@ title.saveSelection=Export Selected Results
|
||||
title.gettingStarted=Getting Started
|
||||
title.favorite.add=Add a favorite
|
||||
title.favorite.edit=Edit favorites
|
||||
title.find=Find
|
||||
text.ip=IP
|
||||
text.threads=Threads:
|
||||
text.favorite.add=Enter the name of the new favorite
|
||||
text.favorite.edit=Below you can rearrange or delete favorites
|
||||
text.find=Enter the text to search for
|
||||
text.find.notFound=Nothing was found.
|
||||
text.find.restart=Would you like to start from the beginning?
|
||||
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.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.
|
||||
text.gettingStarted2=Main terminology:\n\nFeeder - generator of IP addresses for scanning. Angry IP Scanner provides various kinds of feeders: IP Range, Random, and IP List File. You can select a feeder using the combo box next to the "Start" button.\n\nFetcher - gathers specific information about a host, e.g. ping time, hostname, open ports. Feeders usually represent columns in the scanning results list.
|
||||
|
||||
@ -27,10 +27,16 @@ public class ScanningResult {
|
||||
this.type = resultType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanning results as List, result of each Fetcher is an element
|
||||
*/
|
||||
public List getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the scanning result type, see constants in {@link ScanningSubject}
|
||||
*/
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public class InputDialog {
|
||||
Display currentDisplay = Display.getCurrent();
|
||||
Shell parent = currentDisplay != null ? currentDisplay.getActiveShell() : null;
|
||||
|
||||
shell = new Shell(parent);
|
||||
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
|
||||
shell.setSize(new Point(300, 112));
|
||||
shell.setLayout(null);
|
||||
messageLabel = new Label(shell, SWT.NONE);
|
||||
|
||||
@ -4,10 +4,12 @@
|
||||
package net.azib.ipscan.gui;
|
||||
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningSubject;
|
||||
import net.azib.ipscan.gui.actions.ColumnsActions;
|
||||
import net.azib.ipscan.gui.actions.CommandsActions;
|
||||
import net.azib.ipscan.gui.actions.FavoritesActions;
|
||||
import net.azib.ipscan.gui.actions.FileActions;
|
||||
import net.azib.ipscan.gui.actions.GotoActions;
|
||||
import net.azib.ipscan.gui.actions.HelpActions;
|
||||
import net.azib.ipscan.gui.actions.ToolsActions;
|
||||
|
||||
@ -74,12 +76,11 @@ public class MainMenu {
|
||||
},
|
||||
new Object[] {"menu.goto",
|
||||
new Object[] {
|
||||
new Object[] {"menu.goto.aliveHost", new Integer(SWT.CONTROL | 'H'), null},
|
||||
new Object[] {"menu.goto.deadHost", new Integer(SWT.CONTROL | 'E'), null},
|
||||
new Object[] {"menu.goto.openPort", new Integer(SWT.CONTROL | 'P'), null},
|
||||
new Object[] {"menu.goto.closedPort", new Integer(SWT.CONTROL | 'L'), null},
|
||||
new Object[] {"menu.goto.aliveHost", new Integer(SWT.CONTROL | 'H'), new GotoActions.NextHost(mainWindow, ScanningSubject.RESULT_TYPE_ALIVE)},
|
||||
new Object[] {"menu.goto.deadHost", new Integer(SWT.CONTROL | 'E'), new GotoActions.NextHost(mainWindow, ScanningSubject.RESULT_TYPE_DEAD)},
|
||||
new Object[] {"menu.goto.openPort", new Integer(SWT.CONTROL | 'P'), new GotoActions.NextHost(mainWindow, ScanningSubject.RESULT_TYPE_ADDITIONAL_INFO)},
|
||||
null,
|
||||
new Object[] {"menu.goto.find", new Integer(SWT.CONTROL | 'F'), null},
|
||||
new Object[] {"menu.goto.find", new Integer(SWT.CONTROL | 'F'), new GotoActions.Find(mainWindow)},
|
||||
}
|
||||
},
|
||||
new Object[] {"menu.commands",
|
||||
|
||||
140
src/net/azib/ipscan/gui/actions/GotoActions.java
Executable file
140
src/net/azib/ipscan/gui/actions/GotoActions.java
Executable file
@ -0,0 +1,140 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package net.azib.ipscan.gui.actions;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.azib.ipscan.config.Labels;
|
||||
import net.azib.ipscan.core.ScanningResult;
|
||||
import net.azib.ipscan.core.ScanningResultList;
|
||||
import net.azib.ipscan.gui.InputDialog;
|
||||
import net.azib.ipscan.gui.MainWindow;
|
||||
import net.azib.ipscan.gui.ResultTable;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
|
||||
/**
|
||||
* GotoActions
|
||||
*
|
||||
* @author anton
|
||||
*/
|
||||
public class GotoActions {
|
||||
|
||||
public static class NextHost implements Listener {
|
||||
|
||||
private MainWindow mainWindow;
|
||||
private int whatToSearchFor;
|
||||
|
||||
public NextHost(MainWindow mainWindow, int whatToSearchFor) {
|
||||
this.mainWindow = mainWindow;
|
||||
this.whatToSearchFor = whatToSearchFor;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
ResultTable resultTable = mainWindow.getResultTable();
|
||||
ScanningResultList results = resultTable.getScanningResults();
|
||||
|
||||
int numElements = resultTable.getItemCount();
|
||||
int startElement = resultTable.getSelectionIndex() + 1;
|
||||
|
||||
for (int i = startElement; i < numElements; i++) {
|
||||
ScanningResult scanningResult = results.getResult(i);
|
||||
|
||||
if (scanningResult.getType() == whatToSearchFor) {
|
||||
resultTable.setSelection(i);
|
||||
resultTable.setFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (startElement > 0) {
|
||||
resultTable.deselectAll();
|
||||
handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Find implements Listener {
|
||||
|
||||
private MainWindow mainWindow;
|
||||
private String lastText = "";
|
||||
|
||||
public Find(MainWindow mainWindow) {
|
||||
this.mainWindow = mainWindow;
|
||||
}
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
|
||||
InputDialog dialog = new InputDialog(Labels.getInstance().getString("title.find"), Labels.getInstance().getString("text.find"));
|
||||
dialog.setText(lastText);
|
||||
String text = dialog.open();
|
||||
if (text == null) {
|
||||
return;
|
||||
}
|
||||
lastText = text;
|
||||
|
||||
try {
|
||||
mainWindow.setStatusText(Labels.getInstance().getString("state.searching"));
|
||||
|
||||
findText(text);
|
||||
}
|
||||
finally {
|
||||
mainWindow.setStatusText(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void findText(String text) {
|
||||
|
||||
ResultTable resultTable = mainWindow.getResultTable();
|
||||
ScanningResultList results = resultTable.getScanningResults();
|
||||
|
||||
int numElements = resultTable.getItemCount();
|
||||
int startElement = resultTable.getSelectionIndex() + 1;
|
||||
|
||||
for (int i = startElement; i < numElements; i++) {
|
||||
ScanningResult scanningResult = results.getResult(i);
|
||||
|
||||
List values = scanningResult.getValues();
|
||||
|
||||
for (Iterator j = values.iterator(); j.hasNext();) {
|
||||
String value = (String) j.next();
|
||||
|
||||
// TODO: case-insensitive search
|
||||
if (value != null && value.indexOf(text) >= 0) {
|
||||
resultTable.setSelection(i);
|
||||
resultTable.setFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (startElement > 0) {
|
||||
MessageBox messageBox = new MessageBox(mainWindow.getShell(), SWT.YES | SWT.NO | SWT.ICON_QUESTION);
|
||||
messageBox.setText(Labels.getInstance().getString("title.find"));
|
||||
messageBox.setMessage(Labels.getInstance().getString("text.find.notFound") + " " + Labels.getInstance().getString("text.find.restart"));
|
||||
if (messageBox.open() == SWT.YES) {
|
||||
resultTable.deselectAll();
|
||||
findText(text);
|
||||
}
|
||||
}
|
||||
else {
|
||||
MessageBox messageBox = new MessageBox(mainWindow.getShell(), SWT.OK | SWT.ICON_INFORMATION);
|
||||
messageBox.setText(Labels.getInstance().getString("title.find"));
|
||||
messageBox.setMessage(Labels.getInstance().getString("text.find.notFound"));
|
||||
messageBox.open();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user