Upload files to "/"

This commit is contained in:
2025-12-02 18:18:14 +00:00
parent 524dd2432b
commit 1055b7dd73
5 changed files with 505 additions and 0 deletions

37
Get-AuthenticatorPin.ps1 Normal file
View File

@@ -0,0 +1,37 @@
$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!")

View File

@@ -0,0 +1,91 @@
function Get-OCR {
<#
.SYNOPSIS
Runs Windows 10 OCR on an image.
.DESCRIPTION
Takes a path to an image file, with some text on it.
Runs Windows 10 OCR against the image.
Returns an [OcrResult], hopefully with a .Text property containing the text
.PARAMETER -Path
Path to an image file
.EXAMPLE
Get-OCR -Path 'c:\test.bmp'
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 0, HelpMessage = 'Path to an image file, to run OCR on')]
[ValidateNotNullOrEmpty()]
$Path
)
Begin {
# Add the WinRT assembly, and load the appropriate WinRT types
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$null = [Windows.Storage.StorageFile, Windows.Storage, ContentType = WindowsRuntime]
$null = [Windows.Media.Ocr.OcrEngine, Windows.Foundation, ContentType = WindowsRuntime]
$null = [Windows.Foundation.IAsyncOperation, Windows.Foundation, ContentType = WindowsRuntime]
$null = [Windows.Graphics.Imaging.SoftwareBitmap, Windows.Foundation, ContentType = WindowsRuntime]
$null = [Windows.Storage.Streams.RandomAccessStream, Windows.Storage.Streams, ContentType = WindowsRuntime]
$ocrEngine = [Windows.Media.Ocr.OcrEngine]::TryCreateFromUserProfileLanguages()
$getAwaiterBaseMethod = [WindowsRuntimeSystemExtensions].GetMember('GetAwaiter').Where({ $PSItem.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`'IAsyncOperation`1'' }, ''First')[0]'
Function Await {
param($AsyncTask, $ResultType)
$getAwaiterBaseMethod.MakeGenericMethod($ResultType).Invoke($null, @($AsyncTask)).GetResult()
}
}
Process {
foreach ($p in $Path) {
# .Net method needs a full path, or at least might not have the same relative path root as PowerShell
$p = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($p)
$params = @{
AsyncTask = [Windows.Storage.StorageFile]::GetFileFromPathAsync($p)
ResultType = [Windows.Storage.StorageFile]
}
$storageFile = Await @params
$params = @{
AsyncTask = $storageFile.OpenAsync([Windows.Storage.FileAccessMode]::Read)
ResultType = [Windows.Storage.Streams.IRandomAccessStream]
}
$fileStream = Await @params
$params = @{
AsyncTask = [Windows.Graphics.Imaging.BitmapDecoder]::CreateAsync($fileStream)
ResultType = [Windows.Graphics.Imaging.BitmapDecoder]
}
$bitmapDecoder = Await @params
$params = @{
AsyncTask = $bitmapDecoder.GetSoftwareBitmapAsync()
ResultType = [Windows.Graphics.Imaging.SoftwareBitmap]
}
$softwareBitmap = Await @params
# Run the OCR
$ocrResult = Await $ocrEngine.RecognizeAsync($softwareBitmap) ([Windows.Media.Ocr.OcrResult])
<# **CHANGED: Extract text and coordinates** #>
$ocrResult.Lines | ForEach-Object {
$_.Words | ForEach-Object {
[PSCustomObject]@{
Text = $_.Text
X = $_.BoundingRect.X
Y = $_.BoundingRect.Y
Width = $_.BoundingRect.Width
Height = $_.BoundingRect.Height
}
}
}
}
}
}
Get-OCR "C:\LDPLayer\LDPlayer9\screenshot.png"

161
enterPairingCode.ps1 Normal file
View File

@@ -0,0 +1,161 @@
param (
[Parameter(Mandatory=$false)]
[string]$phNumber,
[Parameter(Mandatory=$false)]
[string]$instanceApiKey,
[Parameter(Mandatory=$false)]
[string]$instanceID,
[Parameter(Mandatory=$false)]
[switch]$debugtrue,
[Parameter(Mandatory=$false)]
[string]$instanceName
)
$phNumber = Read-Host ""
Read-Host
$global:LDPlayerPath ="C:\Ldplayer\LDplayer9"
$global:instanceNameglobal=$instanceName
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
foreach ( $inst in $instanceList) {
$instanceData = (cat C:\Ldplayer\LDplayer9\vms\config\leidian${inst}.config)
$convertedData = $instanceData | ConvertFrom-Json
$name = $convertedData."statusSettings.playerName"
if ($global:instanceNameglobal -eq $name){
$count = $inst
break
}
}
#if(-not $instanceName){$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 + " ${global:instanceNameglobal} -instanceID: ${count} -${scriptName} -PID: ${PID}-:" + $logMessage
#$timestampedLogMessage
$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()
}
}
if (-not $instanceApiKey) {
$instanceApiKey = "4BC247F718F3-459C-9AFF-5D0A47306736"
logger "this is the apikey $instanceApiKey"
}
if ($instanceName -eq "") {
logger "here"
$instanceName = "PY-Expediente"
logger "this is the instance Name: $instanceName"
} else {logger "instance Name was provided: $instanceName"}
$pairingCode = $null
$cnt = 0
while ($true) {
if ($cnt -gt 3) {
logger "Breaking loop due to too many retries: $cnt"
break
}
$invokeParamsCheck = @{
Uri = "https://evo2.congregatio.info/instance/connectionState/${instanceName}"
Method = 'Get'
Headers = @{
'apikey' = $instanceApiKey
}
}
<# $referer = "https://evo2.congregatio.info/manager/instance/${instanceID}/dashboard"
if($phNumber){
$invokeParams = @{
Uri = "https://evo2.congregatio.info/instance/connect/${instanceName}?number=$phNumber"
Method = 'Get'
Headers = @{
'Accept' = 'application/json, text/plain, */*'
'Accept-Encoding' = 'gzip, deflate, br, zstd'
'Accept-Language' = 'en-US,en;q=0.9,pt;q=0.8'
'Connection' = 'keep-alive'
'Host' = 'evo2.congregatio.info'
'If-None-Match' = 'W/"3566-dv/lW7LOD1QXVfUqIZqJkpLUNqg"'
'Referer' = 'https://evo2.congregatio.info/manager/instance/be287e5d-66c6-4240-966a-94c1e7c9ed9a/dashboard'
'User-Agent' = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
'apikey' = $instanceApiKey
}
}
} else { #>
$invokeParams = @{
Uri = "https://evo2.congregatio.info/instance/connect/${instanceName}?number=$phNumber"
Method = 'Get'
Headers = @{
'Accept' = 'application/json, text/plain, */*'
'Accept-Encoding' = 'gzip, deflate, br, zstd'
'Accept-Language' = 'en-US,en;q=0.9,pt;q=0.8'
'Connection' = 'keep-alive'
'Host' = 'evo2.congregatio.info'
'If-None-Match' = 'W/"3566-dv/lW7LOD1QXVfUqIZqJkpLUNqg"'
'Referer' = 'https://evo2.congregatio.info/manager/instance/be287e5d-66c6-4240-966a-94c1e7c9ed9a/dashboard'
'User-Agent' = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36'
'apikey' = $instanceApiKey
}
}
#}
$invokeParamsRestart = @{
Uri = "https://evo2.congregatio.info/instance/logout/${instanceName}"
Method = 'DELETE'
Headers = @{
'apikey' = $instanceApiKey
}
}
$answerCheck = Invoke-RestMethod @invokeParamsCheck
if ($answerCheck.instance.state -eq "open"){
logger("instance is open, so not disconnecting")
return
}
#Invoke-RestMethod @invokeParamsRestart
logger($invokeParams.Uri)
logger($invokeParams.Headers.apikey)
$answer = Invoke-RestMethod @invokeParams 2>&1
logger($answer)
$pairingCode = $answer.pairingCode
logger($pairingCode)
logger "Received pairing code: $pairingCode"
if($pairingCode){break}
else
{
logger "API request failed so restarting instance: $_"
$answerRestart = Invoke-RestMethod @invokeParamsRestart
logger($answerRestart)
Start-Sleep -Seconds 3
}
$cnt += 1
if($pairingCode){break}
Write-Host "$cnt"
}
logger "Final pairing code: $pairingCode"
if($pairingCode) {& $global:LDPlayerPath\actions.ps1 -instanceIP "10.0.211.125" -action type, "$pairingCode"; Start-Sleep -Seconds 60}
else {
return $false
}

154
if.ps1 Normal file
View File

@@ -0,0 +1,154 @@
param (
[Parameter(Mandatory=$true)]
[string]$operator,
[Parameter(Mandatory=$false)]
[switch]$screenshot,
[Parameter(Mandatory=$true)]
[string[]]$conditions,
[Parameter(Mandatory=$false)]
[string[]]$instanceIP
)
if(-not $instanceIP){$instanceIP = "10.0.211.121"}
$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()
}
}
function Fetch-ScreenShot(){
adb connect $instanceIP *>$null
adb -s $instanceIP exec-out screencap -p > $global:LDPlayerPath\screenshot.png *>$null
& "C:\Program Files\Tesseract-OCR\tesseract.exe" "$global:LDPlayerPath\screenshot.png" "$global:LDPlayerPath\tesseract" -l eng tsv *>$null
}
function Get-ScreenshotData($text) {
$tsvFile = "$global:LDPlayerPath\tesseract.tsv"
$wordCoords = Get-Content $tsvFile | ConvertFrom-Csv -Delimiter "`t"
$wordCoords | Where-Object ($_.level -eq 5) | Select-Object text, left, top, width, height
$Data = $wordCoords | ForEach-Object {
$x1 =[int]$_._left
$y1 =[int]$_.top
$width = [int]$_.width
$height = [int]$_.height
$midX =[math]::Round($x1+$width/2)
$midY =[math]::Round($y1+$height/2)
[PSCustomObject]@{
Text = $_.text
Coords = "$midX $midY"
}
}
$Element = $Data | Where-Object {$_.Text -and $_.Text.ToLower() -eq $text}
$coordsForText=$Element.Coords
return $coordsForText
}
& "$global:LDPlayerPath\test.ps1 -instanceIP ${instanceIP}"
$xml = (get-content -path C:\LDPlayer\LDPlayer9\screen.xml)
if (-not $conditions) { return $false }
if (-not $screenshot){
logger("usando xml")
$allConditions = $conditions
switch ($operator) {
"OR" {
logger("OR operator selected to find any of these: $allConditions")
foreach ($condition in $allConditions) { if ($xml | select-string $condition) { logger("$condition found");return $true } }
logger("$condition not found");return $false
}
"AND" {
logger("AND operator selected to find all of these: $allConditions")
foreach ($condition in $allConditions) { if (-not (($xml | select-string $condition))) { logger("$condition not found");return $false } }
logger("$condition found");return $true
}
"NAND" {
logger("NAND operator selected to return true if any one of these are NOT present: $allConditions")
foreach ($condition in $allConditions) { if (-not ($xml | select-string $condition)) { logger("at least $condition is not present, so returning TRUE since NAND operator was specified");return $true }}
logger("All conditions are present, so returning false since NAND operator was specified");return $false
}
"NOR" {
logger("NOR operator selected to return TRUE only when all of the conditions are present: $allConditions")
foreach($condition in $allConditions){
if($xml | Select-String $condition) {
logger("$condition is present so returning false since all have to be absent");return $false}
}
logger("None of the conditions are present so returning TRUE (since neither this NOR that condition was present");return $true
}
}
} else {
logger("screnshot Data being observed (not xml)")
Fetch-ScreenShot
if (-not $conditions) { return $false }
$allConditions = $conditions
switch ($operator) {
"OR" {
logger("OR operator selected to find any of these: $allConditions")
foreach ($condition in $allConditions) {
$coords=""
$coords=Get-ScreenshotData($condition)
if ($coords) { logger("$condition found");return $true } }
logger("$condition not found");return $false
}
"AND" {
logger("AND operator selected to find all of these: $allConditions")
foreach ($condition in $allConditions) {
$coords=Get-ScreenshotData($condition)
if (-not $coords) { logger("$condition not found");return $false } }
logger("$condition found");return $true
}
"NAND" {
logger("NAND operator selected to return true if any one of these are NOT present: $allConditions")
foreach ($condition in $allConditions) {
$coords=Get-ScreenshotData($condition)
if (-not $coords) { logger("at least $condition is not present, so returning TRUE since NAND operator was specified");return $true }}
logger("All conditions are present, so returning false since NAND operator was specified");return $false
}
"NOR" {
logger("NOR operator selected to return TRUE only when all of the conditions are present: $allConditions")
foreach($condition in $allConditions){
$coords=Get-ScreenshotData($condition)
if($coords) {
logger("$condition is present so returning false since all have to be absent");return $false}
}
logger("None of the conditions are present so returning TRUE (since neither this NOR that condition was present");return $true
}
}
}

62
ifPlus.ps1 Normal file
View File

@@ -0,0 +1,62 @@
param (
[Parameter(Mandatory=$true)]
[string]$operator,
[Parameter(Mandatory=$true)]
[string[]]$conditions
)
$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()
}
}
$xml = (get-content -path C:\LDPlayer\LDPlayer9\screen.xml)
if (-not $conditions) { return $false }
$allConditions = $conditions
switch ($operator) {
"OR" {
foreach ($condition in $allConditions) { if ($xml | select-string $condition) {
$textInfo = (Get-Culture).TextInfo
$titleCaseString = $textInfo.ToTitleCase($condition)
$conditionMet = $titleCaseString -replace '\s', ''
return $conditionMet
} }
return
}
"AND" {
foreach ($condition in $allConditions) { if (-not (($xml | select-string $condition))) { return } }
$textInfo = (Get-Culture).TextInfo
$titleCaseString = $textInfo.ToTitleCase($allConditions[0])
$conditionMet = $titleCaseString -replace '\s', ''
return $conditionMet
}
"NOT" {
foreach ($condition in $allConditions) { if (-not (($xml | select-string $condition))) {return $true }}
return $false
}
}