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. 关于web前端性能优化问题

    好久没有来博客写随笔了,可能是懒了吧,哈哈, 最近很想整理一篇关于前端性能优化的问题,毕竟能提高网站的观赏性对吧.提升网站性能,提升用户体验 那 什么是web性能优化? 可以这么理解:从用户访问资源到 ...

  2. MongoDB的安装以及启动

    1.首先什么是MongoDB? MongoDB是一个基于分布式文件存储的数据库,是由c++语言编写的.为web应用提供可扩展的高性能数据的存储方案.是一个介于关系型数据库和非关系型数据库 的中间产品, ...

  3. python-类对象的遍历操作

    视频教程 https://study.163.com/course/courseLearn.htm?courseId=1005985001#/learn/video?lessonId=10533511 ...

  4. vue安装 js-cookie

    首先在命令行工具输入:npm install vue-js-cookie 安装完成之后在需要使用的页面导入:import Cookies from 'js-cookie' 这样就可以使用了,如下图,先 ...

  5. linux运维、架构之路-MHA高可用方案

    一.软件介绍          MHA(master high   availability)目前是MySQL高可用方面是一个相对成熟的解决方案.在切换过程中,mha能做到0-30s内自动完成数据库的 ...

  6. 6.12友谊赛T4城市交通费题解

    与普通的最短路径不同的是,题目中新引入了一个计入总体的费用——城市建设费.由于城市建设费由整体的某最大值决定,导致解没有最优子结构的性质,给思维带来难度. 既然最棘手的是城市建设费,我们就对它分类讨论 ...

  7. AGC030F - Permutation and Minimum

    https://atcoder.jp/contests/agc030/tasks/agc030_f 题解 我们先把这个排列从\(1 \sim 2n\)表达出来,然后题面中的每一对数我们可以用一条线把他 ...

  8. 170814-17关于javaweb的知识点

    1.   静态web项目.动态web项目区别                                         WEB-INF                               ...

  9. 170815-关于Session知识点

    Cookie:实际上就是一个头.               服务器会创建Cookie,并且将Cookie以一个响应头的形式发送给浏览器               浏览器收到Cookie以后,会保存 ...

  10. bootstrap中selectpicker下拉框使用方法实例

    最近一直在用bootstrap 的一些东西,写几篇博客记录下.... bootstrap selectpicker是bootstrap里比较简单的一个下拉框的组件,先看效果如下: 附上官网api链接, ...