private void _asm_Click(object sender, EventArgs e) { Keystone key = new Keystone(Keystone.ks_arch.KS_ARCH_X86, Keystone.ks_mode.KS_MODE_64); Console.WriteLine(_asmBox.Text); PS4.WriteMemory(PID, address, key.Assemble(_asmBox.Text, address: address)); }
void CodeCave(string[] input) { InstructionData data = new InstructionData(_a(stBox.Text)); InstructionData pData = new InstructionData(data.nAddress); string[] GetLines = new string[input.Length + 1]; bool l = true; string initialJmp = $"jmp 0x{cBox.Text.Replace("0x", "")}", over = null; if (data.Length >= 5) //adds nop if instruction is greater than 5 byte length { for (int i = 0; i < (data.Length - 5); i++) { initialJmp += $"\nnop"; } } else if (data.Length <= 5) //adds nop to next insrtuction, adds next instruction to bottom of cave { l = false; if (_li.Checked) { over = pData.Operation; } for (int i = 0; i < ((data.Length + pData.Length) - 5); i++) { initialJmp += $"\nnop"; } } for (int i = 0; i < input.Length; i++) { GetLines[i] = input[i]; } if (over != null) { GetLines[GetLines.Length - 1] = l ? $"{over}\njmp 0x{ data.nAddress.ToString("X").Replace("0x", "")}" : $"{over}\njmp 0x{pData.nAddress.ToString("X").Replace("0x", "")}"; } else { GetLines[GetLines.Length - 1] = l ? $"jmp 0x{data.nAddress.ToString("X").Replace("0x", "")}" : $"jmp 0x{pData.nAddress.ToString("X").Replace("0x", "")}"; } Keystone key = new Keystone(Keystone.ks_arch.KS_ARCH_X86, Keystone.ks_mode.KS_MODE_64); PS4.WriteMemory(PID, _a(stBox.Text), key.Assemble(initialJmp, _a(stBox.Text))); PS4.WriteMemory(PID, _a(cBox.Text), key.Assemble(string.Join(" \n", GetLines), _a(cBox.Text))); }
private void tbAsm_PreviewKeyUp(object sender, KeyEventArgs e) { ulong.TryParse(tbAddress.Text, NumberStyles.AllowHexSpecifier, System.Globalization.CultureInfo.InvariantCulture, out DisAddr); // setup dropdown for options // read assembly and output to box CurrAss = Keystone.Assemble(tbAsm.Text, DisAddr, ks_opt_value.KS_OPT_SYNTAX_INTEL | ks_opt_value.KS_OPT_SYNTAX_RADIX16); string hex = BitConverter.ToString(CurrAss).Replace("-", " "); tbAsmOut.Text = hex; }
private void AssembleButton_Click(object sender, EventArgs e) { using (Keystone keystone = new Keystone(KeystoneArchitecture.KS_ARCH_X86, KeystoneMode.KS_MODE_MIPS64, true)) this.result = keystone.Assemble(this.AssemblerTextBox.Text, this._address).Buffer; this.Close(); }