Fix ftw flag tags, broken after the RStr.glob refactoring ##shell

This commit is contained in:
pancake 2024-04-04 12:48:09 +02:00 committed by pancake
parent 7912a07a4b
commit a543e966a1
14 changed files with 158 additions and 121 deletions

View File

@ -536,7 +536,7 @@ static void cmd_flag_tags(RCore *core, const char *input) {
RListIter *iter;
RList *list = r_flag_tags_list (core->flags, NULL);
r_list_foreach (list, iter, tag) {
r_cons_printf ("%s:\n", tag);
// r_cons_printf ("%s:\n", tag);
r_core_cmdf (core, "ftn %s", tag);
}
r_list_free (list);
@ -589,10 +589,13 @@ static void cmd_flag_tags(RCore *core, const char *input) {
RFlagItem *flag;
RList *flags = r_flag_tags_get (core->flags, arg);
switch (mode) {
case 'n':
case 'n': // "ftn"
// TODO : implement ftnj
// TODO : implement ftn, -> using table api
r_list_foreach (flags, iter, flag) {
// r_cons_printf ("0x%08"PFMT64x"\n", flag->offset);
r_cons_printf ("0x%08"PFMT64x" %s\n", flag->offset, flag->name);
r_cons_printf ("0x%08"PFMT64x" %s %s\n",
flag->offset, arg, flag->name);
}
break;
default:

View File

@ -1,5 +1,5 @@
malloc
free$
calloc
kalloc
realloc
*.malloc
*.free$
*.calloc
*.kalloc
*.realloc

View File

@ -1,9 +1,9 @@
encrypt
decrypt
aes
AES
blowfish
_des
_rc2
serpent
_cbc
*.encrypt
*.decrypt
*.aes
*.AES
*.blowfish
*._des
*._rc2
*.serpent
*._cbc

View File

@ -1,6 +1,6 @@
dlopen
dlsym
dlclose
mmap
LoadLibrary
GetProcAddress
*.dlopen
*.dlsym
*.dlclose
*.mmap
*.LoadLibrary
*.GetProcAddress

View File

@ -1,7 +1,7 @@
getenv
putenv
unsetenv
setenv
GetEnvironmentVariable
SetEnvironmentVariable
ExpandEnvironmentStrings
*.getenv
*.putenv
*.unsetenv
*.setenv
*.GetEnvironmentVariable
*.SetEnvironmentVariable
*.ExpandEnvironmentStrings

View File

@ -1,33 +1,33 @@
open$
close
read$
write
CloseHandle
FindFirstFileW
_wfopen
_wstat
ftruncate
lseek
_chsize
GetFullPathName
realpath
RemoveDirectory
DeleteFile
CreateFile
WriteFile
UnmapViewOfFile
CreateFileMapping
MapViewOfFile
readlink
chmod
fchmod
chown
stat
fstat
lstat
fstatat
lstat64
stat64
chflags
fchflags
lchflags
*.open$
*.close
*.read$
*.write
*.CloseHandle
*.FindFirstFileW
*._wfopen
*._wstat
*.ftruncate
*.lseek
*._chsize
*.GetFullPathName
*.realpath
*.RemoveDirectory
*.DeleteFile
*.CreateFile
*.WriteFile
*.UnmapViewOfFile
*.CreateFileMapping
*.MapViewOfFile
*.readlink
*.chmod
*.fchmod
*.chown
*.stat
*.fstat
*.lstat
*.fstatat
*.lstat64
*.stat64
*.chflags
*.fchflags
*.lchflags

View File

@ -1,10 +1,10 @@
socket
connect
bind$
listen
accept
sendto
recvfrom
gethostbyname
htons
ntohs
*.socket
*.connect
*.bind$
*.listen
*.accept
*.sendto
*.recvfrom
*.gethostbyname
*.htons
*.ntohs

View File

@ -1,9 +1,9 @@
getpid
getppid
kill
exit
abort
assert
gethostid
sethostid
sysctl
*.getpid
*.getppid
*.kill
*.exit
*.abort
*.assert
*.gethostid
*.sethostid
*.sysctl

View File

@ -1,3 +1,3 @@
^printf
puts
write
*.puts
*.write

View File

@ -1,10 +1,10 @@
strcat
strcpy
strncpy
strlen
strtok
strstr
strlcpy
asprintf
sprintf
snprintf
*.strcat
*.strcpy
*.strncpy
*.strlen
*.strtok
*.strstr
*.strlcpy
*.asprintf
*.sprintf
*.snprintf

View File

@ -1,7 +1,7 @@
pthread_create
pthread_mutex_init
pthread_cond_init
CreateThread
TerminateThread
WaitForSingleObject
GetCurrentThreadId
*.pthread_create
*.pthread_mutex_init
*.pthread_cond_init
*.CreateThread
*.TerminateThread
*.WaitForSingleObject
*.GetCurrentThreadId

View File

@ -1,20 +1,20 @@
settimeofday
gettimeofday
time
adjtime
ctime
timed
date$
sleep
Sleep
usleep
clock_nanosleep
localtime
asctime
difftime
gmtime
mktime
timelocal
timegm
tzfile
tzset
*.settimeofday
*.gettimeofday
*.time
*.adjtime
*.ctime
*.timed
*.date$
*.sleep
*.Sleep
*.usleep
*.clock_nanosleep
*.localtime
*.asctime
*.difftime
*.gmtime
*.mktime
*.timelocal
*.timegm
*.tzfile
*.tzset

28
test/db/cmd/flags Normal file
View File

@ -0,0 +1,28 @@
NAME=ftw
FILE=bins/elf/ls
CMDS=<<EOF
ftw
EOF
EXPECT=<<EOF
0x00021d18 fs reloc.readlink
0x00021dc8 fs reloc.lseek
0x00021ca8 process reloc.abort
0x00021f90 process reloc.exit
0x00021ca0 alloc reloc.free
0x00021e38 alloc reloc.calloc
0x00021eb8 alloc reloc.malloc
0x00021ef8 alloc reloc.realloc
0x00021c78 env reloc.getenv
0x00021d28 env reloc.setenv
0x00021f50 env reloc.unsetenv
0x00021cd8 string reloc.strcpy
0x00021d68 string reloc.strlen
0x00021da8 string reloc.snprintf
0x00018bf7 time str.ctime
0x00021dd0 time reloc.gettimeofday
0x00021e88 time reloc.tzset
0x00021ee0 time reloc.mktime
0x00021f18 time reloc.timegm
EOF
RUN

View File

@ -16,6 +16,12 @@ bool test_r_glob(void) {
mu_assert_eq (r_str_glob ("foo.c", "^f*"), 1, "foo.c -> ^f* -> 1");
mu_assert_eq (r_str_glob ("foo.c", "foo.c$"), 1, "foo.c -> foo.c$ -> 1");
mu_assert_eq (r_str_glob ("foo.c", "fooooooo"), 0, "foo.c -> fooooooo -> 0");
mu_assert_eq (r_str_glob ("mydate", "*date$"), 1, "mydate -> date$-> 1");
mu_assert_eq (r_str_glob ("mydate", "date$"), 0, "mydate -> date$-> 1");
mu_assert_eq (r_str_glob ("date", "^date$"), 1, "mydate -> date$-> 1");
mu_assert_eq (r_str_glob ("mydate", "^date$"), 0, "mydate -> date$-> 1");
mu_assert_eq (r_str_glob ("foo.bar.baz", "*.baz"), 1, "foo.bar.baz -> *.baz -> 1");
mu_assert_eq (r_str_glob ("foo.bar.baz", "*.bar"), 0, "foo.bar.baz -> *.bar -> 0");
mu_assert_eq (r_str_glob ("foo.bar.baz", "*.bar.*"), 1, "foo.bar.baz -> *.bar.* -> 1");