2 Star 1 Fork 1

bytes33/linux-inject

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sample-target.c 615 Bytes
一键复制 编辑 原始数据 按行查看 历史
gaffe 提交于 2015-04-07 09:40 . add comment blocks for sample target app
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/ptrace.h>
/*
* sleepfunc()
*
* The only purpose of this function is to output the message "sleeping..."
* once a second to provide a more concrete idea of when the sample library
* gets injected.
*
*/
void sleepfunc()
{
struct timespec* sleeptime = malloc(sizeof(struct timespec));
sleeptime->tv_sec = 1;
sleeptime->tv_nsec = 0;
while(1)
{
printf("sleeping...\n");
nanosleep(sleeptime, NULL);
}
free(sleeptime);
}
/*
* main()
*
* Call sleepfunc(), which loops forever.
*
*/
int main()
{
sleepfunc();
return 0;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bytes33/linux-inject.git
git@gitee.com:bytes33/linux-inject.git
bytes33
linux-inject
linux-inject
master

搜索帮助