python_wiki:test_port

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
python_wiki:test_port [2014/11/20 19:34]
127.0.0.1 external edit
python_wiki:test_port [2015/03/09 23:27]
billdozor
Line 1: Line 1:
 ====== Test Port ====== ====== Test Port ======
 +
 +**General Information**
 +
 Function to check a network port to see if it is open on a host. Function to check a network port to see if it is open on a host.
  
-<code>+**Checklist** 
 +  * import socket 
 + 
 +---- 
 + 
 +===== The Code ===== 
 +<code python>
 import socket import socket
  
Line 18: Line 27:
 </code> </code>
  
 +==== Usage ====
 Call this function, checking server1 for tcp/22 (ssh): Call this function, checking server1 for tcp/22 (ssh):
-<code>+<code python>
 if test_port(server1,22): if test_port(server1,22):
   do ssh stuff   do ssh stuff
  • python_wiki/test_port.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)