Skip to content

Instantly share code, notes, and snippets.

View perXautomatik's full-sized avatar

perXautomatik

View GitHub Profile
@perXautomatik
perXautomatik / CorruptedModulesCombinedWithQue.ps1
Last active August 7, 2023 10:31 — forked from mhagger/README.md
Tools for repository repair
begin
{
Push-Location
# Validate the arguments
if (-not (Test-Path -LiteralPath $modules)) {
Write-Error "Invalid modules path: $modules"
exit 1
}
<#
.SYNOPSIS
Adapted setup ps1 file from https://gist.github.com/mikepruett3/7ca6518051383ee14f9cf8ae63ba18a7/
.DESCRIPTION
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/Xyn0gen/ba6d61a4397bb45eaf3d9f216e63f047/raw/setup.ps1'))"
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
#>
$VerbosePreference = "Continue"
#Requires -RunAsAdministrator
function wait_input_before_exit()
{
if ($Host.Name -eq "ConsoleHost")
{
Write-Host "Press any key to continue...."
$Host.UI.RawUI.FlushInputBuffer() # Make sure buffered input doesn't "press a key" and skip the ReadKey().
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
}
#Requires -Version 5
#Requires -RunAsAdministrator
[CmdletBinding()]
param (
[Parameter()]
[ValidateSet("Minimal", "Basic", "Full")]
$Plevel
)
Write-Output "Level: $Plevel"
function Write-Error([string]$message) {
@perXautomatik
perXautomatik / restore.ps1
Created May 16, 2023 22:37 — forked from carlzoo/restore.ps1
Restore files in Recycling Bin by Deletion Date
#https://stackoverflow.com/questions/52031528/powershell-get-deleted-files-of-a-folder
#https://jdhitsolutions.com/blog/powershell/7024/managing-the-recycle-bin-with-powershell/
#https://stackoverflow.com/questions/16906170/create-directory-if-it-does-not-exist
New-Variable -Name 'ssfBITBUCKET' -Option Constant -Value 0x0A;
New-Variable -Name 'BitBucketDetails_Name' -Option Constant -Value 0;
New-Variable -Name 'BitBucketDetails_ParentPath' -Option Constant -Value 1;
New-Variable -Name 'BitBucketDetails_DeletionTimeText' -Option Constant -Value 2;
New-Variable -Name 'BitBucketDetails_SizeText' -Option Constant -Value 3;
New-Variable -Name 'BitBucketDetails_Type' -Option Constant -Value 4;
New-Variable -Name 'BitBucketDetails_LastWriteTimeText' -Option Constant -Value 5;
@perXautomatik
perXautomatik / git_add_submodule.md
Last active August 25, 2023 23:58 — forked from ShenTengTu/git_add_submodule.ps1
[Powershell] Add Git Submodule from .gitmodules

Write-Host "[Add Git Submodule from .gitmodules]" -ForegroundColor Green Write-Host "... Dump git_add_submodule.temp ..." -ForegroundColor DarkGray git config -f .gitmodules --get-regexp '^submodule..*.path$' > git_add_submodule.temp

Get-content git_add_submodule.temp | ForEach-Object { try { $path_key, $path = $_.split(" ") $url_key = "$path_key" -replace ".path",".url" $url= git config -f .gitmodules --get "$url_key" Write-Host "$url --> $path" -ForegroundColor DarkCyan

@perXautomatik
perXautomatik / Compare-DFStoFolders.ps1
Created January 17, 2023 12:31 — forked from markwragg/Compare-DFStoFolders.ps1
Powershell script to get a list of DFS folder targets for all DFS folders under a defined path and test if those paths are valid from the location running the script.
$Servers = @("SERVER01","SERVER02","SERVER03")
$FolderPaths = $Servers | foreach {
Get-ChildItem "\\$_\DFSShare$"
} | Sort Path
$FolderPaths | Export-Csv "FolderPaths-$(Get-Date -format yyyy-MM-dd).csv" -NoTypeInformation
$TestPaths = (($FolderPaths).FullName | Sort-Object).Trimend('\')
$DFSPaths = ((Import-CSV "DFS-$(Get-Date -format yyyy-MM-dd).csv").TargetPath | Where-Object {($_ -ilike "*SERVER*") | Sort-Object).Trimend('\')
@perXautomatik
perXautomatik / JEWebDav.ps1
Created January 15, 2023 18:18 — forked from darkquasar/JEWebDav.ps1
Simple WebDav Server in Powershell
<#
Obtained from https://github.com/re4lity/subTee-gits-backups/blob/master/JEWebDav.ps1
#>
<#
.SYNOPSIS
Simple Reverse Shell over HTTP. Deliver the link to the target and wait for connectback.
Read And Write Files Over WebDAV Proof Of Concept
@perXautomatik
perXautomatik / FindFunctionsInScript.ps1
Last active July 19, 2023 16:35 — forked from Jaykul/Trace-Dependency.ps1
Extract a list of functions names and definitions inside a script, listing line numbers function begin and end;
[CmdletBinding()]
param(
# The script or file path to parse
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
[Alias("Path", "PSPath")]
$Script
)
process {
Write-Progress "Parsing $Script"
@perXautomatik
perXautomatik / CheckMounted.ps1
Last active October 6, 2022 14:32 — forked from willsantos/mount-vhd.ps1
Mount VHD
if ((get-command Get-VM -erroraction silentlycontinue) -ne $null)
{Get-VM *}
$importance = "Failed", "Warning", "Success"
$list = @(
@{ name = "Warning" }
@{ name = "Success" }