Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. from socket import *
  2.  
  3.  
  4. def text_convert():
  5.     user_list = input("Enter List Location: ")
  6.  
  7.     with open(user_list) as file_in:
  8.         file_out = file_in.readlines()
  9.         content = [i.strip() for i in file_out]
  10.  
  11.     return content
  12.  
  13.  
  14. def port_scan(ip_addr, port):
  15.  
  16.     s = socket(AF_INET, SOCK_STREAM)
  17.     s.settimeout(2)
  18.     port_connect = s.connect_ex((str(ip_addr), port))
  19.  
  20.     if port_connect is 0:
  21.         print("[*] %s:%s - OPEN" % (ip_addr, port))
  22.         s.close()
  23.  
  24.     else:
  25.         print("[ ] %s:%s - CLOSED" % (ip_addr, port))
  26.         s.close()
  27.  
  28.  
  29. def main():
  30.     content = text_convert()
  31.     for b in range(0, len(content)):
  32.         port_scan(content[b], 3389)
  33.  
  34.  
  35. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement