---恢复内容开始---

首先看源代码:

#include <stdio.h>

int main(){
unsigned int random;
random = rand(); // random value! unsigned int key=;
scanf("%d", &key); if( (key ^ random) == 0xdeadbeef ){
printf("Good!\n");
system("/bin/cat flag");
return ;
} printf("Wrong, maybe you should try 2^32 cases.\n");
return ;
}

这题就很简单啦,只要输入的key与random异或为0xdeadbeef便得到flag

首先我们要对rand&srand有个总体的看法:srand初始化随机种子,rand产生随机数,下面将详细说明。
rand(产生随机数)
表头文件: #include
定义函数 :int rand(void)
函数说明 :

因为rand的内部实现是用线性同余法做的,他不是真的随机数,只不过是因为其周期特别长,所以有一定的范围里可看成是随机的,rand()会返回一随机数值,范围在0至RAND_MAX 间。在调用此函数产生随机数前,必须先利用srand()设好随机数种子,如果未设随机数种子,rand()在调用时会自动设随机数种子为1。rand()产生的是假随机数字,每次执行时是相同的。若要不同,以不同的值来初始化它.初始化的函数就是srand()。

 #include<stdio.h>
#include<stdlib.h>
int main()
{
unsigned random;
random = rand(); printf("%u", random);
return ;
}

得到:

执行random:

---恢复内容结束---

pwnable.kr random 之 write up的更多相关文章

  1. 【pwnable.kr】random

    pwnable从入门到放弃第七题. ssh random@pwnable.kr -p2222 (pw:guest) 目前为止做的最快的一道题... #include <stdio.h> i ...

  2. pwnable.kr详细通关秘籍(二)

    i春秋作家:W1ngs 原文来自:pwnable.kr详细通关秘籍(二) 0x00 input 首先看一下代码: 可以看到程序总共有五步,全部都满足了才可以得到flag,那我们就一步一步来看 这道题考 ...

  3. 【pwnable.kr】 codemap

    pwnable新的一题. download: http://pwnable.kr/bin/codemap.exe ssh codemap@pwnable.kr -p2222 (pw:guest) 这道 ...

  4. 【pwnable.kr】lotto

    pwnable.好像最近的几道题都不需要看汇编. ssh lotto@pwnable.kr -p2222 (pw:guest) 直接down下来源码 #include <stdio.h> ...

  5. pwnable.kr的passcode

    前段时间找到一个练习pwn的网站,pwnable.kr 这里记录其中的passcode的做题过程,给自己加深印象. 废话不多说了,看一下题目, 看到题目,就ssh连接进去,就看到三个文件如下 看了一下 ...

  6. pwnable.kr bof之write up

    这一题与前两题不同,用到了静态调试工具ida 首先题中给出了源码: #include <stdio.h> #include <string.h> #include <st ...

  7. pwnable.kr col之write up

    Daddy told me about cool MD5 hash collision today. I wanna do something like that too! ssh col@pwnab ...

  8. pwnable.kr brainfuck之write up

    I made a simple brain-fuck language emulation program written in C. The [ ] commands are not impleme ...

  9. pwnable.kr login之write up

    main函数如下: auth函数如下: 程序的流程如下: 输入Authenticate值,并base64解码,将解码的值代入md5_auth函数中 mad5_auth()生成其MD5值并与f87cd6 ...

随机推荐

  1. JMS 之 Active MQ 消息存储

    一.消息的存储方式 ActiveMQ支持JMS规范中的持久化消息与非持久化消息 持久化消息通常用于不管是否消费者在线,它们都会保证消息会被消费者消费.当消息被确认消费后,会从存储中删除 非持久化消息通 ...

  2. Spring事务隔离级别

    REQUIRED:业务方法需要在一个容器里运行.如果方法运行时,已经处在一个事务中,那么加入到这个事务,否则自己新建一个新的事务. NOT_SUPPORTED:声明方法不需要事务.如果方法没有关联到一 ...

  3. Vue按需加载提升用户体验

    Vue官方文档异步组件: 在大型应用中,我们可能需要将应用拆分为多个小模块,按需从服务器下载.为了让事情更简单, Vue.js 允许将组件定义为一个工厂函数,动态地解析组件的定义.Vue.js 只在组 ...

  4. 行内元素和块级元素的具体区别是什么?行内元素的padding和margin可设置吗?

    块级元素(block)特性: 总是独占一行,表现为另起一行开始,而且其后的元素也必须另起一行显示; 宽度(width).高度(height).内边距(padding)和外边距(margin)都可控制; ...

  5. Swift三元条件运算

    三元条件运算的特殊在于它是有三个操作数的运算符,它的原型是问题?答案1:答案2.它简洁地表达根据问题成立与否作出二选一的操作.如果问题成立,返回答案1的结果; 如果不成立,返回答案2的结果. 使用三元 ...

  6. BeanUtils.copyProperties VS PropertyUtils.copyProperties

    作为两个bean属性copy的工具类,他们被广泛使用,同时也很容易误用,给人造成困然:比如:昨天发现同事在使用BeanUtils.copyProperties copy有integer类型属性的bea ...

  7. Selenium chrome配置代理Python版

    环境: windows 7 + Python 3.5.2 + Selenium 3.4.2 + Chrome Driver 2.29 + Chrome 58.0.3029.110 (64-bit) S ...

  8. leetcode-486-Predict the Winner

    Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from eith ...

  9. [leetcode-593-Valid Square]

    Given the coordinates of four points in 2D space, return whether the four points could construct a s ...

  10. HybridApp Exception

    HybridApp Exception [创建安卓虚拟机失败]CPU acceleration status:HAXM must be updated(version 1.1.1<6.0.1) ...