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

Update documentation #214

Merged
merged 2 commits into from
Mar 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion builddocs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
for f in doc/*.md ; do
out=`echo ${f/.md/.txt} | tr 'A-Z' 'a-z'`
pandoc -f markdown_github -t native $f \
| python -c "print __import__('re').sub('([,\\[](?:Link|Image) \\[[^\\]]*\\] \\(\")([^\\\"]*)(\",\"[^\\\"]*\"\\))', lambda x: x.groups()[0] + (('doc:' if x.groups()[1].split('#', 1)[0] else '') + ('#'.join([x.groups()[1].split('#', 1)[0].replace('.md', ''), x.groups()[1].split('#', 1)[1].replace('-', '_')]) if '#' in x.groups()[1] else x.groups()[1].replace('.md', '').replace('/', ':')) if ':' not in x.groups()[1] else x.groups()[1]) + x.groups()[2], __import__('sys').stdin.read())" \
| python2 -c "print __import__('re').sub('([,\\[](?:Link|Image) \\[[^\\]]*\\] \\(\")([^\\\"]*)(\",\"[^\\\"]*\"\\))', lambda x: x.groups()[0] + (('doc:' if x.groups()[1].split('#', 1)[0] else '') + ('#'.join([x.groups()[1].split('#', 1)[0].replace('.md', ''), x.groups()[1].split('#', 1)[1].replace('-', '_')]) if '#' in x.groups()[1] else x.groups()[1].replace('.md', '').replace('/', ':')) if ':' not in x.groups()[1] else x.groups()[1]) + x.groups()[2], __import__('sys').stdin.read())" \
| pandoc -f native -t dokuwiki \
| sed 's#\\\\ # #g' \
> "web/dokuwiki/$out"
Expand Down
6 changes: 3 additions & 3 deletions doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,11 @@ The value `WEB_LIMIT` from IVRE's configuration must match the value
### Getting HTTP screenshots ###

Nmap does not take HTTP screenshots by default. To do so, you need to
install the NSE script and the PhantomJS script manually which are
install the NSE script and the PhantomJS script manually which are
included in the docker files. The NSE file needs to be installed in
your nmap scripts folder. The `screenshot.js` needs to be copied
somewhere according to your PATH environment variable. For example,
on a Debian-based with nmap installed from sources:
somewhere according to your PATH environment variable. For example, on
a Debian-based with nmap installed from sources:

# cp docker/client/http-screenshot.nse /usr/local/share/nmap/scripts/
# cp docker/client/screenshot.js /usr/local/bin/
Expand Down
111 changes: 81 additions & 30 deletions web/dokuwiki/doc/agent.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,104 @@
====== Introduction ======

[[doc:README|IVRE]] agent is meant to be run in an environment not totally controlled (e.g., during a pentest, on a machine you have just owned and want to use to do some network recon without installing IVRE).
[[README.md|IVRE]] agent is meant to be run in an environment not\\
totally controlled (e.g., during a pentest, on a machine you have just\\
owned and want to use to do some network recon without installing\\
IVRE).

IVRE agent only requires nmap (of course), screen and rsync (plus ''%%/bin/sh%%'' and basic shell utils, including ''%%grep%%'').
IVRE agent only requires nmap (of course), screen and rsync (plus\\
''%%/bin/sh%%'' and basic shell utils, including ''%%grep%%'').

====== Installation ======

On the "master", install IVRE following the instructions of the [[doc:INSTALL|INSTALL]] file. Install also ''%%screen%%''.
On the "master", install IVRE following the instructions of the\\
[[INSTALL.md|INSTALL]] file. Install also ''%%screen%%''.

On the "slave(s)", the ''%%agent%%'' script must be deployed, together with ''%%nmap%%'', ''%%screen%%'' and ''%%rsync%%''.
On the "slave(s)", the ''%%agent%%'' script must be deployed, together with\\
''%%nmap%%'', ''%%screen%%'' and ''%%rsync%%''.

====== Run ======

===== On the slave(s) =====

The computer running IVRE (the "master") needs to be able to access via ''%%rsync%%'' the data directory of the agents (to add targets and to retrieve results): this is not an issue if you are running the agent and IVRE itself on the same machine. If you are running IVRE and the agent on two different hosts (and, except for simple or testing configurations, you should do that), you have to run ''%%sshd%%'' or ''%%rsyncd%%'' on the agent host, or share the agent files (using NFS, SMB or whatever the IVRE side can mount).
The computer running IVRE (the "master") needs to be able to access\\
via ''%%rsync%%'' the data directory of the agents (to add targets and to\\
retrieve results): this is not an issue if you are running the agent\\
and IVRE itself on the same machine. If you are running IVRE and the\\
agent on two different hosts (and, except for simple or testing\\
configurations, you should do that), you have to run ''%%sshd%%'' or\\
''%%rsyncd%%'' on the agent host, or share the agent files (using NFS, SMB\\
or whatever the IVRE side can mount).

First, ''%%mkdir%%'' & ''%%cd%%'' to the directory you want to use as your agent data directory.
First, ''%%mkdir%%'' & ''%%cd%%'' to the directory you want to use as your agent\\
data directory.

Make sure the needed binaries are in the ''%%PATH%%'' environment variable (including ''%%nmap%%'' and ''%%screen%%''), adapt if needed the variables at the beginning of the script, particularly ''%%NMAPOPTS%%'', ''%%NMAPSCRIPTS%%'' and ''%%THREADS%%''.
Make sure the needed binaries are in the ''%%PATH%%'' environment variable\\
(including ''%%nmap%%'' and ''%%screen%%''), adapt if needed the variables at the\\
beginning of the script, particularly ''%%NMAPOPTS%%'', ''%%NMAPSCRIPTS%%'' and\\
''%%THREADS%%''.

Values for ''%%NMAPOPTS%%'' and ''%%NMAPSCRIPTS%%'' cause scans similar to those run by ''%%ivre runscans%%'' by default (with IVRE's default template). To get options from other templates, run ''%%ivre runscans --nmap-template aggressive%%'' (for example) and copy the corresponding values in the ''%%agent%%'' script.
Values for ''%%NMAPOPTS%%'' and ''%%NMAPSCRIPTS%%'' cause scans similar to those\\
run by ''%%ivre runscans%%'' by default (with IVRE's default template). To\\
get options from other templates, run ''%%ivre runscans --nmap-template aggressive%%'' (for example) and copy the corresponding values in the\\
''%%agent%%'' script.

Then just run the ''%%agent%%'' script.

The script will start ''%%screen%%'', and you can just detach by using (if you have the default key bindings): ''%%C-a d%%''.
The script will start ''%%screen%%'', and you can just detach by using (if\\
you have the default key bindings): ''%%C-a d%%''.

When the scan is over, to stop the agent, reattach the screen session by running ''%%screen -r%%'', and type ''%%C-c%%'' as many times as needed to kill all the instances of the script and get back to your shell.
When the scan is over, to stop the agent, reattach the screen session\\
by running ''%%screen -r%%'', and type ''%%C-c%%'' as many times as needed to kill\\
all the instances of the script and get back to your shell.

Please refer to ''%%screen%%'' documentation if you need.

===== On the master =====

You need to make sure the user running ''%%ivre runscansagent%%'' or ''%%ivre runscansagentdb%%'' on the "master" can access (without password) to the agents data directories.
You need to make sure the user running ''%%ivre runscansagent%%'' or ''%%ivre runscansagentdb%%'' on the "master" can access (without password) to the\\
agents data directories.

When the agents are all ready, you have two options, using ''%%ivre runscansagent%%'' or ''%%ivre runscansagentdb%%''. In both cases, scan options are the same than with ''%%ivre runscans%%''.
When the agents are all ready, you have two options, using ''%%ivre runscansagent%%'' or ''%%ivre runscansagentdb%%''. In both cases, scan options\\
are the same than with ''%%ivre runscans%%''.

The first one (''%%ivre runscansagent%%'') is the "old-school" version: it will not allow to dynamically add or remove agents, and will fetch the results under ''%%./agentsdata/output%%'' directory, you have to import the results by yourself.
The first one (''%%ivre runscansagent%%'') is the "old-school" version: it\\
will not allow to dynamically add or remove agents, and will fetch the\\
results under ''%%./agentsdata/output%%'' directory, you have to import the\\
results by yourself.

On the other hand, the second one (''%%ivre runscansagentdb%%'') will use the DB to manage the agents, but is still experimental.
On the other hand, the second one (''%%ivre runscansagentdb%%'') will use\\
the DB to manage the agents, but is still experimental.

==== ivre runscansagent, the "old-school" one ====

You have to specify the agent(s) data directory. For example, run:

<code>$ ivre runscansagent --routable --limit 1000 \
<code>
$ ivre runscansagent --routable --limit 1000 \
> agenthost1:/path/to/agent/dir \
> agenthost2:/path/to/agent/dir \</code>
You can now import the results as if you had run the "regular" ''%%ivre runscans%%'' program to scan locally, see [[doc:README|README]]. The results are stored under ''%%agentsdata/output/%%''
> agenthost2:/path/to/agent/dir \
</code>
You can now import the results as if you had run the "regular" ''%%ivre runscans%%'' program to scan locally, see [[README.md|README]]. The\\
results are stored under ''%%agentsdata/output/%%''

==== ivre runscansagentdb, the "modern" (but probably broken) one ====

Please note that it is important to run all the ''%%ivre runscansagentdb%%'' from the same host (the "master", which does not need to be the same host than the database server), since it relies on local directories.
Please note that it is important to run all the ''%%ivre runscansagentdb%%'' from the same host (the "master", which does not\\
need to be the same host than the database server), since it relies on\\
local directories.

First, let's create a master and add the agent(s):

<code>$ ivre runscansagentdb --add-local-master
<code>
$ ivre runscansagentdb --add-local-master
$ ivre runscansagentdb --source MySource --add-agent \
> agenthost1:/path/to/agent/dir \
> agenthost2:/path/to/agent/dir</code>
> agenthost2:/path/to/agent/dir
</code>
Let's check it's OK:

<code>$ ivre runscansagentdb --list-agents
<code>
$ ivre runscansagentdb --list-agents
agent:
- id: 543bfc8a312f915728f1709b
- source name: MySource
Expand All @@ -85,13 +122,17 @@ agent:
- currently synced: True
- max waiting targets: 60
- waiting targets: 0
- can receive: 60</code>
- can receive: 60
</code>
Now we can add a scan, and assign the (available) agents to that scan:

<code>$ ivre runscansagentdb --assign-free-agents --routable --limit 1000</code>
<code>
$ ivre runscansagentdb --assign-free-agents --routable --limit 1000
</code>
And see if it works:

<code>$ ivre runscansagentdb --list-scans
<code>
$ ivre runscansagentdb --list-scans
scan:
- id: 543bfcbf312f9158d6caeadf
- categories:
Expand All @@ -103,16 +144,26 @@ scan:
- internal state: (2174385484, 551641673, 387527645, 0)
- agents:
- 543bfc8a312f915728f1709b
- 543bfc8a312f915728f1709c</code>
For now, nothing has been sent to the agents. To really start the process, run:
- 543bfc8a312f915728f1709c
</code>
For now, nothing has been sent to the agents. To really start the\\
process, run:

<code>$ ivre runscansagentdb --daemon</code>
After some time, the first results get imported in the database (''%%READING [...]%%'', ''%%HOST STORED: [...]%%'', ''%%SCAN STORED: [...]%%''). You can stop the daemon at any time by ''%%(p)kill%%''-ing it (using ''%%CTRL+c%%'' will do).
<code>
$ ivre runscansagentdb --daemon
</code>
After some time, the first results get imported in the database\\
(''%%READING [...]%%'', ''%%HOST STORED: [...]%%'', ''%%SCAN STORED: [...]%%''). You can\\
stop the daemon at any time by ''%%(p)kill%%''-ing it (using ''%%CTRL+c%%'' will\\
do).

When all the targets have been sent to an agent, the agents get disassociated from the scan so that another scan can use them. You can check the scan evolution by issuing ''%%ivre runscansagentdb --list-scans%%''.
When all the targets have been sent to an agent, the agents get\\
disassociated from the scan so that another scan can use them. You can\\
check the scan evolution by issuing ''%%ivre runscansagentdb --list-scans%%''.


----

This file is part of IVRE. Copyright 2011 - 2015 [[mailto:pierre.lalet@cea.fr|Pierre LALET]]
This file is part of IVRE. Copyright 2011 - 2015\\
[[mailto:pierre.lalet@cea.fr|Pierre LALET]]