Total Pageviews

Saturday 6 June 2020

tcpping

Ping look-alike that uses TCP SYN packets to get around firewalls and ICMP blackholes.

--- Overview ----------------------------------------------------------------

tcpping is a quick utility designed to emulate standard 'ping' in nearly every
meaningful way and only diverge when necessary.  It sends out forged TCP SYN
packets and listens for a SYN/ACK or RST from the server or intermediary.  It
counts and reports on these results using an interface that is nearly identical
to standard UNIX ping.

--- Why Use Instead of Ping -------------------------------------------------

On the global Internet, some routers or systems will firewall ICMP messages
while allowing TCP packets.  Furthermore, some routers or hosts will
'deprioritize' ICMP ping (echo) messages destined for itself or others -- when
the network gets busy, these get dropped.

However, virtually all public servers and the majority of private systems have
at least one TCP port open and will respond to requests on it quickly and
reliably.  This provides greater accuracy (or any accuracy at all) for
determining if a host is available.  It also yields more reliable timing for
sensitive latency and loss measurements as deprioritized packets will not be a
true measure of latency for normal traffic (better simulated by TCP packets).

It was originally written by Steven Kehlet (blog at kehlet.cx); it was taken
over, bugfixed, and now maintained (with the original author's blessing) by Jim
Wyllie.

--- Building ----------------------------------------------------------------

Building tcpping requires that you have a stable build environment as well as
development versions of libnet1 and pcap.  If you're on a Debian-based system
(including Ubuntu) you can install those libraries with the following:

sudo apt-get install build-essential
sudo apt-get install libnet1-dev
sudo apt-get install libpcap-dev
sudo apt-get install xmltoman

Or, alternatively, libnet1 is conveniently hosted on GitHub:
http://github.com/sam-github/libnet

While libpcap is hosted at http://www.tcpdump.org/

Build with the following:

make

--- Setuid and tcpping ------------------------------------------------------

If you don't want to use root access to use it every time, you can setuid the
program.  Keep in mind that any security vulnerabilities in tcpping could
allow someone to execute arbitrary root-level code, so do this at your own
risk.

sudo chown root:root tcpping
sudo chmod a+s tcpping

--- Compatibility Issues ----------------------------------------------------

libnet1 is a retooling of the old libnet hosted on SourceForge at
http://packetfactory.net/ by Peter Wang.  The note from Sam at GitHub is that
the upstream maintainer is unresponsive and the project is unmaintained.  Older
versions of libnet based on Peter Wang's implementation will no longer work.
You can find Sam's implementation at https://github.com/sam-github/libnet

--- Related Tools -----------------------------------------------------------

Some tools that have similar functionality that may suit your needs better:

hping
http://www.hping.org/  --  (officially) supports more operating systems.  Has
many more features and is more complicated.

nmap
http://nmap.org/ -- Full-service security standard compiled as a package with
nearly all UNIX-like distributions.  

mtr
http://www.bitwizard.nl/mtr/ -- Traceroute combined with ping for full-route
loss statistics.  Newer versions support TCP pings.

from https://github.com/jwyllie83/tcpping
-----

Ping with DNS requesting.

DNSPing

Ping with DNS requesting.

Version

  • Windows: v0.1 Beta(2014-08-26)
  • Linux: v0.1 Beta(2014-08-26)

ReadMe

Usage

DNSPing [-h] [-t] [-a] [-n Count] [-f] [-i HopLimit/TTL] [-w Timeout] [-id DNS_ID] [-qr] [-opcode OPCode] [-aa] [-tc] [-rd] [-ra] [-ad] [-cd] [-rcode RCode] [-qn Count] [-ann Count] [-aun Count] [-adn Count] [-ti Time] [-edns0] [-payload Length] [-dnssec] [-qt Type] [-qc Classes] [-p ServiceName] [-rawdata RAW_Data] [-raw ServiceName] [-buf Size] [-of FileName] Test_DomainName Target
  • [-f] is only available in Windows.

Options

  • N/A
    • Description.
  • ?
    • Description.
  • -h
    • Description.
  • -t
    • Pings the specified host until stopped.
    • To see statistics and continue type Control-Break.
    • To stop type Control-C.
  • -a
    • Resolve addresses to host names.
  • -n Count
    • Set number of echo requests to send.
    • Count must between 1 - 0xFFFF/65535.
  • -f(Windows)
    • Set the Don't Fragment flag in outgoing packets(IPv4).
  • -i HopLimit/TTL
    • Specifie a Time To Live for outgoing packets.
    • HopLimit/TTL must between 1 - 255.
  • -w Timeout
    • Set a long wait periods (in milliseconds) for a response.
    • Timeout must between 500 - 0xFFFF/65535.
  • -id DNS_ID
    • Specifie DNS header ID.
    • DNS ID must between 0x0001 - 0xFFFF/65535.
  • -qr
    • Set DNS header QR flag.
  • -opcode OPCode
    • Specifie DNS header OPCode.
    • OPCode must between 0x0000 - 0x00FF/255.
  • -aa
    • Set DNS header AA flag.
  • -tc
    • Set DNS header TC flag.
  • -rd
    • Set DNS header RD flag.
  • -ra
    • Set DNS header RA flag.
  • -ad
    • Set DNS header AD flag.
  • -cd
    • Set DNS header CD flag.
  • -rcode RCode
    • Specifie DNS header RCode.
    • RCode must between 0x0000 - 0x00FF/255
  • -qn Count
    • Specifie DNS header Question count.
    • Question count must between 0x0001 - 0xFFFF/65535.
  • -ann Count
    • Specifie DNS header Answer count.
    • Answer count must between 0x0001 - 0xFFFF/65535.
  • -aun Count
    • Specifie DNS header Authority count.
    • Authority count must between 0x0001 - 0xFFFF/65535.
  • -adn Count
    • Specifie DNS header Additional count.
    • Additional count must between 0x0001 - 0xFFFF/65535.
  • -ti IntervalTime
    • Specifie transmission interval time(in milliseconds).
  • -edns0
    • Send with EDNS0 Label.
  • -payload Length
    • Specifie EDNS0 Label UDP Payload length.
    • Payload length must between 512 - 0xFFFF/65535.
  • -dnssec
    • Send with DNSSEC requesting.
    • EDNS0 Label will enable when DNSSEC is enable
  • -qt Type
    • Specifie Query type.
    • Type: A|NS|CNAME|SOA|PTR|MX|TXT|RP|SIG|KEY|AAAA|LOC|SRV|             NAPTR|KX|CERT|DNAME|EDNS0|APL|DS|SSHFP|IPSECKEY|             RRSIG|NSEC|DNSKEY|DHCID|NSEC3|NSEC3PARAM|HIP|SPF|             TKEY|TSIG|IXFR|AXFR|ANY|TA|DLV
  • -qc Classes
    • Specifie Query classes.
    • Classes: IN|CSNET|CHAOS|HESIOD|NONE|ALL|ANY
  • -p ServiceName
    • Specifie UDP port/protocol(Sevice names).
    • UDP port must between 0x0001 - 0xFFFF/65535.
    • Protocol: TCPMUX|ECHO|DISCARD|SYSTAT|DAYTIME|NETSTAT|             QOTD|MSP|CHARGEN|FTP|SSH|TELNET|SMTP|             TIME|RAP|RLP|NAME|WHOIS|TACACS|XNSAUTH|MTP|             BOOTPS|BOOTPC|TFTP|RJE|FINGER|TTYLINK|SUPDUP|             SUNRPC|SQL|NTP|EPMAP|NETBIOSNS|NETBIOSDGM|             NETBIOSSSN|IMAP|BFTP|SGMP|SQLSRV|DMSP|SNMP|             SNMPTRAP|ATRTMP|ATHBP|QMTP|IPX|IMAP|IMAP3|             BGMP|TSP|IMMP|ODMR|RPC2PORTMAP|CLEARCASE|             HPALARMMGR|ARNS|AURP|LDAP|UPS|SLP|SNPP|             MICROSOFTDS|KPASSWD|TCPNETHASPSRV|RETROSPECT|             ISAKMP|BIFFUDP|WHOSERVER|SYSLOG|ROUTERSERVER|             NCP|COURIER|COMMERCE|RTSP|NNTP|HTTPRPCEPMAP|             IPP|LDAPS|MSDP|AODV|FTPSDATA|FTPS|NAS|TELNETS
  • -rawdata RAW_Data
    • Specifie Raw data to send.
    • RAW_Data is hex, but do not add 0x before hex.
    • Length of RAW_Data must between 64 - 1512 bytes.
  • -raw ServiceName
    • Specifie Raw socket type.
    • Service Name: HOPOPTS|ICMP|IGMP|GGP|IPV4|ST|TCP|CBT|EGP|             IGP|PUP|IDP|IPV6|ROUTING|ESP|FRAGMENT|AH|             ICMPV6|NONE|DSTOPTS|ND|ICLFXBM|PIM|PGM|L2TP|             SCTP|RAW
  • -buf Size
    • Specifie receive buffer size.
    • Buffer size must between 512 - 4096 bytes.
  • -of FileName
    • Output result to file.
    • FileName must less than 260 bytes.
  • -6
    • Using IPv6.
  • -4
    • Using IPv4.
  • Test_DomainName
    • A domain name which will make requesting to send to DNS server.
  • Target
    • Target of DNSPing, support IPv4/IPv6 address and domain.

License

GNU General Public License/GNU GPL v2

Thanks

No comments:

Post a Comment