我以下面的 C 程序为例::
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(int argc, char const *argv[]) {
srand(time(NULL));
printf("%d\n", rand());
}
也strace
不能ltrace
检测到srand
orrand
调用。这是为什么?
sumit@HAL9000:~$ gcc random.c -o random
sumit@HAL9000:~$ ./random
1460823359
sumit@HAL9000:~$ ltrace ./random
1937594805
+++ exited (status 0) +++
sumit@HAL9000:~/PlaidCTF/golf.so$ strace ./random
execve("./random", ["./random"], 0x7ffede6c1b60 /* 56 vars */) = 0
brk(NULL) = 0x556f5832e000
...
mprotect(0x7f5eaab03000, 4096, PROT_READ) = 0
munmap(0x7f5eaaab2000, 151418) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x1), ...}) = 0
brk(NULL) = 0x556f5832e000
brk(0x556f5834f000) = 0x556f5834f000
write(1, "714715340\n", 10714715340
) = 10
exit_group(0) = ?
+++ exited with 0 +++