Created
March 21, 2024 19:58
-
-
Save devshades-au/f72cda27fbef14b3c0b3458f5636642a to your computer and use it in GitHub Desktop.
Powershell Reference Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<center> | |
<div class="container"> | |
<h1 class="mb-4">PowerShell</h1><hr/> | |
<!-- Combobox for selecting a category --> | |
<div class="mb-4 slim"> | |
<!-- <label for="categorySelect" class="form-label">Select Category:</label> --> | |
<select class="form-select" id="categorySelect" onchange="populateCommands()"> | |
<option value="">Select Category</option> | |
<option value="Networking">Networking</option> | |
<option value="Filesystem">Filesystem</option> | |
<option value="System">System</option> | |
<option value="Registry">Registry</option> | |
<option value="Active Directory">Active Directory</option> <!-- Added option --> | |
<option value="User Management">User Management</option> <!-- Added option --> | |
<option value="Event Viewer">Event Viewer</option> <!-- Added option --> | |
</select> | |
</div> | |
<!-- Combobox for selecting a command within the selected category --> | |
<div class="mb-4 slim" id="commandsContainer" style="display: none;"> | |
<!-- <label for="commandSelect" class="form-label">Select Command:</label> --> | |
<select class="form-select" id="commandSelect" onchange="displayCommand()"> | |
<option value="">Select Command</option> | |
</select> | |
</div> | |
<!-- Table to display command information --> | |
<div id="commandInfo" style="display: none;"> | |
<h2>Command Details</h2> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Command</th> | |
<th>Description</th> | |
<th>Arguments</th> | |
<th>Example</th> | |
</tr> | |
</thead> | |
<tbody id="commandInfoBody"> | |
</tbody> | |
</table> | |
</div> | |
<div> | |
Made with ☕ by Devshades | |
</div> | |
</div> | |
</center> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const commandsData = { | |
"Networking": [ | |
{ | |
"Command": "Test-NetConnection", | |
"Description": "Checks network connectivity to a specified destination by sending ICMP Echo requests or establishing a TCP connection.", | |
"Arguments": "-ComputerName <computer_name>", | |
"Example": "Test-NetConnection -ComputerName google.com" | |
}, | |
{ | |
"Command": "Get-NetAdapter", | |
"Description": "Retrieves information about network adapters installed on the system.", | |
"Arguments": "", | |
"Example": "Get-NetAdapter" | |
}, | |
// More networking commands can be added here | |
], | |
"Filesystem": [ | |
{ | |
"Command": "Get-ChildItem", | |
"Description": "Retrieves the child items (files and directories) in a specified directory.", | |
"Arguments": "-Path <path>", | |
"Example": "Get-ChildItem -Path C:\\" | |
}, | |
// More filesystem commands can be added here | |
], | |
"System": [ | |
{ | |
"Command": "Get-Process", | |
"Description": "Retrieves information about processes running on the local computer.", | |
"Arguments": "", | |
"Example": "Get-Process" | |
}, | |
// More system commands can be added here | |
], | |
"Registry": [ | |
{ | |
"Command": "Get-ItemProperty", | |
"Description": "Retrieves the properties of a registry key.", | |
"Arguments": "-Path <registry_key>", | |
"Example": "Get-ItemProperty -Path HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run" | |
}, | |
// More registry commands can be added here | |
], | |
"Active Directory": [ | |
{ | |
"Command": "Get-ADUser", | |
"Description": "Retrieves information about Active Directory users.", | |
"Arguments": "-Filter <filter>", | |
"Example": "Get-ADUser -Filter *" | |
}, | |
{ | |
"Command": "Get-ADComputer", | |
"Description": "Retrieves information about Active Directory computers.", | |
"Arguments": "-Filter <filter>", | |
"Example": "Get-ADComputer -Filter *" | |
}, | |
{ | |
"Command": "New-ADUser", | |
"Description": "Creates a new Active Directory user account.", | |
"Arguments": "-Name <name> -Path <ou_path>", | |
"Example": "New-ADUser -Name JohnDoe -Path 'OU=Users,DC=example,DC=com'" | |
}, | |
{ | |
"Command": "Remove-ADUser", | |
"Description": "Removes an Active Directory user account.", | |
"Arguments": "-Identity <user_identity>", | |
"Example": "Remove-ADUser -Identity JohnDoe" | |
}, | |
{ | |
"Command": "Get-ADGroup", | |
"Description": "Retrieves information about Active Directory groups.", | |
"Arguments": "-Filter <filter>", | |
"Example": "Get-ADGroup -Filter *" | |
}, | |
{ | |
"Command": "Add-ADGroupMember", | |
"Description": "Adds a member to an Active Directory group.", | |
"Arguments": "-Identity <group_identity> -Members <members>", | |
"Example": "Add-ADGroupMember -Identity 'Marketing' -Members 'JohnDoe'" | |
}, | |
{ | |
"Command": "Remove-ADGroupMember", | |
"Description": "Removes a member from an Active Directory group.", | |
"Arguments": "-Identity <group_identity> -Members <members>", | |
"Example": "Remove-ADGroupMember -Identity 'Marketing' -Members 'JohnDoe'" | |
}, | |
// More Active Directory commands can be added here | |
], | |
"User Management": [ | |
{ | |
"Command": "New-LocalUser", | |
"Description": "Creates a new local user account.", | |
"Arguments": "-Name <name> -Password <password>", | |
"Example": "New-LocalUser -Name John -Password Pass123" | |
}, | |
{ | |
"Command": "Remove-LocalUser", | |
"Description": "Removes a local user account.", | |
"Arguments": "-Name <name>", | |
"Example": "Remove-LocalUser -Name John" | |
}, | |
{ | |
"Command": "Get-LocalGroup", | |
"Description": "Retrieves information about local groups.", | |
"Arguments": "-Name <group_name>", | |
"Example": "Get-LocalGroup -Name Administrators" | |
}, | |
{ | |
"Command": "Add-LocalGroupMember", | |
"Description": "Adds a member to a local group.", | |
"Arguments": "-Group <group_name> -Member <member_name>", | |
"Example": "Add-LocalGroupMember -Group Administrators -Member John" | |
}, | |
{ | |
"Command": "Remove-LocalGroupMember", | |
"Description": "Removes a member from a local group.", | |
"Arguments": "-Group <group_name> -Member <member_name>", | |
"Example": "Remove-LocalGroupMember -Group Administrators -Member John" | |
}, | |
{ | |
"Command": "Get-LocalGroupMember", | |
"Description": "Retrieves the members of a local group.", | |
"Arguments": "-Group <group_name>", | |
"Example": "Get-LocalGroupMember -Group Administrators" | |
}, | |
// More user management commands can be added here | |
], | |
"Event Viewer": [ | |
{ | |
"Command": "Get-WinEvent", | |
"Description": "Retrieves event log entries from event logs on local and remote computers.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Get-WinEvent -LogName System" | |
}, | |
{ | |
"Command": "Clear-EventLog", | |
"Description": "Clears one or more event logs.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Clear-EventLog -LogName Application" | |
}, | |
{ | |
"Command": "Limit-EventLog", | |
"Description": "Limits the size of an event log.", | |
"Arguments": "-LogName <log_name> -MaximumSize <size>", | |
"Example": "Limit-EventLog -LogName Security -MaximumSize 1GB" | |
}, | |
{ | |
"Command": "Get-EventLog", | |
"Description": "Retrieves the events in the event logs on the local and remote computers.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Get-EventLog -LogName System" | |
}, | |
{ | |
"Command": "New-EventLog", | |
"Description": "Creates a new event log and a new event source on a local or remote computer.", | |
"Arguments": "-LogName <log_name> -Source <source>", | |
"Example": "New-EventLog -LogName MyAppLog -Source MyApp" | |
}, | |
{ | |
"Command": "Remove-EventLog", | |
"Description": "Deletes an event log or unregisters an event source.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Remove-EventLog -LogName MyAppLog" | |
}, | |
{ | |
"Command": "Write-EventLog", | |
"Description": "Writes an event to an event log.", | |
"Arguments": "-LogName <log_name> -Source <source> -EventId <event_id> -Message <message>", | |
"Example": "Write-EventLog -LogName Application -Source MyApp -EventId 1000 -Message 'An error occurred.'" | |
}, | |
{ | |
"Command": "Show-EventLog", | |
"Description": "Displays the properties of one or more event logs.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Show-EventLog -LogName System" | |
}, | |
{ | |
"Command": "Get-WinEvent", | |
"Description": "Retrieves event log entries from event logs on local and remote computers.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Get-WinEvent -LogName System" | |
}, | |
{ | |
"Command": "Clear-EventLog", | |
"Description": "Clears one or more event logs.", | |
"Arguments": "-LogName <log_name>", | |
"Example": "Clear-EventLog -LogName Application" | |
}, | |
{ | |
"Command": "Limit-EventLog", | |
"Description": "Limits the size of an event log.", | |
"Arguments": "-LogName <log_name> -MaximumSize <size>", | |
"Example": "Limit-EventLog -LogName Security -MaximumSize 1GB" | |
} | |
// More event viewer commands can be added here | |
] | |
} | |
// Function to populate commands combobox based on selected category | |
function populateCommands() { | |
const categorySelect = document.getElementById('categorySelect'); | |
const category = categorySelect.options[categorySelect.selectedIndex].value; | |
const commandSelect = document.getElementById('commandSelect'); | |
commandSelect.innerHTML = '<option value="">Select Command</option>'; | |
if (category) { | |
commandsData[category].forEach(command => { | |
const option = document.createElement('option'); | |
option.value = command.Command; | |
option.text = command.Command; | |
commandSelect.appendChild(option); | |
}); | |
document.getElementById('commandsContainer').style.display = 'block'; | |
} else { | |
document.getElementById('commandsContainer').style.display = 'none'; | |
document.getElementById('commandInfo').style.display = 'none'; | |
document.getElementById('commandInfo').style.display = 'none'; | |
} | |
} | |
// Function to display command information in the table | |
function displayCommand() { | |
const commandSelect = document.getElementById('commandSelect'); | |
const command = commandSelect.options[commandSelect.selectedIndex].value; | |
const categorySelect = document.getElementById('categorySelect'); | |
const category = categorySelect.options[categorySelect.selectedIndex].value; | |
const selectedCommand = commandsData[category].find(c => c.Command === command); | |
if (selectedCommand) { | |
document.getElementById('commandInfo').style.display = 'block'; | |
const commandInfoBody = document.getElementById('commandInfoBody'); | |
commandInfoBody.innerHTML = ` | |
<tr> | |
<td><span style="color: #66CC99;">${selectedCommand.Command}</span></td> | |
<td class="description">${selectedCommand.Description}</td> | |
<td>${selectedCommand.Arguments}</td> | |
<td>${selectedCommand.Example}</td> | |
</tr> | |
`; | |
} else { | |
document.getElementById('commandInfo').style.display = 'none'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-color: #012456; /* PowerShell dark blue background */ | |
color: #FFFFFF; /* PowerShell white text */ | |
} | |
.container { | |
padding: 20px; | |
} | |
.dropdown-item:hover { | |
background-color: #033A75; /* PowerShell darker blue hover color */ | |
} | |
.dropdown-menu { | |
background-color: #012456; /* PowerShell dark blue background for dropdown menu */ | |
} | |
.table { | |
color: #FFFFFF; /* PowerShell white text for table */ | |
} | |
.slim { | |
width: 350px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment