Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #!/usr/bin/env bash +x
  2.  
  3. ## Do you need to test your exposed app but you don't have curl/wget/* installed?
  4.  
  5. ## Simple and easy
  6. :> /dev/tcp/localhost/22
  7.  
  8. ## 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.
  9.  
  10. ## Let's try first with Google :D
  11. ## In this case, we don't have output, but the return code will be 0
  12. timeout 10s bash -c ':> /dev/tcp/google.com/443'
  13. ## Return code
  14. 0
  15.  
  16. ## Now let's try locally. With return code 1
  17. timeout 10s bash -c ':> /dev/tcp/localhost/443'
  18. ## Output
  19. bash: connect: Cannot assign requested address
  20. bash: /dev/tcp/localhost/443: Cannot assign requested address
  21. ## Return code
  22. 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement