diff --git a/demos/apache.ps1 b/demos/apache.ps1 new file mode 100644 index 0000000000..e9f3cd2bcf --- /dev/null +++ b/demos/apache.ps1 @@ -0,0 +1,14 @@ +# Get-ApacheVHosts +# Enumerate configured virtual hosts (web sites) on an apache server + +# New-ApacheVHost +# Given defined parameters, create a $ServerName.conf virtual host config file at $VHostsDirectory + +# Get-ApacheModules +# List installed Apache Modules + +# Demo execution: +# Run Get-ApacheVHosts and enumerate configured virtual hosts +# Run Get-ApacheModules to show installed Apache modules +# Run New-ApacheVHost to create a new virtual host and restart Apache +# Run Get-ApacheVhosts to show the newly created virtual host diff --git a/demos/crontab.ps1 b/demos/crontab.ps1 new file mode 100644 index 0000000000..d90e2dbdb8 --- /dev/null +++ b/demos/crontab.ps1 @@ -0,0 +1,9 @@ +# Use the crontab module available at ./modules/CronTab + +# Get the existing cron jobs + +# Sort them by data + +# Create a new one using a DateTime object + +# Show in bash that the new cron job exists diff --git a/demos/dsc.ps1 b/demos/dsc.ps1 new file mode 100644 index 0000000000..c1fdd69037 --- /dev/null +++ b/demos/dsc.ps1 @@ -0,0 +1,11 @@ +# DSC MOF Compilation +# DSC Configuration() script that: +# Defines base configuration users, groups, settings +# Uses PS function to set package configuration (ensure=Present) for an array of packages +# Probes for the existence of a package (Apache or MySQL) and conditionally configures the workload. I.e., if Apache is installed, configure Apache settings + +# Demo execution: +# Show the .ps1 +# Run the .ps1 to generate a MOF +# Apply the MOF locally with Start-DSCConfiguration +# Show the newly configured state \ No newline at end of file diff --git a/demos/json.ps1 b/demos/json.ps1 new file mode 100644 index 0000000000..4804ffc699 --- /dev/null +++ b/demos/json.ps1 @@ -0,0 +1,11 @@ +# Get-Mongostat +# Get mongodb statistics with parsed JSON + +# journalctl is a native tool to emit SystemD's journal, which includes diagnostic info pertaining to SystemD services +# Show-JournalCtl +# Given journalctl parameters, run journalctl with a -o json to emit JSON, e.g. journalctl $Parameters -o json --no-pager +# Return structured data from Journal + +# Demo execution +# Show journatcl example +# Using Where & Sort, filter journal output to drill into a specific problem (e.g. service failed to start) \ No newline at end of file diff --git a/demos/remoting.ps1 b/demos/remoting.ps1 new file mode 100644 index 0000000000..fe909db1b9 --- /dev/null +++ b/demos/remoting.ps1 @@ -0,0 +1,2 @@ +# Show PSRP working over OpenSSH +# Includes Windows -> Linux and Linux -> Windows \ No newline at end of file diff --git a/demos/rest.ps1 b/demos/rest.ps1 new file mode 100644 index 0000000000..a7b8c799fd --- /dev/null +++ b/demos/rest.ps1 @@ -0,0 +1,7 @@ +# Get all repositories from the GitHub API, sort by most pull requests, most stars, most forks, etc. + +# Get repo info (json) from the github api +# Convert json to PS object +# Set the private status to false +# Convert back to json +# Push the new json back to the github api \ No newline at end of file diff --git a/demos/xml.ps1 b/demos/xml.ps1 new file mode 100644 index 0000000000..151ee628fb --- /dev/null +++ b/demos/xml.ps1 @@ -0,0 +1,42 @@ +Dev: XML legacy [ETS?] +What are some xml workloads we can simplify with XML parsing? +Maybe cracking open some repository metadata? +JEE servers use XML pretty extensively for configuration. Perhaps a script to adjust JEE server settings? Obviously, parsing XML in bash is fraught with danger... + +PS /etc/tomcat> $tomcatserverfile="/usr/share/tomcat/conf/server.xml" +PS /etc/tomcat> [xml]$tomcatconfig=Get-Content $tomcatserverfile +PS /etc/tomcat> $tomcatconfig.Server + + +port : 8005 +shutdown : SHUTDOWN +#comment : { Security listener. Documentation at /docs/config/listeners.html + + , APR library loader. Documentation at /docs/apr.html , Initialize Jasper prior to webapps are loaded. Documentation at + /docs/jasper-howto.html , Prevent memory leaks due to use of particular java/javax APIs...} +Listener : {Listener, Listener, Listener, Listener...} +GlobalNamingResources : GlobalNamingResources +Service : Service + + + + +PS /etc/tomcat> $tomcatconfig.Server.port +8005 +PS /etc/tomcat> $tomcatconfig.Server.Listener + +className SSLEngine +--------- --------- +org.apache.catalina.core.AprLifecycleListener on +org.apache.catalina.core.JasperListener +org.apache.catalina.core.JreMemoryLeakPreventionListener +org.apache.catalina.mbeans.GlobalResourcesLifecycleListener +org.apache.catalina.core.ThreadLocalLeakPreventionListener + + +PS /etc/tomcat> $tomcatconfig.Server.Service + +name #comment +---- -------- +Catalina {The connectors can use a shared executor, you can define one or more named thread pools, ... +