Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import random
- import threading
- import time
- import string
- import socket
- thread_tid = []
- def get_session_thread():
- global thread_tid
- stid = "".join(random.choice(string.lowercase + string.digits) for x in range(4))
- return stid
- def run_threads(hosts):
- failure_code = "failure"
- success_code = "success"
- try:
- sock = socket.socket()
- socket.setdefaulttimeout(1)
- result = sock.connect_ex((hosts, 22))
- if (result == 0):
- return success_code
- sock.close()
- else:
- return failure_code
- sock.close()
- except socket.error:
- return failure_code
- def process_threads():
- global thread_tid
- while True:
- oct1 = random.randint(1, 254)
- oct2 = random.randint(1, 254)
- oct3 = random.randint(1, 254)
- oct4 = random.randint(1, 254)
- final = str(oct1) + "." + str(oct2) + "." + str(oct3) + "." + str(oct4)
- thread_id = get_session_thread()
- status_code = run_threads(final)
- print("{:<25}: {:.4} | {:.7}".format(final, thread_id, status_code))
- if (status_code == "success"):
- f = open("a.out", "a").write(final+'\n')
- elif (status_code == "failure"):
- pass
- process_threads()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement