An open API service indexing awesome lists of open source software.

https://github.com/bjoern-hempel/apache-host-viewer

An apache host viewer to list all provided hosts and vhosts on current system.
https://github.com/bjoern-hempel/apache-host-viewer

analyzer apache2 bash certificate checker domain friends-of-bash html json markup mit-license service ssl systeminfo vhost

Last synced: about 2 months ago
JSON representation

An apache host viewer to list all provided hosts and vhosts on current system.

Awesome Lists containing this project

README

          

# An apache host viewer

An apache host viewer to list all provided host and vhosts on current system.

## A.) First usage

### A.1) installation

This application uses the friends of bash libraries (https://github.com/bjoern-hempel/friends-of-bash). Check that the libraries are available:

```
user$ friends-of-bash --version
friends-of-bash/v0.0.11
```

If you can see a similar friends of bash version output like above, you can now install this application:

```
user$ sudo -E friends-of-bash install "git@github.com:bjoern-hempel/apache-host-viewer.git"
```

If you don't have installed the friends of bash libraries, please install them first. In short:

```
user$ cd ~ && git clone git@github.com:bjoern-hempel/friends-of-bash.git && cd friends-of-bash
user$ sudo -E bin/install
user$ cd .. && rm -rf friends-of-bash
```

## 1.) Usage

### 1.1) Show the help dialog (`--help`)

```
user$ apache-host-viewer --help

An apache host viewer (v0.0.36) by Björn Hempel .

Usage: apache-host-viewer [options...]
-h, --help Shows this help.
-v, --version Shows the version number.

-l, --only-list-domains Only list the domains, that are available on this system.

-m, --markdown Shows the output as markdown and disable all other output types (json, html) - default output
-j, --json Shows the output as json and disable all other output types (markdown, html)
--html Shows the output as html and disable all other output types (markdown, json)
--compress-json Compress the outputted json.

--output-target Writes also the result into this target folder.
--output-name Set the output name (default is "index").
--create-markdown Creates a markdown file (--output-target must be set).
--create-json Creates a json file (--output-target must be set).
--create-html Creates a html file (--output-target must be set).

-i, --install-live-view Installs the live view api.

-s, --show-system-info Shows system informations.
--show-links Shows links inside the markdown and html file.
--show-ssl-certificates Shows the ssl certificates.
--show-domain-list Shows a separated domain list.

-d, --docker-container Checks a docker machine instead of the local machine.

--disable-vhost-parser Disable the vhost parser.

--silence Disable the output.
```

### 1.2) Simply get all DocumentRoots as markdown markup language

The script uses the DUMP_VHOSTS function from `apachectl` (`apachectl -S`). This requires sudo credentials:

```
user$ sudo apache-host-viewer
```

The markdown result could be:

```
### Projects

- file:///var/www/de/rsm-live/wmbw/start-up-bw/www/html/current/web
- targets:
- http://www.start-up-bw.wmbw.rsm-live.de
- http://start-up-bw.wmbw.rsm-live.de
- https://www.start-up-bw.wmbw.rsm-live.de
- https://start-up-bw.wmbw.rsm-live.de
- ssl: true
- app: HTML project
- version: unknown
- file:///var/www/html
- targets:
- http://wmbw.rsm-live.de
- http://www.wmbw.rsm-live.de
- http://wmbw.rsm-live.de
- https://www.wmbw.rsm-live.de
- https://wmbw.rsm-live.de
- ssl: true
- app: HTML project
- version: unknown
- https://www.startupgipfel.de/registration/
- targets:
- http://www.start-up-bw.de
- http://start-up-bw.de
- http://www.startupbw.de
- http://startupbw.de
- ssl: false
- app: redirection
- version: not available
- file:///var/www/de/rsm-stage/wmbw/start-up-bw/www/html/current/web
- targets:
- http://www.start-up-bw.wmbw.rsm-stage.de
- http://start-up-bw.wmbw.rsm-stage.de
- https://www.start-up-bw.wmbw.rsm-stage.de
- https://start-up-bw.wmbw.rsm-stage.de
- ssl: true
- app: TYPO3
- version: 8.7.1
```

### 1.3) HTML output (`--html`)

The script uses the DUMP_VHOSTS function from `apachectl` (`apachectl -S`). This requires sudo credentials:

```
user$ sudo apache-host-viewer --html
```

The markdown result could be:

```





wmbw.rsm-live.de


.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 45px;
}




Projects


```

### 1.4) JSON output (`--json`)

The script uses the DUMP_VHOSTS function from `apachectl` (`apachectl -S`). This requires sudo credentials:

```
user$ sudo apache-host-viewer --json
```

The markdown result could be:

```
{
"projects": {
"file:///var/www/de/rsm-live/wmbw/start-up-bw/www/html/current/web": {
"domains": [
"http://www.start-up-bw.wmbw.rsm-live.de",
"http://start-up-bw.wmbw.rsm-live.de",
"https://www.start-up-bw.wmbw.rsm-live.de",
"https://start-up-bw.wmbw.rsm-live.de"
],
"ssl": true,
"app": "HTML project",
"version": "unknown"
},
"file:///var/www/html": {
"domains": [
"http://wmbw.rsm-live.de",
"http://www.wmbw.rsm-live.de",
"http://wmbw.rsm-live.de",
"https://www.wmbw.rsm-live.de",
"https://wmbw.rsm-live.de"
],
"ssl": true,
"app": "HTML project",
"version": "unknown"
},
"https://www.startupgipfel.de/registration/": {
"domains": [
"http://www.start-up-bw.de",
"http://start-up-bw.de",
"http://www.startupbw.de",
"http://startupbw.de"
],
"ssl": false,
"app": "redirection",
"version": "not available"
},
"file:///var/www/de/rsm-stage/wmbw/start-up-bw/www/html/current/web": {
"domains": [
"http://www.start-up-bw.wmbw.rsm-stage.de",
"http://start-up-bw.wmbw.rsm-stage.de",
"https://www.start-up-bw.wmbw.rsm-stage.de",
"https://start-up-bw.wmbw.rsm-stage.de"
],
"ssl": true,
"app": "TYPO3",
"version": "8.7.1"
}
}
}
```

### 1.5) Add some additional system informations (`--show-system-info`)

The script uses the DUMP_VHOSTS function from `apachectl` (`apachectl -S`). This requires sudo credentials:

```
user$ sudo apache-host-viewer --show-system-info
```

The markdown result could be:

```
### System informations

| Name | Value |
| ---- | ----- |
| document created at | 2017-05-28 16:38:38 |
| full os name | Linux Debian 8.8 (3.16.0-4-amd64 x86_64) |
| number of cpus | 4 |
| ram size in gb | 15.6774 |
| hd disc size in gb | 219 |
| used hd disc size | 2 % |
| number of updateable applications | 0 |
| php version | 7.0.19-1~dotdeb+8.1 |
| mysql version | 5.5.55 |

### Users

| Username | Fullname |
| ---- | ----- |
| bjoern | Björn Hempel |
| user2 | User 2 |
| user3 | User 3 |

### Projects

- file:///var/www/de/rsm-live/wmbw/start-up-bw/www/html/current/web
- targets:
- http://www.start-up-bw.wmbw.rsm-live.de
- http://start-up-bw.wmbw.rsm-live.de
- https://www.start-up-bw.wmbw.rsm-live.de
- https://start-up-bw.wmbw.rsm-live.de
- ssl: true
- app: HTML project
- version: unknown
- file:///var/www/html
- targets:
- http://wmbw.rsm-live.de
- http://www.wmbw.rsm-live.de
- http://wmbw.rsm-live.de
- https://www.wmbw.rsm-live.de
- https://wmbw.rsm-live.de
- ssl: true
- app: HTML project
- version: unknown
- https://www.startupgipfel.de/registration/
- targets:
- http://www.start-up-bw.de
- http://start-up-bw.de
- http://www.startupbw.de
- http://startupbw.de
- ssl: false
- app: redirection
- version: not available
- file:///var/www/de/rsm-stage/wmbw/start-up-bw/www/html/current/web
- targets:
- http://www.start-up-bw.wmbw.rsm-stage.de
- http://start-up-bw.wmbw.rsm-stage.de
- https://www.start-up-bw.wmbw.rsm-stage.de
- https://start-up-bw.wmbw.rsm-stage.de
- ssl: true
- app: TYPO3
- version: 8.7.1
```

You can use this parameter in combination with all other parameters (--markdown, --json, --html, --create-markdown, --create-json, --create-html).

### 1.6) Create md file into a given folder (`--output-target`)

The following command will create a markdown file (`index.md`) into the folder `/var/ww/html/server`. The following command also prints the markdown result on the screen:

```
user$ sudo apache-host-viewer --output-target=/var/www/html/server --output-name=index
```

### 1.7) What's with json and html files? (`--create-json` and `--create-html`)

Here it comes. It will also create a `index.html` and a `index.json` file into the folder `/var/ww/html/server`:

```
user$ sudo apache-host-viewer --output-target=/var/www/html/server --output-name=index --create-json --create-html
```

### 1.8) Suppress the default output (`--silence`)

You can suppress all outputs (except error messages) with the parameter `--silence`. This is usefull if you like to use this command as a cronjob task. The following command creates a md, a json and a html file into the folder `/var/www/html/server` and don't output any message to the command line:

```
user$ sudo apache-host-viewer --output-target=/var/www/html/server --output-name=index --show-system-info --show-links --create-json --create-html --silence
```

### 1.9) Check docker container instead of local system

TODO..

## B.) License

MIT © [Björn Hempel](https://www.ixno.de)

Have fun! :)