Here are several different ways to test a TCP port without telnet.
BASH (man page)
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
# Monitoring on interface eth0 | |
tcpdump -i eth0 -n port 67 and port 68 |
-- Function: remove_last_directory() | |
-- DROP FUNCTION remove_last_directory(); | |
CREATE OR REPLACE FUNCTION remove_last_directory() | |
RETURNS integer AS | |
$BODY$/* | |
author: Sorin Sbarnea | |
version: 1.0 | |
homepage: https://gist.github.com/2352885 |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
#!/bin/sh | |
# | |
# stunnel Start/Stop the stunnel daemons | |
# | |
# description: stunnel is a script that runs stunnel daemons | |
# version 1.00 | |
# | |
# chkconfig: 345 40 60 | |
# | |
# processname: stunnel |
# NOTE: These patterns take into account the additional log-line information passed to the logstash listener from rsyslog. YMMV. | |
DHCPD ((%{SYSLOGTIMESTAMP:timestamp})\s*(%{HOSTNAME:hostname})\s*dhcpd\S+\s*(%{WORD:dhcp_action})?.*[for|on] (%{IPV4:dhcp_client_ip})?.*[from|to] (%{COMMONMAC:dhcp_client_mac})?.*via (%{USERNAME:interface})) | |
IPTABLES ((%{SYSLOGTIMESTAMP:nf_timestamp})\s*(%{HOSTNAME:nf_host})\s*kernel\S+\s*(%{WORD:nf_action})?.*IN=(%{USERNAME:nf_in_interface})?.*OUT=(%{USERNAME:nf_out_interface})?.*MAC=(%{COMMONMAC:nf_dst_mac}):(%{COMMONMAC:nf_src_mac})?.*SRC=(%{IPV4:nf_src_ip}).*DST=(%{IPV4:nf_dst_ip}).*PROTO=(%{WORD:nf_protocol}).?*SPT=(%{INT:nf_src_port}?.*DPT=%{INT:nf_dst_port}?.*)) | |
DNS ((%{MONTHDAY:day})-(%{MONTH:month})-(%{YEAR:year}) (%{TIME:timestamp}) client (%{IPV4:dns_client_ip})#(%{NONNEGINT:dns_uuid})?.*query: (%{HOSTNAME:dns_dest}) (%{WORD:dns_type}) (%{WORD:dns_record})?.*(%{IPV4:dns_server})) | |
PGSQL ((%{SYSLOGTIMESTAMP:pgsql_timestamp}) (%{HOSTNAME:pgsql_hostname})?.*SAST >(%{WORD:pgs |
Here are several different ways to test a TCP port without telnet.
$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C
$ cat < /dev/tcp/127.0.0.1/23
#!/bin/bash | |
# | |
# Helper script to auto-configure a Cloud DNS record during | |
# compute engine instance startup. | |
# | |
# Setup: | |
# 1. Download and install the script in the instance: | |
# curl -L https://gist.github.com/ronoaldo/6d6f97bc20a5a40c4aac5e4fa6c09dd5/raw/ > /etc/init.d/clouddns-update | |
# 2. Give this script permissions and setup as startup daemon |
/* | |
After purchasing a humble book bundle, go to your download page for that bundle. | |
Open a console window for the page and paste in the below javascript. | |
This will download all the books in all the formats available. | |
*/ | |
$('a').each(function(i){ | |
if (['MOBI', 'PDF', 'EPUB'].indexOf($.trim($(this).text())) >= 0) { | |
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">'); | |
document.getElementById('dl_iframe_'+i).src = $(this).data('web'); | |
} |
#!/bin/bash | |
USER=${1:-sebble} | |
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-) | |
PAGES=$((658/100+1)) | |
echo You have $STARS starred repositories. | |
echo |