mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-24 01:25:37 +01:00
fix: Fixes 'set' command usage for incorrect keys
The key wasn't being checked before accessing the value from the 'manager.config' dictionary
This commit is contained in:
parent
9d1aff43fc
commit
03456e51cb
@ -80,9 +80,14 @@ class Command(CommandDefinition):
|
||||
try:
|
||||
if manager.sessions and args.variable == "db":
|
||||
raise ValueError("cannot change database with running session")
|
||||
if args.variable in manager.config:
|
||||
manager.config.set(
|
||||
args.variable, args.value, getattr(args, "global")
|
||||
)
|
||||
else:
|
||||
console.log(
|
||||
f"[red]error[/red]: invalid choice {repr(args.variable)}"
|
||||
)
|
||||
if args.variable == "db":
|
||||
# Ensure the database is re-opened, if it was already
|
||||
manager.open_database()
|
||||
@ -95,10 +100,15 @@ class Command(CommandDefinition):
|
||||
except ValueError as exc:
|
||||
console.log(f"[red]error[/red]: {exc}")
|
||||
elif args.variable is not None:
|
||||
if args.variable in manager.config:
|
||||
value = manager.config[args.variable]
|
||||
console.print(
|
||||
f" [cyan]{args.variable}[/cyan] = [yellow]{repr(value)}[/yellow]"
|
||||
)
|
||||
else:
|
||||
console.log(
|
||||
f"[red]error[/red]: invalid choice {repr(args.variable)}"
|
||||
)
|
||||
else:
|
||||
for name in manager.config:
|
||||
value = manager.config[name]
|
||||
|
Loading…
Reference in New Issue
Block a user