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
<# | |
.Synopsis | |
Hash a file or a folder via the lifestrea- er I mean, bytestream. Then return the results. | |
.Description | |
I improved Get-FileHash just a bit. Hash a file or a folder via the lifestrea- er I mean, | |
bytestream. Then returns the results. A lot of options, and what ever supported, hardware | |
accelerated CryptoStream HashAlgorithm provider you want. Also with real time progress, | |
which you can turn off if you want. |
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
# Script requires ODBC Connector MySql/MariaDB | |
$data = Get-Content "$args" | |
$username = $data[0] | |
$password = $data[1] | |
#connection - pwsh.exe Get-OdbcDriver | |
$driver = "MariaDB ODBC 3.1 Driver" | |
$Server = "127.0.0.1" | |
$DBName = "openvpn" | |
$User = "openvpn" |
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
<?php | |
if (!isset($argv[1])) | |
{ | |
print 'not ok'; | |
exit(1); | |
} | |
$data = file($argv[1], FILE_IGNORE_NEW_LINES); | |
// Add your [address], [dbuser], [pass], [database] | |
$conn = new mysqli("127.0.0.1", "root", "password", "openvpn"); |
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
$email = 'CLOUDFLARE_EMAIL' | |
$apikey = 'CLOUDLFARE_APIKEY' | |
$ZoneID = 'ZONEID' | |
$type = 'TXT' | |
$Record = '_mta-sts.domain.com' | |
$timestamp = Get-Date -Format "yyyyMMddThhmmss" | |
Try { $result = Invoke-RestMethod -Uri "https://api.cloudflare.com/client/v4/zones/$ZoneID/dns_records?type=$type&name=$Record&page=1&per_page=100&order=type&direction=desc&match=all" -Method 'GET' -ContentType "application/json" -Headers @{'Accept'='application/json';'X-Auth-Email'="$email";'X-Auth-Key'="$apikey"} | | |
% {$_.result} } | |
Catch {Write-Host "Cannot contact CF for record info" |
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
$email = 'CLOUDFLARE_EMAIL' | |
$apikey = 'API_KEY' | |
$ZoneID = 'ZONE_ID' | |
$type = 'TXT' | |
$Record = 's1._domainkey.domain.com' | |
openssl genrsa -out $PSScriptroot\dkim.private.pem 2048 | |
$key = openssl rsa -in $PSScriptroot\dkim.private.pem -pubout | Select -Skip 1 | Select -SkipLast 1 | Join-String | |
$key | Out-File $PSScriptroot\dkim.public.pem | |
# Get the record ID | |
Try { $result = Invoke-RestMethod -Uri "https://api.cloudflare.com/client/v4/zones/$ZoneID/dns_records?type=$type&name=$Record&page=1&per_page=100&order=type&direction=desc&match=all" -Method 'GET' -ContentType "application/json" -Headers @{'Accept'='application/json';'X-Auth-Email'="$email";'X-Auth-Key'="$apikey"} | |
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
# Drop this script in your PHP folder with the ini & php-cgi.exe | |
$path = "$PSScriptRoot\php-cgi.exe" | |
$ini = "$PSScriptRoot\php.ini" | |
# Get Version | |
$Version = "$(./php -r 'echo PHP_VERSION;')" | |
# Create Handler | |
New-WebHandler -Name "PHP $Version" -Path "*.php" -Verb "*" -Modules FastCgiModule -ScriptProcessor "$path" -ResourceType "Either" | |
# FastCGI Settings | |
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/fastCgi" -name "." -value @{fullPath="$path";monitorChangesTo="$ini";stderrMode='ReturnGeneric500';maxInstances=8;idleTimeout=600;activityTimeout=604800;requestTimeout=7200;instanceMaxRequests=10000;protocol='NamedPipe';rapidFailsPerMinute=105} | |
# Environment Variables |
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
<?php | |
if (isset($_POST['name']) && isset($_POST['message']) && isset($_POST['email'])) { | |
$headers = 'MIME-Version: 1.0' . "\r\n"; | |
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; | |
$headers .= 'From: [email protected]'; | |
$message = 'Email from: '.filter_input(INPUT_POST, 'name').' '.filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL).'<br>'; | |
$message .= filter_input(INPUT_POST, 'message'); | |
$message .= '<br><br>'; | |
$message .= 'Remote address '.$_SERVER['REMOTE_ADDR']; | |
if(mail('[email protected]', 'Contact Form', $message, $headers)){ |
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
$email="CF_EMAIL" | |
$apikey="CF_API_KEY" | |
$deleted = 0 | |
$records = 0 | |
$page = 1 | |
$pages = 1 | |
while($page -le $pages){ | |
Write-Host "########## $page ###########" |
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
# Read configuration from JSON file, run once to generate config.json | |
$configFile = "$PSScriptRoot/config.json" | |
if (-not (Test-Path $configFile)) { | |
$configlayout = @{ | |
"jfAddress"="http://127.0.0.1:8096"; | |
"jfKey"="abcdefg12345"; | |
"qbtAddress"="http://127.0.0.1:8080"; | |
"QBusername"="username"; | |
"QBpassword"="password"; | |
} |
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
$type = "A" # type A/AAAA | |
$email = "<CF_EMAIL_ADDRESS>" | |
$apikey = "<CF_API_KEY>" | |
$ZoneID = "<CF_ZONE_ID>" | |
$iplink = "https://ipv4.seeip.org" | |
$date = get-date -format yyyy-MM-ddTHH-mm-ss-ff | |
#list all records of $type | |
$response = Invoke-RestMethod -UseBasicParsing -Uri "https://api.cloudflare.com/client/v4/zones/$ZoneID/dns_records?type=$type" -Method GET -Headers @{'Accept'='application/json';'X-Auth-Email'="$email";'X-Auth-Key'="$apikey"} -ContentType "application/json" | |
#get ip address |
OlderNewer