1. Go to this page and download the library: Download shanept/assembly-simulator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shanept / assembly-simulator example snippets
// METHOD 1: Using the factory.
$simulator = SimulatorFactory::createSimulator(Simulator::PROTECTED_MODE);
// METHOD 2: Manually creating the simulator.
$simulator = new Simulator(Simulator::PROTECTED_MODE);
// Instantiate default instruction set manually.
$xor = new ExclusiveOr();
$lea = new LoadEffectiveAddress();
$mov = new Move();
$pop = new Pop();
$push = new Push();
// Link instruction set to simulator.
$xor->setSimulator($simulator);
$lea->setSimulator($simulator);
$mov->setSimulator($simulator);
$pop->setSimulator($simulator);
$push->setSimulator($simulator);
$simulator = new Simulator(Simulator::PROTECTED_MODE);
// Instantiate our instruction set.
$exclusiveOr = new ExclusiveOr;
$lea = new LoadEffectiveAddress;
$mov = new Move;
$pop = new Pop;
$push = new Push;
// Link our instruction set with the simulator.
$exclusiveOr->setSimulator($simulator);
$lea->setSimulator($simulator);
$mov->setSimulator($simulator);
$pop->setSimulator($simulator);
$push->setSimulator($simulator);
$simulator = new Simulator(Simulator::PROTECTED_MODE);
// Taken from PHP v8.3.7 Thread-Safe Windows "php8ts.dll" binary.
$assemblyCode =
"\x56" . // push esi
"\x68\x18\xA7\x60\x10" . // push 0x1060A718
"\x6A\x0B" . // push 0xB
"\x68\x98\x4D\x61\x10"; // push 0x10614D98
$simulator->setCodeBuffer($assemblyCode);
// OR: Reads the same string from the php8ts.dll file.
$fp = fopen("php8ts.dll", "rb");
fseek($fp, 4782677);
$assemblyCode = fread($fp, 13);
fclose($fp);
$simulator->setCodeBuffer($assemblyCode);
// The simulator can now run.
$simulator->simulate();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.