From 4c9e2966b144e164ee62a37288ca2f7ee36cc042 Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Tue, 26 Nov 2024 16:29:50 +0100 Subject: [PATCH 1/6] fix bug --- README.md | 1 + bin/pwnvasive | 0 pwnvasive/cli.py | 6 +++--- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 README.md mode change 100644 => 100755 bin/pwnvasive diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ + diff --git a/bin/pwnvasive b/bin/pwnvasive old mode 100644 new mode 100755 diff --git a/pwnvasive/cli.py b/pwnvasive/cli.py index d4fbd3e..bc6a493 100644 --- a/pwnvasive/cli.py +++ b/pwnvasive/cli.py @@ -282,11 +282,11 @@ def _add_completions(self): for k,_ in self.store._objects.items() }) - def do_update(self, obj, selector, val): + def do_update(self, obj, selector, vals): try: - val = self.str2map(val) + vals = self.str2map(vals) except: - print(f"could not parse [{val}]. Should be field=value[,f=v[,...]]") + print(f"could not parse [{vals}]. Should be field=value[,f=v[,...]]") raise objs = self.store.objects[obj].select(selector) From e2f91eb4df945f50cced4331bf6974e23b98852d Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Tue, 26 Nov 2024 17:26:49 +0100 Subject: [PATCH 2/6] doc --- README.md | 17 ++++++ doc/README.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 doc/README.md diff --git a/README.md b/README.md index 8b13789..c35061e 100644 --- a/README.md +++ b/README.md @@ -1 +1,18 @@ +# Pwnvasive +Semi-automatic discovery and lateralization + +## Getting started + +### Documentation + +The official documentation is available : [here](doc/README.md) + +## Installation + +```bash +git clone https://github.com/airbus-seclab/pwnvasive.git +cd pwnvasive +chmod +x bin/pwnvasive +bin/pwnvasive /tmp/db.json +``` diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 0000000..a062bde --- /dev/null +++ b/doc/README.md @@ -0,0 +1,139 @@ +## Documentation + +### add +Add an instance of an object +``` +add [val=''] +``` + +### auto +Modify the state of a handler to automate tasks. +``` +auto [handler=None] [on='on'] +``` + +### cat +Display the contents of a node file +``` +cat +``` + +### cnx +Creating a session with a node +``` +cnx [selector=None] +``` + +### compute_network +Graphically represent our playing area +``` +compute_network +``` + +### config +Add/modify/delete attributes in the database +``` +config [key=None] [op=None] [val=None] +``` + +### del +Delete an object instance +``` +del +``` + +### disconnect +End a session +``` +disconnect [selector=None] +``` + +### eval +Evaluating a function +``` +eval +``` + +### exit +Exit the prompt +``` +exit +``` + +### extract_networks +Try to find new networks/new nodes +``` +extract_networks [selector=None] +``` + +### flush +Delete all instances of an object +``` +flush [selector=None] +``` + +### id +Identify the machine's operating system +``` +id [selector=None] +``` + +### info +Display an abstract of a node's information +``` +info +``` + +### ls +List objects and instances of an object +``` +ls [obj=None] [selector=None] +``` + +### pdb +Debug pwnvasive +``` +pdb +``` + +### quit +Exit the prompt +``` +quit +``` + +### run +Run a command on a node +``` +run +``` + +### save +Saving the work base +``` +save [fname=None] +``` + +### service +View / Start / Stop a service +``` +service [svc=None] [startstop='start'] +``` + +### show +Display the details of an object instance +``` +show [selector=None] +``` + +### tasks +View current tasks +``` +tasks +``` + +### update +Modify the variables of an object instance +``` +update +``` \ No newline at end of file From d1eec2d5d04ab26c26fc813c652b46e9db55efe1 Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Tue, 26 Nov 2024 17:35:44 +0100 Subject: [PATCH 3/6] missing function --- doc/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/README.md b/doc/README.md index a062bde..5fbb768 100644 --- a/doc/README.md +++ b/doc/README.md @@ -90,6 +90,12 @@ List objects and instances of an object ls [obj=None] [selector=None] ``` +### monitor +Display the actions that pwnvasive performs internally +``` +monitor [onoff='on'] +``` + ### pdb Debug pwnvasive ``` From 4ff200c31644d7c9a9d71a542821a73214da91fb Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Tue, 26 Nov 2024 17:37:09 +0100 Subject: [PATCH 4/6] type --- doc/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/README.md b/doc/README.md index 5fbb768..55169ca 100644 --- a/doc/README.md +++ b/doc/README.md @@ -19,7 +19,7 @@ cat ``` ### cnx -Creating a session with a node +Create a session with a node ``` cnx [selector=None] ``` @@ -49,7 +49,7 @@ disconnect [selector=None] ``` ### eval -Evaluating a function +Evaluate a function ``` eval ``` @@ -115,7 +115,7 @@ run ``` ### save -Saving the work base +Save the database ``` save [fname=None] ``` From 7a892185b58626344a693b4932cdc161e1611679 Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Tue, 26 Nov 2024 17:46:13 +0100 Subject: [PATCH 5/6] typo --- doc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README.md b/doc/README.md index 55169ca..7035436 100644 --- a/doc/README.md +++ b/doc/README.md @@ -37,7 +37,7 @@ config [key=None] [op=None] [val=None] ``` ### del -Delete an object instance +Delete the instance of an object ``` del ``` From a2148d1245759bac6a152a1e78c511325a1860cb Mon Sep 17 00:00:00 2001 From: 0xs86 Date: Thu, 28 Nov 2024 15:49:31 +0100 Subject: [PATCH 6/6] fix bug --- pwnvasive/cli.py | 4 ++-- pwnvasive/mappings.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pwnvasive/cli.py b/pwnvasive/cli.py index 898ad20..03239d8 100644 --- a/pwnvasive/cli.py +++ b/pwnvasive/cli.py @@ -13,7 +13,7 @@ from .exceptions import * from .mappings import Mapping from .services import Service -from . import webapi + ### Subclass aiocmd to pass arguments to PromptSession @@ -500,7 +500,7 @@ def _extract_ssh_keys_completions(self): def do_decrypt_ssh_keys(self, selector=None): - n = self.store.op.decrypt_ssh_keys(selector) + n = self.op.decrypt_ssh_keys(selector) print(f"Decrypted {n} ssh keys") def do_extract_networks(self, selector=None): diff --git a/pwnvasive/mappings.py b/pwnvasive/mappings.py index 9947ba5..7bc0e77 100644 --- a/pwnvasive/mappings.py +++ b/pwnvasive/mappings.py @@ -282,8 +282,7 @@ async def get_reached(self): async def _test_creds(self, **creds): use_creds = creds.copy() ck = use_creds.pop("client_keys",None) - if ck: - use_creds["client_keys"] = asyncssh.import_private_key(ck) + use_creds["client_keys"] = asyncssh.import_private_key(ck) if ck else None opt = asyncssh.SSHClientConnectionOptions(**use_creds, known_hosts=None) if self.jump_host: jh = await self.store.nodes[self.jump_host].connect()