diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fd121d87..4f16afc7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,6 @@ +Changes in 3.7.1: +- Enable ICMP Echo pinger for Linux x64 only, as it requires the corresponding native .so implementation that is not available for Mac and not needed for Windows + Changes in 3.7.0: - Windows: use latest NSIS for installer generation, fixing DLL hijacking - Mac: dark mode support diff --git a/resources/messages.properties b/resources/messages.properties index db331f45..84c8040a 100644 --- a/resources/messages.properties +++ b/resources/messages.properties @@ -186,9 +186,8 @@ button.insert=&Insert button.add=&Add button.check=Chec&k... combobox.feeder.tooltip=IP Feeder selection. Change this if you need another source for IP addresses to scan -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL +pinger.icmp=ICMP Echo (root) +pinger.windows=Windows ICMP pinger.udp=UDP packet pinger.tcp=TCP port probe pinger.combined=Combined UDP+TCP @@ -271,7 +270,7 @@ preferences.ports.timing.adaptTimeout=Adapt timeout to ping roundtrip time (if a preferences.ports.timing.minTimeout=Minimal adapted connect timeout (in ms): preferences.ports.ports=Port selection preferences.ports.portsDescription=Specify ports to scan here. Ranges are supported.\nExample: 1-3,5,7,10-15,6000-6100\nIf many ports are specified, scanning can take a lot of time. -preferences.ports.addRequested=For each host, add requested specific ports +preferences.ports.addRequested=For each host, add requested ports from file feeder preferences.ports.addRequested.info=Feeders may support specifying requested ports in addition to addresses (e.g. File Feeder, in form of address:port)\nThis allows for rescanning of exported IP:Port list files. Can be useful for HTTP proxy lists and such.\nChecking this will always scan each host's requested ports in addition to the common ports specified above. preferences.display.list=Display in the results list preferences.display.list.ALL=All scanned hosts diff --git a/resources/messages_de.properties b/resources/messages_de.properties index 7f9585e3..f6a96e30 100644 --- a/resources/messages_de.properties +++ b/resources/messages_de.properties @@ -154,9 +154,6 @@ button.insert=Einf\u00fcgen button.add=Hinzuf\u00fcgen button.check=Pr\u00fcfen... combobox.feeder.tooltip=IP Auswahl. \u00c4ndern Sie dies, wenn Sie eine andere Quelle f\u00fcr IP-Addressen zum scannen ben\u00f6tigen -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP packet pinger.tcp=TCP port probe pinger.combined=Kombiniertes UDP+TCP diff --git a/resources/messages_es.properties b/resources/messages_es.properties index de7b7648..aca84292 100644 --- a/resources/messages_es.properties +++ b/resources/messages_es.properties @@ -149,9 +149,6 @@ button.insert=&Insertar button.add=&Agregar button.check=Chequea&r... combobox.feeder.tooltip=Selección de IP de origen. Cambie esto si necesita escanear otra IP. -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternativo) -pinger.windows=Windows ICMP.DLL pinger.udp=Paquete UDP pinger.tcp=Prueba de puertos TCP pinger.combined=Combinado UDP+TCP diff --git a/resources/messages_fr.properties b/resources/messages_fr.properties index 837064ce..a9b0d753 100644 --- a/resources/messages_fr.properties +++ b/resources/messages_fr.properties @@ -162,9 +162,6 @@ button.insert=&Insérer button.add=&Ajouter button.check=Chec&k... combobox.feeder.tooltip=IP Feeder selection. Change this if you need another source for IP addresses to scan -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP packet pinger.tcp=TCP port probe pinger.combined=Combined UDP+TCP diff --git a/resources/messages_gr.properties b/resources/messages_gr.properties index 06c7589a..9370d152 100644 --- a/resources/messages_gr.properties +++ b/resources/messages_gr.properties @@ -159,10 +159,6 @@ button.insert=&Εισαγωγή button.add=&Προσθήκη button.check=Έλεγχο&ς... combobox.feeder.tooltip=Επιλογή IP τροφοδότη. Άλλαξε το αν θέλεις να κάνεις χρήση μιας άλλης πηγής IP διευθύνσεων για σάρωση - -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Εναλλακτικό) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP πακέτο pinger.tcp=TCP port probe pinger.combined=Συνδυασμένο UDP+TCP diff --git a/resources/messages_hu.properties b/resources/messages_hu.properties index 7bcdf667..9c2265f5 100644 --- a/resources/messages_hu.properties +++ b/resources/messages_hu.properties @@ -155,9 +155,6 @@ button.insert=&Beszúrás button.add=&Hozzáadás button.check=Vizsgál... combobox.feeder.tooltip=IP Feeder selection. Change this if you need another source for IP addresses to scan -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternatív) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP csomag pinger.tcp=TCP port próba pinger.combined=Kombinált UDP+TCP diff --git a/resources/messages_it.properties b/resources/messages_it.properties index fe259d12..abd60cfb 100644 --- a/resources/messages_it.properties +++ b/resources/messages_it.properties @@ -167,9 +167,6 @@ button.insert=&Inserisci button.add=&Aggiungi button.check=C&ontrolla... combobox.feeder.tooltip=Selezione sorgente IP. Modifica questo se vuoi scansionare un'altra sorgente di indirizzi IP -pinger.icmp=ICMP echo -pinger.icmp2=ICMP echo (alternativo) -pinger.windows=ICMP.DLL di Windows pinger.udp=Pacchetto UDP pinger.tcp=Testa porta TCP pinger.combined=UDP+TCP combinato diff --git a/resources/messages_ku.properties b/resources/messages_ku.properties index d0ce67e9..ebfe0fb7 100644 --- a/resources/messages_ku.properties +++ b/resources/messages_ku.properties @@ -145,9 +145,6 @@ button.insert=&خستنه‌ ناو button.add=&زیاد کردن button.check=پشکنین... combobox.feeder.tooltip=ئای پی دۆزه‌ره‌وه‌ .ئه‌مه‌ بگۆره‌ ئه‌گه‌ر سه‌رچاوه‌ی تری ئای پی ده‌زانی -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP پاکه‌تی pinger.tcp=TCP پشکنینی ده‌روازه‌ی pinger.combined=Combined UDP+TCP diff --git a/resources/messages_lt.properties b/resources/messages_lt.properties index 509e0b11..da284f28 100644 --- a/resources/messages_lt.properties +++ b/resources/messages_lt.properties @@ -147,9 +147,6 @@ button.insert= &Įterpti button.add= &Papildyti button.check=Chec&k... combobox.feeder.tooltip=IP Feeder selection. Change this if you need another source for IP addresses to scan -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP packet pinger.tcp=TCP port probe pinger.combined=Combined UDP+TCP diff --git a/resources/messages_pt_BR.properties b/resources/messages_pt_BR.properties index 1f63d665..a34ee55c 100644 --- a/resources/messages_pt_BR.properties +++ b/resources/messages_pt_BR.properties @@ -167,9 +167,6 @@ button.insert=&Inserir button.add=&Adicionar button.check=&Verificar... combobox.feeder.tooltip=Seleção do alimentador de IP. Altere isto se você precisar de outra fonte para endereços IP para escanear -pinger.icmp=ICMP Echo -pinger.icmp2=ICMP Echo (Alternative) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP packet pinger.tcp=TCP port probe pinger.combined=Combinado UDP+TCP diff --git a/resources/messages_tr.properties b/resources/messages_tr.properties index 77c5eb81..8cc47bf2 100644 --- a/resources/messages_tr.properties +++ b/resources/messages_tr.properties @@ -165,9 +165,6 @@ button.insert=&Gir button.add=&Ekle button.check=Kontrol combobox.feeder.tooltip=IP besleyici seçimi. IP adreslerinin taraması için başka bir kaynağa gereksiniminiz varsa bunu değiştirin. -pinger.icmp=ICMP Yankısı -pinger.icmp2=ICMP Yankısı (Alternatif) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP paket pinger.tcp=TCP port izleme pinger.combined=Combined UDP+TCP diff --git a/resources/messages_zh_CN.properties b/resources/messages_zh_CN.properties index 7467d9a6..26178c39 100644 --- a/resources/messages_zh_CN.properties +++ b/resources/messages_zh_CN.properties @@ -166,8 +166,6 @@ button.add=添加 button.check=效验... combobox.feeder.tooltip=IP信息。如果需要其他IP地址进行扫描,请更改此项 pinger.icmp=ICMP请求 -pinger.icmp2=ICMP请求(备用) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP pinger.tcp=TCP pinger.combined=UDP+TCP diff --git a/resources/messages_zh_TW.properties b/resources/messages_zh_TW.properties index a7563f25..93c77f87 100644 --- a/resources/messages_zh_TW.properties +++ b/resources/messages_zh_TW.properties @@ -166,8 +166,6 @@ button.add=添加 button.check=效驗... combobox.feeder.tooltip=IP信息。如果需要其他IP位址進行掃描,請更改此項 pinger.icmp=ICMP請求 -pinger.icmp2=ICMP請求(備用) -pinger.windows=Windows ICMP.DLL pinger.udp=UDP pinger.tcp=TCP pinger.combined=UDP+TCP diff --git a/src/net/azib/ipscan/core/net/ICMPPinger.java b/src/net/azib/ipscan/core/net/ICMPPinger.java deleted file mode 100644 index e12b317d..00000000 --- a/src/net/azib/ipscan/core/net/ICMPPinger.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - This file is a part of Angry IP Scanner source code, - see http://www.angryip.org/ for more information. - Licensed under GPLv2. - */ -package net.azib.ipscan.core.net; - -import net.azib.ipscan.config.LoggerFactory; -import net.azib.ipscan.core.ScanningSubject; -import org.savarese.rocksaw.net.RawSocket; -import org.savarese.vserv.tcpip.ICMPEchoPacket; -import org.savarese.vserv.tcpip.ICMPPacket; -import org.savarese.vserv.tcpip.IPPacket; -import org.savarese.vserv.tcpip.OctetConverter; - -import java.io.IOException; -import java.io.InterruptedIOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.util.logging.Level; -import java.util.logging.Logger; - -import static net.azib.ipscan.util.IOUtils.closeQuietly; - -/** - * Pinging code is encapsulated here. - * - * @author Anton Keks - */ -public class ICMPPinger implements Pinger { - private static final Logger LOG = LoggerFactory.getLogger(); - - private int timeout; - - public ICMPPinger(int timeout) { - this.timeout = timeout; - } - - private RawSocket createRawSocket() throws IOException { - RawSocket socket = new RawSocket(); - socket.open(RawSocket.PF_INET, IPPacket.PROTOCOL_ICMP); - - try { - socket.setSendTimeout(timeout); - socket.setReceiveTimeout(timeout); - } - catch (java.net.SocketException se) { - socket.setUseSelectTimeout(true); - socket.setSendTimeout(timeout); - socket.setReceiveTimeout(timeout); - } - return socket; - } - - private void sendReceiveEchoPacket(RawSocket socket, InetAddress address, int sequence, PingResult result) throws IOException { - - ICMPEchoPacket packet = new ICMPEchoPacket(1); - byte[] data = new byte[84]; - packet.setData(data); - packet.setIPHeaderLength(5); - packet.setICMPDataByteLength(56); - packet.setType(ICMPPacket.TYPE_ECHO_REQUEST); - packet.setCode(0); - packet.setIdentifier(hashCode() & 0xFFFF); // some identification stuff - packet.setSequenceNumber(sequence); - - int offset = packet.getIPHeaderByteLength(); - int dataOffset = offset + packet.getICMPHeaderByteLength(); - int length = packet.getICMPPacketByteLength(); - - OctetConverter.longToOctets(System.currentTimeMillis(), data, dataOffset); - packet.computeICMPChecksum(); - - socket.write(address, data, offset, length); - - try { - do { - socket.read(address, data); - } - while (packet.getType() != ICMPPacket.TYPE_ECHO_REPLY || - packet.getIdentifier() != (hashCode() & 0xFFFF) || - packet.getSequenceNumber() != sequence); - - if (packet.getSourceAsInetAddress().equals(address)) { - long end = System.currentTimeMillis(); - long start = OctetConverter.octetsToLong(data, dataOffset); - long time = end - start; - - result.addReply(time); - result.setTTL(packet.getTTL() & 0xFF); - } - } - catch (InterruptedIOException e) { - // socket read timeout - LOG.finer("Receive timeout"); - // TODO: make RawSocket to throw Exceptions without the stack trace (for speed) - } - catch (UnknownHostException e) { - LOG.log(Level.WARNING, "Cannot retrieve the source address of an ICMP packet", e); - } - catch (IOException e) { - LOG.log(Level.WARNING, "Unable to read from the socket", e); - } - - } - - /** - * Issues the specified number of pings and - * waits for replies. - * - * @param subject address to ping - * @param count number of pings to perform - */ - public PingResult ping(ScanningSubject subject, int count) throws IOException { - PingResult result = new PingResult(subject.getAddress(), count); - RawSocket socket = createRawSocket(); - - try { - // send a bunch of packets - for (int i = 0; i < count && !Thread.currentThread().isInterrupted(); i++) { - try { - sendReceiveEchoPacket(socket, subject.getAddress(), i, result); - } - catch (InterruptedIOException e) { - // ignore timeouts - } - } - } - finally { - closeQuietly(socket); - } - - return result; - } - - public void close() { - } -} diff --git a/src/net/azib/ipscan/core/net/PingerRegistry.java b/src/net/azib/ipscan/core/net/PingerRegistry.java index d38b57a8..87139762 100644 --- a/src/net/azib/ipscan/core/net/PingerRegistry.java +++ b/src/net/azib/ipscan/core/net/PingerRegistry.java @@ -42,8 +42,8 @@ public class PingerRegistry { pingers = new LinkedHashMap<>(); if (Platform.WINDOWS) pingers.put("pinger.windows", WindowsPinger.class); - pingers.put("pinger.icmp", ICMPSharedPinger.class); - pingers.put("pinger.icmp2", ICMPPinger.class); + if (Platform.LINUX && Platform.ARCH_64) + pingers.put("pinger.icmp", ICMPSharedPinger.class); pingers.put("pinger.udp", UDPPinger.class); pingers.put("pinger.tcp", TCPPinger.class); pingers.put("pinger.combined", CombinedUnprivilegedPinger.class);