Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15314742
  • 博文数量: 2005
  • 博客积分: 11986
  • 博客等级: 上将
  • 技术积分: 22535
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-17 13:56
文章分类

全部博文(2005)

文章存档

2014年(2)

2013年(2)

2012年(16)

2011年(66)

2010年(368)

2009年(743)

2008年(491)

2007年(317)

分类:

2008-12-29 15:04:40

《定制shell脚本在busybox中运行》
// Copyright 2008 luther.gliethttp
#include
#include
#include

int main(int argc, char *argv[])
{
    int fd;
    char buf[256];
    int value;
    int i;
    struct timeval tv;

    fd = open("/dev/random", O_RDONLY | O_NONBLOCK);
    if (fd == -1) fd = open("/dev/urandom", O_RDONLY | O_NONBLOCK);
    if (read(fd, buf, 256) > 0) {
       
    }

    gettimeofday(&tv, 0);
    value = tv.tv_sec + tv.tv_usec;
    for (i = 0;i < 256;i++) {
        value += value*0xdeec + buf[i];
    }

    printf("%u", value);
    close(fd);
}
luther@gliethttp:/vobs$ arm-linux-gcc -o lu_random lu_random.c
luther@gliethttp:/vobs$ arm-linux-strip -s lu_random
阅读(5313) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~