TCPing is a tool that allows you to use a TCP connection to ping a service. It can be used as a replacement of ICMP Ping in case the network doesn't allow ICMP, or as a service live check.
This is a beta release, so please open an issue if you notice an issue.
The tools is written in Python3 and it needs Python v3 to be installed.
Simply clone the repository to the location you want:
(Example: you want to place it in ~/apps/
mkdir -p ~/apps/
cd ~/apps/
git clone https://github.com/ayoobali/TCPing
cd TCPing
chmod ug+x tcping.py
python3 tcping.py -h
To run the application from any directory, just create a symlink of tcping
in your bin directory.
ln -s ~/apps/TCPing/tcping.py ~/bin/tcping
OR One line installation:
mkdir -p ~/apps/ && mkdir -p ~/bin/ && cd ~/apps/ && git clone https://github.com/ayoobali/TCPing && cd TCPing && chmod gu+x tcping.py && ln -s ~/apps/TCPing/tcping.py ~/bin/tcping
To update TCPing to the latest version, navigate to the directory where TCPing is located and run the command git pull
If you installed TCPing using the above command, you can simply update it using the following command:
cd ~/apps/TCPing/
git pull
To remove TCPing from your system just delete the downloaded files.
If you installed it using the above command, you can simply uninstall it using the following command:
rm ~/bin/tcping
rm -rf ~/apps/TCPing
To ping a service:
tcping -i <hostname> -p <port>
To save the response time of a server once every hour for 24 hours:
tcping -i example.com -p 443 -n 24 -s 3600000 -q --online-cmd "echo '{#DATE#},{#RESPONSE#}' >> data.csv" &
This will run the command in the background and it will create a file called data.txt
with the timestamp and response time for the next 24 hours
To show the output of --online-cmd
and --offline-cmd
commands use -vv
For more options type tcping -h
- Connect to a database to store all data and save last status.
- Get target Hosts:Ports from file to ping multiple services.
- Send HTTP request when target status changes (Online/Offline).
Run shell command when target status changes from online to offline and vice versa.Run shell command if target is Offline.Run shell command if target is Online.
This tool is released under MIT License.
[2021-05-28] v0.2.2 (Beta):
- [Fix] Fixed the update option to exit after checking the new version.
[2019-03-05] v0.2.1 (Beta):
- [Fix] Fixed a minor issue with the update option.
[2019-03-05] v0.2.0 (Beta):
-
[Add] Added option
--to-offline-cmd
that allows execution of shell command onetime when the status changes fromOnline
toOffline
. -
[Add] Added option
--to-online-cmd
that allows execution of shell command onetime when the status changes fromOffline
toOnline
. -
[Add] Added option
--update
to check if there is a new version of TCPing. -
[Fix] Minor fixes.
Note: in the options
--to-offline-cmd
and--to-online-cmd
you can use the following variables to be automatically replaced.{#NO#}
,{#DATE#}
,{#IP#}
,{#PORT#}
,{#STATUS#}
and{#RESPONSE#}
Example:tcping -i example.com -p 443 -n 0 -s 10000 -q --to-offline-cmd 'curl "http://alertsystem.tld/?ip={#IP#}&port={#PORT#}&status={#STATUS#}"'
[2019-01-31] v0.1.3 (Beta):
-
[Add] Added option
--online-cmd
that allows execution of shell commands for each online status. -
[Add] Added option
--offline-cmd
that allows execution of shell commands for each offline status. -
[Mod] Modified the option
-n
and--number
to allow the value0
for infinite ping requests. -
[Mod] Modified the sleep function to sleep after each request instead of before each request.
Note: in the options
--online-cmd
and--offline-cmd
you can use the following variables to be automatically replaced.{#NO#}
,{#DATE#}
,{#IP#}
,{#PORT#}
,{#STATUS#}
and{#RESPONSE#}
Example:tcping -i example.com -p 443 -n 0 -s 10000 -q --offline-cmd 'notify-send "TCPing" "IP: {#IP#} is {#STATUS#}\nOn Port: {#PORT#}\nAt: {#DATE#}"'
[2019-01-27] v0.1.2 (Beta):
- [Fix] Fixed an issue that
--sleep
,--timeout
and--number
were throwing an error.
[2019-01-27] v0.1.1 (Beta):
- [Fix] Fixed an error that
sys
andos
were used but not imported. - [Fix] Fixed wrong License Label in source code file.
[2019-01-26] v0.1 (Beta):
- First Beta Release.