Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor bug fixes #3

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +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
```
Empty file modified bin/pwnvasive
100644 → 100755
Empty file.
145 changes: 145 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
## Documentation

### add
Add an instance of an object
```
add <obj> [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 <selector> <pth>
```

### cnx
Create 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 the instance of an object
```
del <obj> <selector>
```

### disconnect
End a session
```
disconnect [selector=None]
```

### eval
Evaluate a function
```
eval <cmd>
```

### 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 <obj> [selector=None]
```

### id
Identify the machine's operating system
```
id [selector=None]
```

### info
Display an abstract of a node's information
```
info <selector>
```

### ls
List objects and instances of an object
```
ls [obj=None] [selector=None]
```

### monitor
Display the actions that pwnvasive performs internally
```
monitor <what> [onoff='on']
```

### pdb
Debug pwnvasive
```
pdb
```

### quit
Exit the prompt
```
quit
```

### run
Run a command on a node
```
run <selector> <cmd>
```

### save
Save the database
```
save [fname=None]
```

### service
View / Start / Stop a service
```
service [svc=None] [startstop='start']
```

### show
Display the details of an object instance
```
show <obj> [selector=None]
```

### tasks
View current tasks
```
tasks
```

### update
Modify the variables of an object instance
```
update <obj> <selector> <vals>
```
10 changes: 5 additions & 5 deletions pwnvasive/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions pwnvasive/mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down