Table of Contents

IronForgeCyber

Courses

Resources

Blog

Log In



IronForgeCyber

AboutPrivacyTerms

© 2026 IronForgeCyber. All rights reserved.

  1. resources
  2. radare2
  3. rafind2

Rafind2: Pattern Matching

rafind2 is the command-line front-end of the radare2 searching library. These commands are equivalent to the / (searching) module. For more information on searching, see the / (searching) module page.

String Searching

We can search for strings using the -s flag. This will search for a specific string and return the offset from the base address.

rafind2
$ rafind2 -s "flag.txt" ./args0x2016

Use the -z flag to search for all zero-terminated strings. This will return the address and the string.

rafind2
$ rafind2 -z ./args0x00000028 4 \v(0x00000136 td80x00000176 td\b/0x08048194 /lib/ld-linux.so.20x0804829d _IO_stdin_used0x080482ac gets0x080482b1 stdout0x080482b8 __libc_start_main0x080482ca puts0x080482cf system0x080482d6 fflush0x080482dd libc.so.60x080482e7 GLIBC_2.00x080482f1 GLIBC_2.340x080482fc __gmon_start__0x0804a008 You lose!0x0804a012 cat flag.txt0x0804a01f Good luck winning here!0x0804a0db ;*2$"0x00000000 GCC: (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.00x00000001 crt1.o0x00000008 __abi_tag0x00000012 crtstuff.c0x0000001d deregister_tm_clones0x00000032 __do_global_dtors_aux0x00000048 completed.00x00000054 __do_global_dtors_aux_fini_array_entry0x0000007b frame_dummy0x00000087 __frame_dummy_init_array_entry0x000000a6 args.c0x000000ad __FRAME_END__0x000000bb _DYNAMIC0x000000c4 __GNU_EH_FRAME_HDR0x000000d7 _GLOBAL_OFFSET_TABLE_0x000000ed __libc_start_main@GLIBC_2.340x0000010a __x86.get_pc_thunk.bx0x00000120 fflush@GLIBC_2.0

Regex Searching

Use the -e flag to search for a regular expression. This will return the address and the string. Remember that radare2 uses / for edge wildcards and .. for centered wildcards.

rafind2
$ rafind2 -e "/flag/" ./args0x2016
0x00000131 gets@GLIBC_2.0
0x00000140 _edata
0x00000147 _fini
0x0000014d __data_start
0x0000015a puts@GLIBC_2.0
0x00000169 system@GLIBC_2.0
0x0000017a __gmon_start__
0x00000189 __dso_handle
0x00000196 _IO_stdin_used
0x000001a9 _end
0x000001ae _dl_relocate_static_pie
0x000001c6 _fp_hw
0x000001cd stdout@GLIBC_2.0
0x000001de __bss_start
0x000001ea main
0x000001ef __x86.get_pc_thunk.ax
0x00000205 read_in
0x0000020d __TMC_END__
0x00000219 _init
0x00000001 .symtab
0x00000009 .strtab
0x00000011 .shstrtab
0x0000001b .interp
0x00000023 .note.gnu.build-id
0x00000036 .note.ABI-tag
0x00000044 .gnu.hash
0x0000004e .dynsym
0x00000056 .dynstr
0x0000005e .gnu.version
0x0000006b .gnu.version_r
0x0000007a .rel.dyn
0x00000083 .rel.plt
0x0000008c .init
0x00000092 .text
0x00000098 .fini
0x0000009e .rodata
0x000000a6 .eh_frame_hdr
0x000000b4 .eh_frame
0x000000be .init_array
0x000000ca .fini_array
0x000000d6 .dynamic
0x000000df .got
0x000000e4 .got.plt
0x000000ed .data
0x000000f3 .bss
0x000000f8 .comment