Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

Commit

Permalink
Initial upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rbenitezpagan committed Aug 19, 2020
1 parent 34ca509 commit eb545b3
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/www_release/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
background-color: black;
color: green;
}
16 changes: 16 additions & 0 deletions app/www_release/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>My App</title>

<link rel="stylesheet" href="css/style.css">

<script async type="text/javascript" src="js/script.js"></script>
</head>
<body>
<h1 id="myText"></h1>
</body>
</html>
4 changes: 4 additions & 0 deletions app/www_release/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var d = new Date();
var date = d.getMonth() + "/" + d.getDay() + "/" +d.getFullYear();
var todayString = "Today is " + date + "\n";
window.document.getElementById("myText").innerText = todayString.repeat(10);
4 changes: 4 additions & 0 deletions app/wwwroot/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
background-color: black;
color: green;
}
16 changes: 16 additions & 0 deletions app/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>My App</title>

<link rel="stylesheet" href="css/style.css">

<script async type="text/javascript" src="js/script.js"></script>
</head>
<body>
<h1 id="myText"></h1>
</body>
</html>
4 changes: 4 additions & 0 deletions app/wwwroot/js/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var d = new Date();
var date = d.getMonth() + "/" + d.getDay() + "/" +d.getFullYear();
var todayString = "Today is " + date + "\n";
window.document.getElementById("myText").innerText = todayString.repeat(10);
63 changes: 63 additions & 0 deletions files/script/dirChecker.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<#
.SYNOPSIS
Find new or changed files in a directory compared to a known-good image.
.DESCRIPTION
The script looks for file changes/additions between a production directory (target) with a known-good directory.
.PARAMETER knownGood
Path of the known-good directory.
.PARAMETER productionImage
Path of the production directory (target).
.INPUTS
System.String
.OUTPUTS
System.String
.EXAMPLE
.\dirChecker.ps1 -knownGood <PATH> -productionImage <PATH>
.\dirChecker.ps1 -knownGood .\knownGoodDir\ -productionImage .\targetDir\
.\dirChecker.ps1 -knownGood "D:\release3.0" -productionImage "C:\inetpub\wwwroot"
-- Input --
.\dirChecker.ps1 -knownGood "D:\Users\<user>\Documents\knownGoodDir" -productionImage "C:\Users\<user>\Documents\targetDir"
-- Output --
File analysis started.
Any file listed below is a new or changed file.
C:\Users\<user>\Documents\targetDir\index.html
C:\Users\<user>\Documents\targetDir\research.docx
C:\Users\<user>\Documents\targetDir\inventory.csv
C:\Users\<user>\Documents\targetDir\contactus.js
File analysis completed.
.LINK
https://github.com/nsacyber/Mitigating-Web-Shells
#>

<#
#
# Execution begins.
#
#>
param (
[Parameter(Mandatory=$TRUE)][ValidateScript({Test-Path $_ -PathType 'Container'})][String] $knownGood,
[Parameter(Mandatory=$TRUE)][ValidateScript({Test-Path $_ -PathType 'Container'})][String] $productionImage
)

# Recursively get all files in both directories, for each file calculate hash.
$good = Get-ChildItem -Force -Recurse -Path $knownGood | ForEach-Object { Get-FileHash -Path $_.FullName }
$prod = Get-ChildItem -Force -Recurse -Path $productionImage | ForEach-Object { Get-FileHash -Path $_.FullName }

Write-Host "File analysis started."
Write-Host "Any file listed below is a new or changed file.`n"

# Compare files hashes, select new or changed files, and print the path+filename.
(Compare-Object $good $prod -Property hash -PassThru | Where-Object{$_.SideIndicator -eq '=>'}).Path

Write-Host "`nFile analysis completed."
Binary file added files/zip/integrity_lab.zip
Binary file not shown.
28 changes: 28 additions & 0 deletions labs/lab_01/lab_01_instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Integrity Lab - Lab01

## Definition of Integrity

> *Data integrity is what the "I" in CIA Triad stands for. This is an essential component of the CIA Triad and designed to protect data from deletion or modification from any unauthorized party, and it ensures that when an authorized person makes a change that should not have been made the damage can be reversed.* [^1]
> *In information security, data integrity means maintaining and assuring the accuracy and completeness of data over its entire lifecycle. This means that data cannot be modified in an unauthorized or undetected manner. This is not the same thing as referential integrity in databases, although it can be viewed as a special case of consistency as understood in the classic ACID model of transaction processing. Information security systems typically provide message integrity alongside confidentiality.* [^2]
## What is Power Shell

> *PowerShell is a task-based command-line shell and scripting language built on .NET. PowerShell helps system administrators and power-users rapidly automate tasks that manage operating systems (Linux, macOS, and Windows) and processes.*
>
> *PowerShell commands let you manage computers from the command line. PowerShell providers let you access data stores, such as the registry and certificate store, as easily as you access the file system. PowerShell includes a rich expression parser and a fully developed scripting language.* [^3]
## Preparation

Download and unzip the integrity_lab.zip archive into your **Documents** folder.

If you don’t have the zip file you can directly download the individual required documents here:

The www_release folder will be used as your golden image; this concept will be explained later.


### Footnotes

[^1]: [What is the CIA Triad?](https://www.forcepoint.com/cyber-edu/cia-triad)
[^2]: [Information Security](https://en.wikipedia.org/wiki/Information_security#Integrity)
[^3]: [What is PowerShell?](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7)

0 comments on commit eb545b3

Please sign in to comment.