Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading
- import wmi
- import json
- import subprocess
- import time
- from ldap3 import Server,
- Connection,
- AUTO_BIND_NO_TLS,
- SUBTREE,
- ALL_ATTRIBUTES
- class Ping(threading.Thread):
- def run (self):
- i = 40
- done = False
- while i < 250:
- scan_ip = threading.currentThread().getName() + str(i)
- response = subprocess.Popen(["ping", "-n", "1", "-w", "200", scan_ip]).wait()
- time.sleep(5)
- if(response == 0):
- try:
- wql = 'SELECT * FROM Win32_computerSystem'
- c = wmi.WMI(scan_ip, user='admin', password='pass')
- for item in c.query(wql):
- time.sleep(5)
- if(str(item.UserName) == "pestova"):
- print(scan_ip)
- done = True
- except:
- print("-")
- if done:
- break
- i += 1
- x = Ping(name = "192.168.4.")
- y = Ping(name = "192.168.5.")
- x.start()
- y.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement