mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-27 19:04:15 +01:00
Fixed --ssl argument processing in main entrypoint
This commit is contained in:
parent
f8f9598268
commit
e735c40acb
@ -233,9 +233,9 @@ def main():
|
|||||||
if query_args["certfile"] is not None or query_args["keyfile"] is not None:
|
if query_args["certfile"] is not None or query_args["keyfile"] is not None:
|
||||||
query_args["ssl"] = True
|
query_args["ssl"] = True
|
||||||
|
|
||||||
if query_args["protocol"] is not None and args.ssl:
|
if query_args["protocol"] not in [None, "bind", "connect"] and args.ssl:
|
||||||
console.log(
|
console.log(
|
||||||
"[red]error[/red]: --ssl is incompatible with an explicit protocol"
|
f"[red]error[/red]: --ssl is incompatible with an [yellow]{query_args['protocol']}[/yellow] protocol"
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -296,41 +296,31 @@ def main():
|
|||||||
if "implant.remote" in fact.types:
|
if "implant.remote" in fact.types:
|
||||||
implants.append((target, users[fact.uid], fact))
|
implants.append((target, users[fact.uid], fact))
|
||||||
|
|
||||||
with Progress(
|
for target, implant_user, implant in implants:
|
||||||
"triggering implant",
|
# Check correct query_args["user"]
|
||||||
"•",
|
if (
|
||||||
"{task.fields[status]}",
|
query_args["user"] is not None
|
||||||
transient=True,
|
and implant_user.name != query_args["user"]
|
||||||
console=console,
|
):
|
||||||
) as progress:
|
continue
|
||||||
task = progress.add_task("", status="...")
|
# Check correct platform
|
||||||
for target, implant_user, implant in implants:
|
if (
|
||||||
# Check correct query_args["user"]
|
query_args["platform"] is not None
|
||||||
if (
|
and target.platform != query_args["platform"]
|
||||||
query_args["user"] is not None
|
):
|
||||||
and implant_user.name != query_args["user"]
|
continue
|
||||||
):
|
|
||||||
continue
|
|
||||||
# Check correct platform
|
|
||||||
if (
|
|
||||||
query_args["platform"] is not None
|
|
||||||
and target.platform != query_args["platform"]
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
|
|
||||||
progress.update(
|
manager.log(f"trigger implant: [cyan]{implant.source}[/cyan]")
|
||||||
task, status=f"trying [cyan]{implant.source}[/cyan]"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Attempt to trigger a new session
|
# Attempt to trigger a new session
|
||||||
try:
|
try:
|
||||||
session = implant.trigger(manager, target)
|
session = implant.trigger(manager, target)
|
||||||
manager.target = session
|
manager.target = session
|
||||||
used_implant = implant
|
used_implant = implant
|
||||||
break
|
break
|
||||||
except ModuleFailed:
|
except ModuleFailed:
|
||||||
db.transaction_manager.commit()
|
db.transaction_manager.commit()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if manager.target is not None:
|
if manager.target is not None:
|
||||||
manager.target.log(
|
manager.target.log(
|
||||||
|
@ -255,41 +255,31 @@ class Command(CommandDefinition):
|
|||||||
if "implant.remote" in fact.types:
|
if "implant.remote" in fact.types:
|
||||||
implants.append((target, users[fact.uid], fact))
|
implants.append((target, users[fact.uid], fact))
|
||||||
|
|
||||||
with Progress(
|
for target, implant_user, implant in implants:
|
||||||
"triggering implant",
|
# Check correct query_args["user"]
|
||||||
"•",
|
if (
|
||||||
"{task.fields[status]}",
|
query_args["user"] is not None
|
||||||
transient=True,
|
and implant_user.name != query_args["user"]
|
||||||
console=console,
|
):
|
||||||
) as progress:
|
continue
|
||||||
task = progress.add_task("", status="...")
|
# Check correct platform
|
||||||
for target, implant_user, implant in implants:
|
if (
|
||||||
# Check correct query_args["user"]
|
query_args["platform"] is not None
|
||||||
if (
|
and target.platform != query_args["platform"]
|
||||||
query_args["user"] is not None
|
):
|
||||||
and implant_user.name != query_args["user"]
|
continue
|
||||||
):
|
|
||||||
continue
|
|
||||||
# Check correct platform
|
|
||||||
if (
|
|
||||||
query_args["platform"] is not None
|
|
||||||
and target.platform != query_args["platform"]
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
|
|
||||||
progress.update(
|
manager.log(f"trigger implant: [cyan]{implant.source}[/cyan]")
|
||||||
task, status=f"trying [cyan]{implant.source}[/cyan]"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Attempt to trigger a new session
|
# Attempt to trigger a new session
|
||||||
try:
|
try:
|
||||||
session = implant.trigger(manager, target)
|
session = implant.trigger(manager, target)
|
||||||
manager.target = session
|
manager.target = session
|
||||||
used_implant = implant
|
used_implant = implant
|
||||||
break
|
break
|
||||||
except (ChannelError, PlatformError, ModuleFailed):
|
except (ChannelError, PlatformError, ModuleFailed):
|
||||||
db.transaction_manager.commit()
|
db.transaction_manager.commit()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if used_implant is not None:
|
if used_implant is not None:
|
||||||
manager.target.log(f"connected via {used_implant.title(manager.target)}")
|
manager.target.log(f"connected via {used_implant.title(manager.target)}")
|
||||||
|
Loading…
Reference in New Issue
Block a user