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. Django【第10篇】:Django之分页初级版本

    分页和中间件 一.分页 Django的分页器(paginator) view.py from django.shortcuts import render,HttpResponse # Create ...

  2. 【leetcode】Champagne Tower

    题目如下: 解题思路:本题如果用递归来做,思路会非常清晰.每个杯子得到的总的香槟的数量,减去自身杯子容量后,多余的部分均分成两部分,下层的两个杯子各得一半,但是这种解法在输入香槟较大的情况下会导致超时 ...

  3. android中使用Application

    在android开发过程中,我们可能存储一些全局的变量,最好在正在app的任何一个activity或者service中都可以访问到,这时我们可以使用application. 我们的一个应用就叫appl ...

  4. (17)Python读取摄像头并实现视频播放、暂停、指定目录保存、回放功能

    读取摄像头并播放.暂停功能 import sys #import scipy.io as sio from PyQt5 import QtGui, QtCore, QtWidgets #from wy ...

  5. (12)QT中搭建opencv开发环境

    只需要在项目工程文件pro中添加上: INCLUDEPATH += G:/opencv/build/include \ G:/opencv/build/include/opencv \ G:/open ...

  6. testlink用例转换工具2018.12版

    首先说明一点,网上有很多资料,但真正可用的很少:在本人经过百度后,发现其实很多案例会因为各种原因而无法最终实现. Testlink用例转换工具,可以大致分为3种工具: 1)EX-Converter由第 ...

  7. POJ 1432 Decoding Morse Sequences (DP)

    Decoding Morse Sequences 题目链接: http://acm.hust.edu.cn/vjudge/contest/129783#problem/D Description Be ...

  8. vue2.0 之 douban (二)创建自定义组件tabbar

    1.大体布局 这个组件分为两部分:第一个是组件的外层容器,第二个是组件的子容器item,子组件里面又分为图片和文字组合.子组件有2个状态,一个默认灰色的状态,一个选中状态,我们来实现一下这个组件的布局 ...

  9. cookie格式化

    #coding=utf- import requests url = 'http://www.baidu.com' f=open(r'cookies.txt','r') cookies={} for ...

  10. springSecurity总结

    springSecurity总结: 一.Spring security框架简介   1.简介           一个能够为基于Spring的企业应用系统提供声明式的安全訪问控制解决方式的安全框架(简 ...