[C] Re-execute itself from elf file.
Posted Jeremy 學習筆記
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[C] Re-execute itself from elf file.相关的知识,希望对你有一定的参考价值。
Re-execute itself from elf file.
#define _GNU_SOURCE #include <sched.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <string.h> #include <errno.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/wait.h> extern char **environ; int main(int argc, char *argv[]) { char **ep; char *sh[] = {"/bin/sh", NULL}; char me[256], *mee[] = {me, "hello", NULL}; puts("hey~"); //execve(*sh, sh, environ); if ( argc > 1 && strcmp(argv[1], "hello") == 0 ) { printf("argv[1] : %s\n", argv[1]); puts("from execve()..."); return 0; } memset(me, 0, sizeof(me)); readlink("/proc/self/exe", me, sizeof(me) - 1); printf("[+] Found myself: ‘%s‘\n", me); execve(*mee, mee, environ); for ( ep = environ; *ep != NULL; ep++) printf("environ: %s\n", *ep); }
以上是关于[C] Re-execute itself from elf file.的主要内容,如果未能解决你的问题,请参考以下文章
Product of Array Exclude Itself
Product of Array Exclude Itself
lintcode-easy-Product of Array Exclude Itself
canal启动报错ERROR c.a.o.canal.parse.inbound.mysql.dbsync.DirectLogFetcher - I/O error while reading fro
embody the data item with the ability to control access to itself
Spring Security 错误:java.lang.IllegalStateException: Can't configure anyRequest after itself