Last active
April 8, 2022 12:02
-
-
Save ovntatar/d3b29b4e989a1e02e7c4ab43765829e0 to your computer and use it in GitHub Desktop.
Python one line access remote port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -c "import socket; socket.setdefaulttimeout(2); print('Port is up √') if 0 == socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex(('google.com',4413)) else print('Port is down †')" |
timeout 2 bash -c "</dev/tcp/canyouseeme.org/809"; echo $?
</dev/tcp/google.de/80 && echo Port open. || echo Port closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
timeout 1 bash -c 'cat < /dev/null > /dev/tcp/google.com/80'
echo $?