[*] Binary protection state of getbit
Full RELRO No Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function printf tear down of getbit
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/bin/getbit @ 0x8c0 */
| #include <stdint.h>
|
; (fcn) main () | int32_t main () {
| /* [13] -r-x section size 1008 named .text */
0x000008c0 lui gp, 2 |
0x000008c4 addiu gp, gp, -0x78b0 |
0x000008c8 addu gp, gp, t9 | gp += t9;
0x000008cc addiu sp, sp, -0x28 |
0x000008d0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x000008d4 lw t9, -0x7f9c(gp) | t9 = sym.imp.getopt;
0x000008d8 addiu a2, a2, 0xd88 | a2 += 0xd88;
0x000008dc sw gp, 0x10(sp) | *(var_10h) = gp;
0x000008e0 sw s0, 0x1c(sp) | *(var_1ch) = s0;
0x000008e4 sw ra, 0x24(sp) | *(var_24h) = ra;
0x000008e8 sw s1, 0x20(sp) | *(var_20h) = s1;
0x000008ec move s0, a1 | s0 = a1;
0x000008f0 jalr t9 | t9 ();
0x000008f4 addiu v1, zero, -1 | v1 = -1;
0x000008f8 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == v1) {
0x000008fc beq v0, v1, 0x958 | goto label_1;
| }
0x00000900 lw a0, -0x7f88(gp) | a0 = *((gp - 8162));
0x00000904 lw a3, -0x7fdc(gp) | a3 = *((gp - 8183));
0x00000908 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x0000090c addiu v1, zero, 0x68 | v1 = 0x68;
0x00000910 lw a0, (a0) | a0 = *(a0);
0x00000914 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000918 addiu a3, a3, 0xd8c | a3 += str.getbit;
0x0000091c addiu a2, a2, 0xd94 | a2 += str.Usage:_n_s_gpioname_n_nRead_the_current_value_of_a_gpio_pin_n_n;
0x00000920 addiu a1, zero, 1 | a1 = 1;
0x00000924 beq v0, v1, 0x940 |
| while (1) {
0x00000928 jalr t9 | t9 ();
0x0000092c nop |
0x00000930 lw gp, 0x10(sp) | gp = *(var_10h);
| label_0:
0x00000934 lw t9, -0x7f94(gp) | t9 = sym.imp.exit;
0x00000938 addiu a0, zero, 1 | a0 = 1;
0x0000093c jalr t9 | t9 ();
0x00000940 jalr t9 | t9 ();
0x00000944 nop |
0x00000948 lw gp, 0x10(sp) | gp = *(var_10h);
0x0000094c lw t9, -0x7f94(gp) | t9 = sym.imp.exit;
0x00000950 move a0, zero | a0 = 0;
0x00000954 jalr t9 | t9 ();
| label_1:
0x00000958 lw v0, -0x7f8c(gp) | v0 = *((gp - 8163));
0x0000095c lw t9, -0x7f7c(gp) | t9 = sym.imp.ugpio_request_named;
0x00000960 lw v0, (v0) | v0 = *(v0);
0x00000964 sll v0, v0, 2 | v0 <<= 2;
0x00000968 lwx s0, v0(s0) | __asm ("lwx s0, v0(s0)");
0x0000096c move a0, s0 | a0 = s0;
0x00000970 jalr t9 | t9 ();
0x00000974 move s1, v0 | s1 = v0;
0x00000978 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 != 0) {
0x0000097c beqz v0, 0x9f4 |
0x00000980 lw t9, -0x7f80(gp) | t9 = sym.imp.ugpio_open;
0x00000984 move a0, v0 | a0 = v0;
0x00000988 jalr t9 | t9 ();
0x0000098c lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x00000990 bltz v0, 0xa14 | goto label_2;
| }
0x00000994 lw t9, -0x7fa0(gp) | t9 = sym.imp.ugpio_get_value;
0x00000998 move a0, s1 | a0 = s1;
0x0000099c jalr t9 | t9 ();
0x000009a0 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x000009a4 bltz v0, 0xa4c | goto label_3;
| }
0x000009a8 lw a1, -0x7fdc(gp) | a1 = *((gp - 8183));
0x000009ac lw t9, -0x7fa8(gp) | t9 = sym.imp.__printf_chk
0x000009b0 sltu v0, zero, v0 | v0 = (0 < v0) ? 1 : 0;
0x000009b4 addiu a2, v0, 0x30 | a2 = v0 + 0x30;
0x000009b8 addiu a1, a1, 0xe1c | a1 += 0xe1c;
0x000009bc addiu a0, zero, 1 | a0 = 1;
0x000009c0 jalr t9 | t9 ();
0x000009c4 lw gp, 0x10(sp) | gp = *(var_10h);
0x000009c8 lw t9, -0x7fa4(gp) | t9 = sym.imp.ugpio_close;
0x000009cc move a0, s1 | a0 = s1;
0x000009d0 jalr t9 | t9 ();
0x000009d4 lw gp, 0x10(sp) | gp = *(var_10h);
0x000009d8 lw t9, -0x7fb4(gp) | t9 = sym.imp.ugpio_free;
0x000009dc move a0, s1 | a0 = s1;
0x000009e0 jalr t9 | t9 ();
0x000009e4 lw gp, 0x10(sp) | gp = *(var_10h);
0x000009e8 lw t9, -0x7f94(gp) | t9 = sym.imp.exit;
0x000009ec move a0, zero | a0 = 0;
0x000009f0 jalr t9 | t9 ();
| }
0x000009f4 lw v0, -0x7f88(gp) | v0 = *((gp - 8162));
0x000009f8 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x000009fc lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000a00 lw a0, (v0) | a0 = *(v0);
0x00000a04 move a3, s0 | a3 = s0;
0x00000a08 addiu a2, a2, 0xdd0 | a2 += str.No_ugpio_for__s_n;
0x00000a0c addiu a1, zero, 1 | a1 = 1;
0x00000a10 b 0x928 |
| }
| label_2:
0x00000a14 lw v0, -0x7f88(gp) | v0 = *((gp - 8162));
0x00000a18 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000a1c lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000a20 lw a0, (v0) | a0 = *(v0);
0x00000a24 move a3, s0 | a3 = s0;
0x00000a28 addiu a2, a2, 0xde4 | a2 += str.Cant_open_ugpio_for__s_n;
0x00000a2c addiu a1, zero, 1 | a1 = 1;
0x00000a30 jalr t9 | t9 ();
0x00000a34 lw gp, 0x10(sp) | gp = *(var_10h);
| do {
0x00000a38 lw t9, -0x7fb4(gp) | t9 = sym.imp.ugpio_free;
0x00000a3c move a0, s1 | a0 = s1;
0x00000a40 jalr t9 | t9 ();
0x00000a44 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000a48 b 0x934 | goto label_0;
| label_3:
0x00000a4c lw v0, -0x7f88(gp) | v0 = *((gp - 8162));
0x00000a50 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000a54 lw t9, -0x7fac(gp) | t9 = sym.imp.__fprintf_chk
0x00000a58 lw a0, (v0) | a0 = *(v0);
0x00000a5c move a3, s0 | a3 = s0;
0x00000a60 addiu a2, a2, 0xe00 | a2 += str.Cant_read_value_for__s_n;
0x00000a64 addiu a1, zero, 1 | a1 = 1;
0x00000a68 jalr t9 | t9 ();
0x00000a6c lw gp, 0x10(sp) | gp = *(var_10h);
0x00000a70 lw t9, -0x7fa4(gp) | t9 = sym.imp.ugpio_close;
0x00000a74 move a0, s1 | a0 = s1;
0x00000a78 jalr t9 | t9 ();
0x00000a7c lw gp, 0x10(sp) | gp = *(var_10h);
0x00000a80 b 0xa38 |
| } while (1);
| }
[*] Function printf used 6 times getbit