mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-27 10:54:14 +01:00
Fixed config argument processing
This commit is contained in:
parent
64a5cdd06c
commit
56e73a6c37
@ -32,7 +32,7 @@ def main():
|
||||
"--config",
|
||||
"-c",
|
||||
type=argparse.FileType("r"),
|
||||
default="./pwncatrc",
|
||||
default=None,
|
||||
help="Custom configuration file (default: ./pwncatrc)",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
@ -268,14 +268,19 @@ class Manager:
|
||||
|
||||
# Load local configuration script
|
||||
if isinstance(config, str):
|
||||
try:
|
||||
with open(config) as filp:
|
||||
self.parser.eval(filp.read(), config)
|
||||
except (FileNotFoundError, PermissionError):
|
||||
pass
|
||||
elif config is not None:
|
||||
self.parser.eval(config.read(), config.name)
|
||||
config.close()
|
||||
else:
|
||||
try:
|
||||
# If no config is specified, attempt to load `./pwncatrc`
|
||||
# but don't fail if it doesn't exist.
|
||||
with open("./pwncatrc") as filp:
|
||||
self.parser.eval(filp.read(), "./pwncatrc")
|
||||
except (FileNotFoundError, PermissionError):
|
||||
pass
|
||||
|
||||
def open_database(self):
|
||||
"""Create the internal engine and session builder
|
||||
|
Loading…
Reference in New Issue
Block a user