Subdomain Posts
Bash | 204 days ago
Bash | 216 days ago
Bash | 216 days ago
Bash | 216 days ago
Bash | 216 days ago
Bash | 220 days ago
Bash | 220 days ago
Bash | 220 days ago
Perl | 221 days ago
Perl | 304 days ago
Recent Posts
HTML | 14 sec ago
HTML | 22 sec ago
C++ | 33 sec ago
JavaScript | 42 sec ago
None | 49 sec ago
PHP | 51 sec ago
None | 55 sec ago
Python | 55 sec ago
PAWN | 1 min ago
Python | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By epixoip on the 10th of Aug 2009 04:42:56 AM Download | Raw | Embed | Report
  1. #!/usr/bin/perl
  2. # Tue Apr  3 16:42:08 PDT 2007 by epixoip <epixoip@hush.com>
  3. # synping - a tcp syn ping utility
  4.  
  5. use Net::Ping;
  6. use Time::HiRes;
  7. use Getopt::Std;
  8.  
  9. my %options = ();
  10. getopts("c:i:t:T",\%options);
  11. our $host = $ARGV[0];
  12. our $port = $ARGV[1];
  13. our $seq = 0;
  14.  
  15. &usage unless defined($port);
  16.  
  17. sub usage {
  18.         print "SYN Ping Utility - by epixoip <epixoip\@hush.com>\n";
  19.         print "Usage:\t$0 [-citT] <host> <port>\n";
  20.         print "\t-c\tStop after \$foo iterations\n";
  21.         print "\t-i\tWait \$foo seconds between iterations\n";
  22.         print "\t-t\tSet TTL to \$foo\n";
  23.         print "\t-T\tTimestamp output\n\n";
  24.         exit(1);
  25. }
  26.  
  27. $p = Net::Ping->new("syn", $options{t});
  28. $p->hires();
  29. $p->{port_num} = $port;
  30. while (1) {
  31.         $p->ping($host);
  32.         if (($hostn,$rtt,$ip) = $p->ack) {
  33.                 print "[", localtime(time), "] " if defined($options{T});
  34.                 printf("ack from $host ($ip) port=$port seq=$seq time=%.2f ms\n", $rtt * 1000);
  35.         } else {
  36.                 my $reason = $p->nack($host);
  37.                 print "[", localtime(time), "] " if defined($options{T});
  38.                 print "seq $seq: no reply from $host: $reason\n";
  39.         }
  40.         if (defined($options{c})) {
  41.                 if ($seq == $options{c} - 1) {
  42.                         exit(0);
  43.                 }
  44.         }
  45.         $seq++;
  46.         if (defined($options{i})) {
  47.                 sleep($options{i});
  48.         } else {
  49.                 sleep(1);
  50.         }
  51. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: