1
0
mirror of https://github.com/calebstewart/pwncat.git synced 2024-11-27 19:04:15 +01:00

Fixed dumb ssh argument handling. Sorry Trevor.

This commit is contained in:
Caleb Stewart 2020-05-28 20:18:24 -04:00
parent 980d015b16
commit 456a1505f4
3 changed files with 22 additions and 9 deletions

View File

@ -76,7 +76,7 @@ class Command(CommandDefinition):
Complete.NONE, Complete.NONE,
type=int, type=int,
help="The port to listen on or connect to", help="The port to listen on or connect to",
action=StoreForAction(["connect", "listen"]), action=StoreForAction(["connect", "listen", "ssh"]),
), ),
"--method,-m": Parameter( "--method,-m": Parameter(
Complete.NONE, Complete.NONE,

View File

@ -149,6 +149,7 @@ class Command(CommandDefinition):
"system.kernel.exploit", "system.kernel.exploit",
"system.network.hosts", "system.network.hosts",
"system.network", "system.network",
"writable_path",
], ],
nargs=0, nargs=0,
help="Activate the set of 'quick' enumeration types", help="Activate the set of 'quick' enumeration types",
@ -267,6 +268,8 @@ class Command(CommandDefinition):
"system.user.password", "system.user.password",
# Enumerated possible user private keys - very important # Enumerated possible user private keys - very important
"system.user.private_key", "system.user.private_key",
# Directories in our path that are writable
"writable_path",
] ]
# These types are very noisy. They are important for full enumeration, # These types are very noisy. They are important for full enumeration,
@ -350,7 +353,7 @@ class Command(CommandDefinition):
def show_facts(self, typ: str, provider: str, long: bool): def show_facts(self, typ: str, provider: str, long: bool):
""" Display known facts matching the criteria """ """ Display known facts matching the criteria """
facts: Dict[str, Dict[str, List[pwncat.db.Fact]]] = {} data: Dict[str, Dict[str, List[pwncat.db.Fact]]] = {}
if isinstance(typ, list): if isinstance(typ, list):
types = typ types = typ
@ -363,15 +366,15 @@ class Command(CommandDefinition):
typ, filter=lambda f: provider is None or f.source == provider typ, filter=lambda f: provider is None or f.source == provider
): ):
util.progress(f"enumerating facts: {fact.data}") util.progress(f"enumerating facts: {fact.data}")
if fact.type not in facts: if fact.type not in data:
facts[fact.type] = {} data[fact.type] = {}
if fact.source not in facts[fact.type]: if fact.source not in data[fact.type]:
facts[fact.type][fact.source] = [] data[fact.type][fact.source] = []
facts[fact.type][fact.source].append(fact) data[fact.type][fact.source].append(fact)
util.erase_progress() util.erase_progress()
for typ, sources in facts.items(): for typ, sources in data.items():
for source, facts in sources.items(): for source, facts in sources.items():
print( print(
f"{Style.BRIGHT}{Fore.YELLOW}{typ.upper()}{Fore.RESET} Facts by {Fore.BLUE}{source}{Style.RESET_ALL}" f"{Style.BRIGHT}{Fore.YELLOW}{typ.upper()}{Fore.RESET} Facts by {Fore.BLUE}{source}{Style.RESET_ALL}"
@ -384,4 +387,10 @@ class Command(CommandDefinition):
def flush_facts(self, typ: str, provider: str): def flush_facts(self, typ: str, provider: str):
""" Flush all facts that match criteria """ """ Flush all facts that match criteria """
if isinstance(typ, list):
types = typ
else:
types = [typ]
for typ in types:
pwncat.victim.enumerate.flush(typ, provider) pwncat.victim.enumerate.flush(typ, provider)

View File

@ -74,4 +74,8 @@ def enumerate() -> Generator[FactData, None, None]:
elif "upstart" in version.lower(): elif "upstart" in version.lower():
init = util.Init.UPSTART init = util.Init.UPSTART
# No need to provide an empty version string. They apparently don't support "--version"
if version == "":
version = None
yield InitSystemData(init, version) yield InitSystemData(init, version)