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; also specify that it needs root

This commit is contained in:
Anton Keks 2020-05-12 22:46:17 +03:00
parent 9ea26dd368
commit fbc08ba00c
16 changed files with 8 additions and 179 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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() {
}
}

View File

@ -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);