This commit is contained in:
Roman Hergenreder 2020-08-28 23:04:41 +02:00
parent b0111862f9
commit dc4babba88
4 changed files with 1707 additions and 2 deletions

1
.gitignore vendored

@ -1 +1,2 @@
__pycache__ __pycache__
*\.pyc

@ -2,8 +2,8 @@
import socket import socket
import sys import sys
import subprocess
import util import util
import pty
def generatePayload(type, local_address, port): def generatePayload(type, local_address, port):
@ -61,4 +61,4 @@ if __name__ == "__main__":
print("xhost +targetip") print("xhost +targetip")
print("Xnest :1") print("Xnest :1")
else: else:
subprocess.call(["nc", "-lvvp", str(listen_port)]) pty.spawn(["nc", "-lvvp", str(listen_port)])

64
pingscan.py Normal file

@ -0,0 +1,64 @@
#!/usr/bin/python
import sys
import os
import ipaddress
import subprocess
from importlib import util
threading_spec = util.find_spec("threading")
queue_spec = util.find_spec("queue")
if threading_spec is not None:
import threading
import queue
NUM_THREADS = 10
THREADING_ENABLED = True
QUEUE = queue.Queue()
else:
THREADING_ENABLED = False
def checkHost(host):
proc = subprocess.Popen(["ping", str(host), "-c", "1"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return proc.wait() == 0
def doWork(q):
while not q.empty():
host = q.get()
if checkHost(host):
print("[+] Host %s is online" % host)
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: %s <hosts>" % sys.argv[0])
exit(1)
hosts = sys.argv[1]
if "/" not in hosts:
if checkHost(hosts):
print("[+] Host %s is online" % hosts)
else:
print("[-] Host %s is not reachable" % hosts)
else:
cidr = ipaddress.ip_network(hosts)
hosts = list(cidr.hosts())
if not THREADING_ENABLED:
print("Scanning %d hosts in range: %s..." % (len(hosts), cidr))
for host in hosts:
if checkHost(host):
print("[+] Host %s is online" % host)
print("Done")
else:
print("Scanning %d hosts in range: %s with %d threads..." % (len(hosts), cidr, NUM_THREADS))
for host in hosts:
QUEUE.put(host)
threads = []
for i in range(NUM_THREADS):
t = threading.Thread(target=doWork, args=(QUEUE, ))
t.start()
threads.append(t)
for t in threads:
t.join()
print("Done")

File diff suppressed because it is too large Load Diff