
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
This is a pure Ruby ARM64 assembler. Are you tired of writing Ruby in Ruby? Now you can write ARM64 assembly in Ruby with this gem!
This example uses the DSL methods. The DSL methods make accessing the registers, shifts, and options a little more easy.
require "aarch64"
require "jit_buffer"
# create a JIT buffer
jit_buffer = JITBuffer.new 4096
asm = AArch64::Assembler.new
# Make some instructions
asm.pretty do
asm.movz x0, 0xCAFE
asm.movk x0, 0xF00D, lsl(16)
asm.ret
end
# Write the instructions to a JIT buffer
jit_buffer.writeable!
asm.write_to jit_buffer
jit_buffer.executable!
# Execute the JIT buffer
p jit_buffer.to_function([], -Fiddle::TYPE_INT).call.to_s(16) # => f00dcafe
The following is the same example, but without the DSL. The main difference is that you must access registers via the constant names.
require "aarch64"
require "jit_buffer"
# create a JIT buffer
jit_buffer = JITBuffer.new 4096
asm = AArch64::Assembler.new
# Make some instructions
asm.movz AArch64::Registers::X0, 0xCAFE
asm.movk AArch64::Registers::X0, 0xF00D, lsl: 16
asm.ret
# Write the instructions to a JIT buffer
jit_buffer.writeable!
asm.write_to jit_buffer
jit_buffer.executable!
# Execute the JIT buffer
p jit_buffer.to_function([], -Fiddle::TYPE_INT).call.to_s(16) # => f00dcafe
You can include AArch64::Registers
if you don't want to use the DSL, but
want easier access to the registers. For example:
include AArch64::Registers
asm = AArch64::Assembler.new
asm.movz X0, 0xCAFE
asm.movk X0, 0xF00D, lsl: 16
asm.ret
Here is another example of the same assembly, but using the built-in ARM64 assembly parser:
require "jit_buffer"
require "aarch64/parser"
parser = AArch64::Parser.new
asm = parser.parse <<~eoasm
movz x0, 0xCAFE
movk x0, 0xF00D, lsl #16
ret
eoasm
# create a JIT buffer
jit_buffer = JITBuffer.new 4096
# Write the instructions to a JIT buffer
jit_buffer.writeable!
asm.write_to jit_buffer
jit_buffer.executable!
# Execute the JIT buffer
p jit_buffer.to_function([], -Fiddle::TYPE_INT).call.to_s(16) # => f00dcafe
Hacking on this gem should be similar to most. Just do:
$ gel install
$ gel exec rake test
FAQs
Unknown package
We found that aarch64 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.