[*] Binary protection state of setbit
Full RELRO Canary found NX disabled PIE enabled No RPATH No RUNPATH No Symbols
[*] Function printf tear down of setbit
; assembly | /* r2dec pseudo code output */
| /* /logs/firmware/unblob_extracted/firmware_extract/4325012-58052244.squashfs_v4_le_extract/usr/bin/setbit @ 0x980 */
| #include <stdint.h>
|
; (fcn) main () | int32_t main () {
| /* [13] -r-x section size 1200 named .text */
0x00000980 lui gp, 2 |
0x00000984 addiu gp, gp, -0x6970 |
0x00000988 addu gp, gp, t9 | gp += t9;
0x0000098c lw v0, -0x7f80(gp) | v0 = *((gp - 8160));
0x00000990 addiu sp, sp, -0x30 |
0x00000994 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000998 lw v0, (v0) | v0 = *(v0);
0x0000099c lw t9, -0x7f98(gp) | t9 = sym.imp.getopt;
0x000009a0 addiu a2, a2, 0xf28 | a2 += 0xf28;
0x000009a4 sw gp, 0x10(sp) | *(var_10h) = gp;
0x000009a8 sw s1, 0x24(sp) | *(var_24h) = s1;
0x000009ac sw s0, 0x20(sp) | *(var_20h) = s0;
0x000009b0 sw ra, 0x2c(sp) | *(var_2ch) = ra;
0x000009b4 sw s2, 0x28(sp) | *(var_28h) = s2;
0x000009b8 sw v0, 0x1c(sp) | *(var_1ch) = v0;
0x000009bc move s1, a0 | s1 = a0;
0x000009c0 move s0, a1 | s0 = a1;
0x000009c4 jalr t9 | t9 ();
0x000009c8 addiu v1, zero, -1 | v1 = -1;
0x000009cc lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == v1) {
0x000009d0 beq v0, v1, 0xa2c | goto label_3;
| }
0x000009d4 lw a0, -0x7f7c(gp) | a0 = *((gp - 8159));
0x000009d8 lw a3, -0x7fdc(gp) | a3 = *((gp - 8183));
0x000009dc lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x000009e0 addiu v1, zero, 0x68 | v1 = 0x68;
0x000009e4 lw a0, (a0) | a0 = *(a0);
0x000009e8 lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x000009ec addiu a3, a3, 0xf2c | a3 += str.setbit;
0x000009f0 addiu a2, a2, 0xf34 | a2 += str.Usage:_n_s_gpioname__value__n_nSet_the_current_value_of_a_gpio_pin_nValue_must_be_0_for_low_or_non_zero_for_high_n_n;
0x000009f4 addiu a1, zero, 1 | a1 = 1;
0x000009f8 beq v0, v1, 0xa14 |
| while (1) {
| label_2:
0x000009fc jalr t9 | t9 ();
0x00000a00 nop |
0x00000a04 lw gp, 0x10(sp) | gp = *(var_10h);
| label_1:
0x00000a08 lw t9, -0x7f90(gp) | t9 = sym.imp.exit;
0x00000a0c addiu a0, zero, 1 | a0 = 1;
0x00000a10 jalr t9 | t9 ();
0x00000a14 jalr t9 | t9 ();
0x00000a18 nop |
0x00000a1c lw gp, 0x10(sp) | gp = *(var_10h);
0x00000a20 lw t9, -0x7f90(gp) | t9 = sym.imp.exit;
0x00000a24 move a0, zero | a0 = 0;
0x00000a28 jalr t9 | t9 ();
| label_3:
0x00000a2c lw s2, -0x7f84(gp) | s2 = *((gp - 8161));
0x00000a30 lw v0, (s2) | v0 = *(s2);
0x00000a34 addiu a0, v0, 1 | a0 = v0 + 1;
0x00000a38 slt a0, a0, s1 | a0 = (a0 < s1) ? 1 : 0;
| if (a0 != 0) {
0x00000a3c beql a0, zero, 0xb14 |
0x00000a40 lw s0, -0x7f7c(gp) | s0 = *((gp - 8159));
0x00000a44 sll v0, v0, 2 | v0 <<= 2;
0x00000a48 addu v0, s0, v0 | v0 = s0 + v0;
0x00000a4c lw t9, -0x7fb4(gp) | t9 = sym.imp.strtol;
0x00000a50 lw a0, 4(v0) | a0 = *((v0 + 1));
0x00000a54 addiu a2, zero, 0xa | a2 = 0xa;
0x00000a58 addiu a1, sp, 0x18 | a1 = sp + 0x18;
0x00000a5c lw s1, (v0) | s1 = *(v0);
0x00000a60 jalr t9 | t9 ();
0x00000a64 lw a3, (s2) | a3 = *(s2);
0x00000a68 lw v1, 0x18(sp) | v1 = *(var_18h);
0x00000a6c addiu a3, a3, 1 | a3++;
0x00000a70 sll a3, a3, 2 | a3 <<= 2;
0x00000a74 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000a78 lwx a3, a3(s0) | __asm ("lwx a3, a3(s0)");
0x00000a7c move s2, v0 | s2 = v0;
| if (a3 == v1) {
0x00000a80 beq a3, v1, 0xb58 | goto label_4;
| }
0x00000a84 lw t9, -0x7f70(gp) | t9 = sym.imp.ugpio_request_named;
0x00000a88 move a0, s1 | a0 = s1;
0x00000a8c jalr t9 | t9 ();
0x00000a90 move s0, v0 | s0 = v0;
0x00000a94 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 == 0) {
0x00000a98 beqz v0, 0xbac | goto label_5;
| }
0x00000a9c lw t9, -0x7f74(gp) | t9 = sym.imp.ugpio_open;
0x00000aa0 move a0, v0 | a0 = v0;
0x00000aa4 jalr t9 | t9 ();
0x00000aa8 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x00000aac bltz v0, 0xb74 | goto label_6;
| }
0x00000ab0 lw t9, -0x7f9c(gp) | t9 = sym.imp.ugpio_set_value;
0x00000ab4 sltu a1, zero, s2 | a1 = (0 < s2) ? 1 : 0;
0x00000ab8 move a0, s0 | a0 = s0;
0x00000abc jalr t9 | t9 ();
0x00000ac0 lw gp, 0x10(sp) | gp = *(var_10h);
| if (v0 < 0) {
0x00000ac4 bltz v0, 0xbcc | goto label_7;
| }
0x00000ac8 lw a1, -0x7fdc(gp) | a1 = *((gp - 8183));
0x00000acc lw t9, -0x7fa4(gp) | t9 = sym.imp.__printf_chk
0x00000ad0 sltu v0, zero, v0 | v0 = (0 < v0) ? 1 : 0;
0x00000ad4 addiu a2, v0, 0x30 | a2 = v0 + 0x30;
0x00000ad8 addiu a1, a1, 0x1018 | a1 += 0x1018;
0x00000adc addiu a0, zero, 1 | a0 = 1;
0x00000ae0 jalr t9 | t9 ();
0x00000ae4 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000ae8 lw t9, -0x7fa0(gp) | t9 = sym.imp.ugpio_close;
0x00000aec move a0, s0 | a0 = s0;
0x00000af0 jalr t9 | t9 ();
0x00000af4 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000af8 lw t9, -0x7fb0(gp) | t9 = sym.imp.ugpio_free;
0x00000afc move a0, s0 | a0 = s0;
0x00000b00 jalr t9 | t9 ();
0x00000b04 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000b08 lw t9, -0x7f90(gp) | t9 = sym.imp.exit;
0x00000b0c move a0, zero | a0 = 0;
0x00000b10 jalr t9 | t9 ();
| }
0x00000b14 lw a0, -0x7fdc(gp) | a0 = *((gp - 8183));
0x00000b18 lw t9, -0x7f88(gp) | t9 = sym.imp.fwrite;
0x00000b1c lw a3, (s0) | a3 = *(s0);
0x00000b20 addiu a2, zero, 0x12 | a2 = 0x12;
0x00000b24 addiu a1, zero, 1 | a1 = 1;
0x00000b28 addiu a0, a0, 0xfa4 | a0 += str.Missing_arguments_n;
| label_0:
0x00000b2c jalr t9 | t9 ();
0x00000b30 nop |
0x00000b34 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000b38 lw a0, (s0) | a0 = *(s0);
0x00000b3c addiu a1, zero, 1 | a1 = 1;
0x00000b40 lw a3, -0x7fdc(gp) | a3 = *((gp - 8183));
0x00000b44 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000b48 lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x00000b4c addiu a3, a3, 0xf2c | a3 += str.setbit;
0x00000b50 addiu a2, a2, 0xf34 | a2 += str.Usage:_n_s_gpioname__value__n_nSet_the_current_value_of_a_gpio_pin_nValue_must_be_0_for_low_or_non_zero_for_high_n_n;
0x00000b54 b 0x9fc |
| }
| label_4:
0x00000b58 lw s0, -0x7f7c(gp) | s0 = *((gp - 8159));
0x00000b5c lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000b60 lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x00000b64 lw a0, (s0) | a0 = *(s0);
0x00000b68 addiu a2, a2, 0xfb8 | a2 += str.Cant_parse_value__s_n;
0x00000b6c addiu a1, zero, 1 | a1 = 1;
0x00000b70 b 0xb2c | goto label_0;
| label_6:
0x00000b74 lw v0, -0x7f7c(gp) | v0 = *((gp - 8159));
0x00000b78 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000b7c lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x00000b80 lw a0, (v0) | a0 = *(v0);
0x00000b84 move a3, s1 | a3 = s1;
0x00000b88 addiu a2, a2, 0xfe4 | a2 += str.Cant_open_ugpio_for__s_n;
0x00000b8c addiu a1, zero, 1 | a1 = 1;
0x00000b90 jalr t9 | t9 ();
0x00000b94 lw gp, 0x10(sp) | gp = *(var_10h);
| do {
0x00000b98 lw t9, -0x7fb0(gp) | t9 = sym.imp.ugpio_free;
0x00000b9c move a0, s0 | a0 = s0;
0x00000ba0 jalr t9 | t9 ();
0x00000ba4 lw gp, 0x10(sp) | gp = *(var_10h);
0x00000ba8 b 0xa08 | goto label_1;
| label_5:
0x00000bac lw v0, -0x7f7c(gp) | v0 = *((gp - 8159));
0x00000bb0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000bb4 lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x00000bb8 lw a0, (v0) | a0 = *(v0);
0x00000bbc move a3, s1 | a3 = s1;
0x00000bc0 addiu a2, a2, 0xfd0 | a2 += str.No_ugpio_for__s_n;
0x00000bc4 addiu a1, zero, 1 | a1 = 1;
0x00000bc8 b 0x9fc | goto label_2;
| label_7:
0x00000bcc lw v0, -0x7f7c(gp) | v0 = *((gp - 8159));
0x00000bd0 lw a2, -0x7fdc(gp) | a2 = *((gp - 8183));
0x00000bd4 lw t9, -0x7fa8(gp) | t9 = sym.imp.__fprintf_chk
0x00000bd8 lw a0, (v0) | a0 = *(v0);
0x00000bdc move a3, s1 | a3 = s1;
0x00000be0 addiu a2, a2, 0x1000 | a2 += str.Cant_set_value_for__s_n;
0x00000be4 addiu a1, zero, 1 | a1 = 1;
0x00000be8 jalr t9 | t9 ();
0x00000bec lw gp, 0x10(sp) | gp = *(var_10h);
0x00000bf0 lw t9, -0x7fa0(gp) | t9 = sym.imp.ugpio_close;
0x00000bf4 move a0, s0 | a0 = s0;
0x00000bf8 jalr t9 | t9 ();
0x00000bfc lw gp, 0x10(sp) | gp = *(var_10h);
0x00000c00 b 0xb98 |
| } while (1);
| }
[*] Function printf used 8 times setbit