Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash +x
- ## Do you need to test your exposed app but you don't have curl/wget/* installed?
- ## Simple and easy
- :> /dev/tcp/localhost/22
- ## Why using timeout? If any side has a firewall and it's dropping the packages, the request will take ~80 seconds to get the timeout.
- ## Let's try first with Google :D
- ## In this case, we don't have output, but the return code will be 0
- timeout 10s bash -c ':> /dev/tcp/google.com/443'
- ## Return code
- 0
- ## Now let's try locally. With return code 1
- timeout 10s bash -c ':> /dev/tcp/localhost/443'
- ## Output
- bash: connect: Cannot assign requested address
- bash: /dev/tcp/localhost/443: Cannot assign requested address
- ## Return code
- 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement