Skip to content

Instantly share code, notes, and snippets.

@IgorYunusov
Forked from Naravia/LuaPOC.cs
Created June 6, 2018 11:46
Show Gist options
  • Save IgorYunusov/864bb715f4dc2d0e437a7da61eab88d5 to your computer and use it in GitHub Desktop.
Save IgorYunusov/864bb715f4dc2d0e437a7da61eab88d5 to your computer and use it in GitHub Desktop.
FrameScript__Execute example by Saridormi @ Ownedcore
using System;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Binarysharp.MemoryManagement;
using Binarysharp.MemoryManagement.Memory;
namespace LuaExecPOC
{
class Program
{
static void Main(string[] args)
{
begin:
Console.Write($"Enter process name: ");
string processName = Console.ReadLine();
Process process = Process.GetProcesses().FirstOrDefault(x => string.Equals(x.ProcessName, processName, StringComparison.CurrentCultureIgnoreCase));
if (process == null)
{
Console.WriteLine("Process not found.");
goto begin;
}
try
{
var wow = new MemorySharp(process);
while (true)
{
Console.Write("Enter Lua to execute: ");
string lua = Console.ReadLine();
if (lua == null)
continue;
RemoteAllocation codeCave = wow.Memory.Allocate(lua.Length + 0x1);
codeCave.WriteString(lua, Encoding.ASCII);
wow.Assembly.InjectAndExecute(new[]
{
"mov eax, 0",
"mov ecx, " + codeCave.BaseAddress,
"mov edx, " + codeCave.BaseAddress,
"call 0x704cd0",
"retn"
});
}
}
catch (Exception ex)
{
Console.WriteLine("An exception has occurred. You're probably not running as Administrator.");
Console.WriteLine();
Console.WriteLine(ex);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment