Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Brooks committed Feb 22, 2021
0 parents commit 7ef06f7
Show file tree
Hide file tree
Showing 30 changed files with 2,004 additions and 0 deletions.
96 changes: 96 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Active Directory Reporting Tool

This tool provides the ability to query groups in Active Directory Domains and display a list of their members.


### Prerequisites

The tool needs to be ran on a Windows instance which has connectivity to the Domain being queried. It doen't need to be ran on a Domain Controller.

The user running the tool must have local Administrator privileges on the machine being ran on.

Git, in order to clone the repository

A modern browser such as Chrome or Firefox



### Starting the application

Clone this repository locally

Navigate to the adaudit directory and run the server.ps1 script as Administrator
When prompted select Y

### Stopping the application

Close the powershell window


## Architecture

The tool has the following components :

* A restful API served by Pode (server/ps1)
* A number of views (index, groups) served by HTML and JQuery. The web pages are served by asynchronous ajax API calls to the Pode API

### Application components

The main components of the application are as follows:

| File | Type | Purpose |
| :------------- |:-----------------|:---------
| views | folder | Available views |
| public | folder | Public assets (stylesheets, javascript etc |
| server.ps1 | powershell script | entrypoint to the application |
| adaudit.bat | bash script | wrapper scrript to start the application |
| views/index.html | html file | Landing view containing login screen and Domain selection |
| views/groups.html | html file | Group selection and membership view |



### To add another view

Add another route entry similar to the following :

```
Add-PodeRoute -Method Get -Path '/groups' -ScriptBlock {
Write-PodeViewResponse -Path 'groups'
}
```

### To add another route

Add the payload of the route
```
Add-PodeRoute -Method Get -Path '/login/:username/:password/:hostname' -ScriptBlock {
-- CODE --
Write-PodeJsonResponse -Value @{ 'fooo' = $bar }
}
```
In this example login is the path, username,password and hostname are parameters which can be used via the following syntax :

```
$WebEvent.Parameters['username']
```

### Channging the listener port

In server.ps1 change 8080 to the desired port on thee following line:

```
Add-PodeEndpoint -Address * -Port 8080 -Protocol Http
```


## Built With

* [Pode](https://badgerati.github.io/Pode/) - The web framework used
* [JQuery](https://jquery.com/) - Javascript framework
* HTML


## Authors

* **Rob Brooks**
1 change: 1 addition & 0 deletions adaudit.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runas /profile /user:Administrator "powershell ./server.ps1"
Binary file added public/assets/fonts/bold-affa96571d-v2.woff
Binary file not shown.
Binary file added public/assets/fonts/bold-b542beb274-v2.woff2
Binary file not shown.
Binary file added public/assets/fonts/light-94a07e06a1-v2.woff2
Binary file not shown.
Binary file added public/assets/fonts/light-f591b13f7d-v2.woff
Binary file not shown.
Binary file added public/assets/images/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/govuk-apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/govuk-crest-2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/govuk-crest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/govuk-logotype-crown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions public/assets/images/govuk-mask-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/govuk-opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/images/loading1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions public/javascript/ad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function includeHTML() {
var z, i, elmnt, file, xhttp;
/* Loop through a collection of all HTML elements: */
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
if (file) {
/* Make an HTTP request using the attribute value as the file name: */
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/* Remove the attribute, and call this function once more: */
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/* Exit the function: */
return;
}
}
}


function parseDate(date) {
try {
var utcSeconds = parseInt((date).substring(6, 19));
parsedDate = new Date(utcSeconds);
} catch {
parsedDate="";
}
return parsedDate;
}

function makeTextFile(text) {
var textFile = null;
var data = new Blob([text], {type: 'text/plain'});
// "data:text/csv;charset=utf-8," +
// If we are replacing a previously generated file we need to
// manually revoke the object URL to avoid memory leaks.
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
}
1 change: 1 addition & 0 deletions public/javascript/govuk-frontend-3.10.2.min.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions public/styles/govuk-frontend-3.10.2.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/styles/govuk-frontend-ie8-3.10.2.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 7ef06f7

Please sign in to comment.