$global:LDPlayerPath ="C:\Ldplayer\LDplayer9" function logger($logMessage) { [int]$number = (get-content -path "$global:LDPlayerPath\index_count.txt") if($number -gt 21){ $number=0} $instanceList = Get-Content -Path "$global:LDPlayerPath\instanceList.txt" $instanceNumber = $instanceList[$number] $instanceData = (cat C:\Ldplayer\LDplayer9\vms\config\leidian${instanceNumber}.config) $convertedData = $instanceData | ConvertFrom-Json $name = $convertedData."statusSettings.playerName" $count = $number+1 $scriptName = Split-Path -Leaf $PSCommandPath $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss.fff" $timestampedLogMessage = $timestamp + "-$name, ($count/22)-$scriptName-PID: ${PID}-:" + $logMessage $logFilePath = "$global:LDPlayerPath\LDAutoLog.txt" $fs = New-Object System.IO.FileStream($logFilePath, [System.IO.FileMode]::Append, [System.IO.FileAccess]::Write, [System.IO.FileShare]::Read) $sw = New-Object System.IO.StreamWriter($fs) try { $sw.WriteLine($timestampedLogMessage) } finally { $sw.Close() $fs.Close() } } import-module C:\LDPlayer\LDPlayer9\googleauthenticator.psm1 logger("GAUTH module importado...") $Secret = 'L4JPYT2H3NNJNQTOQSPZFJ7RVPPSPKRU' $code=(Get-GoogleAuthenticatorPin $Secret)."PIN Code" if($code -match (\d\d\d \d\d\d)){ logger("codigo GAUTH valido!") } logger("digitando codigo valido na instancia..") & "$global:LDPlayerPath\actions.ps1" -action type, "$code" & "$global:LDPlayerPath\actions.ps1" -action key, "enter" logger("foi enviado codigo na instancia!")