This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.
JavaScript algorithmsartificial-intelligencebugbountycryptographycyber-threat-intelligencecybersecurity-projectsethical-hackinghacking-toolsmalwarenessusnetwork-monitoringnetwork-securitynmapportscannerpythonpythonprojectsthreat-intelligencevirus-scanning
ARM32 Code
.global _start
_start:
mov r7, #0x30 @ Move hex 30 into r7
b no_return @ Branch to no_return function
no_return:
mov r7, #1 @ Move decimal 1 into r7
bl my_function @ Call my_function; return address is stored in LR (r14)
@ After execution, it will return to wrap_up
wrap_up:
mov r7, #0x12 @ Move hex 12 into r7
b exit @ Branch to exit
my_function:
mov r0, #10 @ Move decimal 10 into r0
bx lr @ Return to the address stored in LR (r14)
@ This will return to wrap_up
exit:
mov r7, #1 @ syscall: exit (1 is the syscall number for exit on ARM32)
mov r0, #0 @ Exit code 0
svc 0 @ Make the system call
Explanation of the Code
_start:- This is the entry point of the program.
- The program moves the value
0x30into registerr7. - It then branches to the
no_returnfunction.
no_return:- The program moves the value
1into registerr7. - The
bl my_functioninstruction calls themy_functionfunction. The return address (address of the next instruction) is stored in the Link Register (LR, which isr14in ARM32).
- The program moves the value
wrap_up:- After returning from
my_function, the program moves the value0x12into registerr7. - It then branches to the
exitlabel.
- After returning from
my_function:- The function moves the value
10into registerr0. - The
bx lrinstruction returns to the address stored in the Link Register (LR,r14), which is the address of the instruction after theblinno_return.
- The function moves the value
exit:- The program sets up the exit syscall by moving
1(syscall number for exit) intor7and0(exit code) intor0. - The
svc 0instruction makes the system call to exit the program.
- The program sets up the exit syscall by moving
Compiling and Running the Code
Save the code:
- Save the code in a file named
lr_demo_arm32.s.
- Save the code in a file named
Compile the code:
- Use the
arm-linux-gnueabi-asassembler to assemble the code andarm-linux-gnueabi-ldto link it.
arm-linux-gnueabi-as -o lr_demo_arm32.o lr_demo_arm32.s arm-linux-gnueabi-ld -o lr_demo_arm32 lr_demo_arm32.o- Use the
Run the code:
- If you have an ARM32 environment (e.g., using QEMU), you can run the executable.
qemu-arm ./lr_demo_arm32Debug with GDB:
- To debug the program using GDB, you can use
arm-linux-gnueabi-gdb.
arm-linux-gnueabi-gdb ./lr_demo_arm32- In GDB, you can set breakpoints, step through the code, and inspect registers.
(gdb) break _start (gdb) run (gdb) stepi (gdb) info registers- To debug the program using GDB, you can use
Key Differences Between ARM32 and ARM64
Registers:
- In ARM32, the Link Register is
r14(LR), whereas in ARM64, it isx30. - ARM32 uses
r0-r12for general-purpose registers, while ARM64 usesx0-x30.
- In ARM32, the Link Register is
Return Instruction:
- In ARM32,
bx lris used to return from a function, whereas in ARM64,retis used.
- In ARM32,
Syscall Numbers:
- The syscall numbers differ between ARM32 and ARM64. For example, the exit syscall is
1in ARM32 and93in ARM64.
- The syscall numbers differ between ARM32 and ARM64. For example, the exit syscall is