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[], *mee[] = {me, "hello", NULL};
puts("hey~");
//execve(*sh, sh, environ); if ( argc > && strcmp(argv[], "hello") == ) {
printf("argv[1] : %s\n", argv[]);
puts("from execve()...");
return ;
} memset(me, , sizeof(me));
readlink("/proc/self/exe", me, sizeof(me) - );
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.的更多相关文章

  1. Failed to execute operation: No such file or directory(systemctl enable iptables.service)

    在保存Iptables配置时:systemctl enable iptables.service 出现错误: Failed to execute operation: No such file or ...

  2. Watch gcc at ubuntu 12,See ELF file header

    first write article at my ubuntu 12. ELF is very important file format.

  3. Centos下的 .so is not an ELF file

    1 错误描述: 测试程序时,发现报错: 动态库不是一个ELF文件, 此时确定LD_LIBRARY_PATH设置正确,然后执行ldconfig命令,发现如上图: 后来执行:file liblog4cpp ...

  4. compile to 32-bit elf file

    nasm -f elf -o a.o a.asm gcc -c -m32 -o b.o b.c ld -s -m elf_i386 -Ttext 0x30400 -o b.bin b.o a.o

  5. ldconfig: /usr/lib/libpython2.6.so.1.0-gdb.py is not an ELF file - it has the wrong magic bytes at the start.

    https://bugzilla.redhat.com/show_bug.cgi?id=562980

  6. how can i get the source code path && file names from an ELF file(compired with -g)?

    https://stackoverflow.com/questions/31333337/how-can-i-get-the-source-code-path-file-names-from-an-e ...

  7. ELF(Executable and Linkable Format)

    目录 . 引言 . ELF文件格式 . ELF格式分析工具 0. 引言 0x1: ELF文件类型 ELF文件标准里把系统中采用ELF格式的文件归为以下几类 . 可重定位文件(Relocatable F ...

  8. 可执行文件(ELF)格式之讲解

    ELF(Executable and Linking Format)是一种对象文件的格式,用于定义不同类型的对象文件(Object files)中都放了什么东西.以及都以什么样的格式去放这些东西.它自 ...

  9. 可执行文件(ELF)格式的理解

    摘自http://www.cnblogs.com/xmphoenix/archive/2011/10/23/2221879.html 可执行文件(ELF)格式的理解 ELF(Executable an ...

随机推荐

  1. spring security基本知识(三) 过滤详细说明

    在我们前面的文章Spring Security 初识(一)中,我们看到了一个最简单的 Spring Security 配置,会要求所有的请求都要经过认证.但是,这并不是我们想要的,我们通常想自定义应用 ...

  2. Word快捷选取

    在word中,你知道鼠标单击选中一个词,双击选中一行,三击选中一个段落吗?

  3. 面试题常考&必考之--js中的数组去重和字符串去重

    1.引入:首先得知道数组没有可以直接去重的方法,即直接[].unique()是不支持的, 会报“Uncaught TypeError: [].unique is not a function”错误, ...

  4. 2017乌鲁木齐网络赛 J题 Our Journey of Dalian Ends ( 最小费用最大流 )

    题目链接 题意 : 给出一副图,大连是起点,终点是西安,要求你求出从起点到终点且经过中转点上海的最小花费是多少? 分析 : 最短路是最小费用最大流的一个特例,所以有些包含中转限制或者经过点次数有限制的 ...

  5. HDU 4027 Can you answer these queries? (线段树成段更新 && 开根操作 && 规律)

    题意 : 给你N个数以及M个操作,操作分两类,第一种输入 "0 l r" 表示将区间[l,r]里的每个数都开根号.第二种输入"1 l r",表示查询区间[l,r ...

  6. android 小游戏 ---- 数独(二)

    > 首先创建一个自己的View类   -->继承SurfaceView并实现SurfaceHolder.Callback接口    --> SurfaceView.getHolder ...

  7. [CSP-S模拟测试]:简单的期望(DP)

    题目描述 从前有个变量$x$,它的初始值已给出. 你会依次执行$n$次操作,每次操作有$p\%$的概率令$x=x\times 2$,$(100−p)\%$的概率令$x=x+1$. 假设最后得到的值为$ ...

  8. fedora18 Cannot retrieve metalink for repository: fedora. Please verify its path and try again 解决方法

    Cannot retrieve metalink for repository: fedora. Please verify its path and try again 解决方法 执行如下命令: s ...

  9. [git] 如何处理push失败的commit

    在使用git及github时,遇到一个问题:commit了一个超过100M的大文件,然后在push时失败,然后就再也无法push了,本地大文件删除了,再commit,再push也还是提示有大文件提交. ...

  10. layer系列之弹层layer.prompt

    layer官网:https://www.layui.com/doc/modules/layer.html layer在线调试:http://layer.layui.com/ 如何使用layer.pro ...