1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | # Numerical permissions: # Permission rwx # 7 read, write and execute rwx # 6 read and write rw- # 5 read and execute r-x # 4 read only r-- # 3 write and execute -wx # 2 write only -w- # 1 execute only --x # 0 none --- # The main parts of the chmod permissions: # the left three characters rwx define permissions of the OWNER. # the middle three characters rwx define permissions of the GROUP. # the right three characters rwx define permissions of EVERYONE ELSE. # Numerical permissions enum Operaciones{ __x = 1 _w_ = 2 _wx = 3 r__ = 4 r_x = 5 rw_ = 6 rwx = 7 } 1..1000 | % {$_ # Random numerical permissions $aleatoriou = (random(1..7)) ; $permisou = [Operaciones]$aleatoriou $aleatoriog = (random(1..7)) ; $permisog = [Operaciones]$aleatoriog $aleatorioo = (random(1..7)) ; $permisoo = [Operaciones]$aleatorioo clear # Show numerical permissions and rwx #Write-Host ([String]$aleatoriou + "|" + [String]$aleatoriog + "|" + [String]$aleatorioo) $aleatoriou2 = (random(1..7)) ; $permisou2 = [Operaciones]$aleatoriou2 $aleatoriog2 = (random(1..7)) ; $permisog2 = [Operaciones]$aleatoriog2 $aleatorioo2 = (random(1..7)) ; $permisoo2 = [Operaciones]$aleatorioo2 $resulti = ([String]$aleatoriou + "|" + [String]$aleatoriog + "|" + [String]$aleatorioo) + " %%%%% " + ([String]$aleatorioo2 + "|" + [String]$aleatoriog2 + "|" + [String]$aleatoriou2) $resultis = ([String][Operaciones][String]$aleatoriou + "|" + [String][Operaciones][String]$aleatoriog + "|" + [String][Operaciones][String]$aleatorioo) + " %%%%% " + ([String][Operaciones][String]$aleatorioo2 + "|" + [String][Operaciones][String]$aleatoriog2 + "|" + [String][Operaciones][String]$aleatoriou2) $resulti $resulti | Out-File resultado.txt -Append $resultis | Out-File resultado.txt -Append #([String]$aleatoriou + "|" + [String]$aleatoriog + "|" + [String]$aleatorioo) + " -> " + ([String]$permisou + "|" + [String]$permisog + "|" + [String]$permisoo) | out-file solucion.txt -Append Start-Sleep -Seconds (30-$_) $text = " <LANG LANGID=""407"">Siguiente</LANG> " $speaker = New-Object -ComObject Sapi.SpVoice $speaker.Rate = 0 $speaker.Speak($text) #([String]$permisou + "|" + [String]$permisog + "|" + [String]$permisoo) #Start-Sleep -Seconds 5 } # Show numerical permissions and rwx |