FatalBulletHit

String Distorter

Oct 23rd, 2019 (edited)
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # https://pastebin.com/SL6TCPi3
  2. # Randomly distorts strings
  3.  
  4. Param (
  5.  
  6.     [Parameter(ValueFromPipeline=$true)]
  7.     [String] $String
  8.  
  9. )
  10.  
  11. $Host.UI.RawUI.WindowTitle = 'String Distorter'
  12. $Distortion = 'P','a','r','m','(','[','e','t','M','n','d','o','y','=','f','l','s',',','i','0',')',']','w','c','h','D','b','U','p','C','k','1','<','#','T','S','I','u','v','g','x','.','A','F',':','-','E','/','|','H','O','\','8','&','Y','B','@','>','R','W','L','2','V','!','Q','q','j','N','_','G','*','9','3','5','7','X','4','6','K','+',';','z','▄','─','═','?','J','ß','ä','ö','î','~','€','§','%','³','â','à','í','á','²','Ä','ó','Û','Â','Í','☐','Ê','Ô','ò','À','ì','è','█','È','ü','ô','´','é','¶','É','ê','°','Á','^','Ö','Î','Ì','Ü','Z','û'
  13.  
  14. if ([string]$String -eq '') {
  15.  
  16.     $String = 'This is a string'
  17.  
  18. }
  19.  
  20. $String -split '.*?' | ForEach-Object {
  21.  
  22.     if ($i %2 -eq 1) {
  23.        
  24.         $_ = $Distortion[(Get-Random -Maximum ($Distortion.Count - 1))]
  25.         $r = Get-Random -Minimum 1 -Maximum 10
  26.    
  27.     } else {
  28.    
  29.         $r = Get-Random -Minimum 3 -Maximum 10
  30.    
  31.     }
  32.    
  33.     $cur += $_
  34.    
  35.     if ($cur.Length -ge $r) {
  36.    
  37.         $i++
  38.         $Output += @($cur)
  39.         $cur = ''
  40.    
  41.     }
  42. }
  43.  
  44. ($Output += @($cur))
  45. Write-Host "`n"
  46.  
  47. $Output | ForEach-Object {
  48.    
  49.     if ($n++%2 -eq 0) {
  50.    
  51.         Write-Host $_ -NoNewline
  52.    
  53.     } else {
  54.    
  55.         Write-Host $_ -BackgroundColor DarkYellow -ForegroundColor Black -NoNewline
  56.    
  57.     }
  58. }
  59.  
  60. Read-Host
Add Comment
Please, Sign In to add comment