This file contains hidden or 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
#!/bin/bash | |
# Put this at the top of your script | |
# Detects if script are not running as root, if not will self invoke the script with sudo | |
# $0 is the script itself (or the command used to call it)... | |
# $* parameters... | |
# In both cases using double quote to prevent globbing and word splitting. | |
# Check if script is being run as root | |
if [[ $UID -ne 0 ]]; then |
This file contains hidden or 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
################################################################### | |
# This is not require anymore, use the official script from: # | |
# https://gitlab.com/parrotsec/project/debian-conversion-script # | |
################################################################### | |
#!/bin/bash -v | |
# This prevents the installer from opening dialog boxes during the installation process. As a result, it stops the errors from displaying | |
# export DEBIAN_FRONTEND=noninteractive |
This file contains hidden or 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
#!/usr/bin/env bash -v | |
# This prevents the installer from opening dialog boxes during the installation process. As a result, it stops the errors from displaying | |
# export DEBIAN_FRONTEND=noninteractive | |
### Adding default user | |
while true; do | |
read -p "Provide the password for default username (kali):" -s -r password | |
if [[ $password =~ ^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z]).{8,}$ ]]; then | |
# Password meets all conditions |
This file contains hidden or 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
#!/bin/bash | |
# Backup the original server.sh file | |
cp ~/.vscode-server/bin/*/server.sh ~/.vscode-server/bin/server.sh.bak | |
# Add sudo to node runner in server.sh | |
if sed -i "/node/s/^/sudo /" ~/.vscode-server/bin/*/server.sh; then | |
echo "sudo added to node runner in server.sh" | |
else | |
echo "Failed to add sudo to node runner. Please check the sed command." |
This file contains hidden or 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
$Tab = [char]9 | |
$Tag = New-Object Amazon.EC2.Model.Tag | |
foreach ($vol in (Get-EC2Volume)) { | |
$EBSVolId = $($vol.Attachments.VolumeId) | |
$EC2InstanceId = $($vol.Attachments.InstanceId) | |
$EC2InstanceName = ((Get-EC2Instance -InstanceId $EC2InstanceId).Instances.Tags | Where-Object { $_.Key -eq "Name" } | Select-Object -ExpandProperty Value) | |
Write-Host "Volumen Id:" $EBSVolId $Tab "Instance Id:" $EC2InstanceId $tab "Instance Name: " $EC2InstanceName | |
This file contains hidden or 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
######################################################################################## | |
# This will list all API names and regional enpoints for all AWS regions # | |
# querying all regions also allow us to get the list of services available per region # | |
######################################################################################## | |
Function Get-AWSModule { | |
Param([string]$name) | |
if (-not(Get-Module -Name $name)) { | |
if (Get-Module -ListAvailable | Where-Object { $_.name -eq $name }) { |
This file contains hidden or 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
Function Get-AWSModule { | |
Param([string]$name) | |
if (-not(Get-Module -Name $name)) { | |
if (Get-Module -ListAvailable | Where-Object { $_.name -eq $name }) { | |
Import-Module -Name $name | |
$true | |
} #end if module available then import | |
else { $false } #module not available | |
} # end if not module | |
else { $true } #module already loaded |
This file contains hidden or 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
#!/usr/bin/env bash | |
# This script list all AMIs in use in all regions in an account | |
# Author: [email protected] | |
# Check if AWS CLI is installed | |
if ! command -v aws &> /dev/null; then | |
echo "AWS CLI could not be found" | |
exit | |
fi |
This file contains hidden or 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
function Use-RunAs { | |
# Check if script is running as Administrator or with elevated privilege, if not use RunAs | |
# Use Check Switch to check if admin | |
param([Switch]$Check) | |
# Detecting OS Platform, win32nt for Windows or unix for Linux/Unix | |
$OSPlatform = (([System.Environment]::OSVersion.Platform).ToString()).ToLower() | |
if ($OSPlatform -eq "unix") { | |
Write-Warning "Detected Linux/Unix OS, you don't need this, use sudo" | |
exit # Quit this session of powershell |
This file contains hidden or 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
$ComputerName = $env:computername | |
$AllShares = Get-WmiObject -Class win32_share -ComputerName $ComputerName | Select-Object -ExpandProperty Name | |
Function GetShareSecurity { | |
Param([string]$path = $(throw"$path required.")) | |
Write-Host "--------------------------------------------------" | |
$pathparts = $path.split("\") | |
$ComputerName = $pathparts[2] | |
$ShareName = $pathparts[3] | |