ssh连接,输入密码查看目录下的文件

看看random.c的源码

#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),所以rand()在调用时会自动设随机数种子为1,导致随机数都是相同值,我们用gdb调试一下,看看随机值

先把文件下载下来

scp -P  -r random@pwnable.kr:/home/random/ /home/你的下载地址

用gdb在rand后面断点,慢慢调试(n)

之后,发现执行完寄存器rax的值为0x6b8b4567,即rand的值,之后获得结果

把答案提交即可

Mommy, I thought libc random is unpredictable...

Pwnable-random的更多相关文章

  1. 【pwnable.kr】random

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

  2. pwnable.kr random 之 write up

    ---恢复内容开始--- 首先看源代码: #include <stdio.h> int main(){ unsigned int random; random = rand(); // r ...

  3. pwnable之random

    这题只要多调试几次就会发现其产生的随机数是固定的一个值,那么就可以通过这个随机值和0xdeadbeef反推出我们要输入的数据, 最后附上这题的flag:flag:Mommy, I thought li ...

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

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

  5. pwnable.kr-balckjack-Writeup

    MarkdownPad Document *:first-child { margin-top: 0 !important; } body>*:last-child { margin-botto ...

  6. pwnable.kr-random-Writeup

    MarkdownPad Document *:first-child { margin-top: 0 !important; } body>*:last-child { margin-botto ...

  7. 【pwnable.kr】 codemap

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

  8. 【pwnable.kr】lotto

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

  9. Chrome V8引擎系列随笔 (1):Math.Random()函数概览

    先让大家来看一幅图,这幅图是V8引擎4.7版本和4.9版本Math.Random()函数的值的分布图,我可以这么理解 .从下图中,也许你会认为这是个二维码?其实这幅图告诉我们一个道理,第二张图的点的分 ...

  10. Math.random()

    Math.random() 日期时间函数(需要用变量调用):var b = new Date(); //获取当前时间b.getTime() //获取时间戳b.getFullYear() //获取年份b ...

随机推荐

  1. Java总结转载,持续更新。。。

    1.Java中内存划分 https://www.cnblogs.com/yanglongbo/p/10981680.html

  2. SQL Server 移位运算符

    参考链接:http://dataeducation.com/bitmask-handling-part-4-left-shift-and-right-shift/ SQL Server 官网的连接:h ...

  3. hdu6521 吉司机线段树

    http://acm.hdu.edu.cn/showproblem.php?pid=6521 待填 代码 #include<bits/stdc++.h> #define ls o<& ...

  4. Codeforces Round #599 (Div. 2) B1. Character Swap (Easy Version) 水题

    B1. Character Swap (Easy Version) This problem is different from the hard version. In this version U ...

  5. 关于unittest单元测试框架中常用的几种用例加载方法

    unittest模块是Python自带的一个单元测试模块,我们可以用来做单元测试.unittest模块包含了如下几个子模块: 测试用例:TestCase 测试集:TestSuite 加载用例:Test ...

  6. 【linux】切换到root用户,并重置root用户密码

    1.切换当前用户 到 root用户 sudo -i 2.重置root用户密码 sudo passwd root

  7. WPF图片,DataGrid等实现圆角

    <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <Grid.Ro ...

  8. .NET MVC5简介(六)HttpHandler

    浏览器到网站程序 上一篇中,介绍IHttpModule的时候,自定义一个类CustomHttpModule继承自IHttpModule,自定义一个事件,并配合配置文件,就可以执行自定义Module中的 ...

  9. SmtpClient发送邮件时附件名称乱码

    在用户环境发现一个现象,使用System.Net.Mail.SmtpClient发送邮件,当附件名包含中文且长度较长时,最终的邮件里附件名会乱掉,写个简单的测试程序: var mail = new M ...

  10. Spring Boot的注解,你知道或者不知道的都在这里!

    1.1 定义 Annotation(注解),用于为Java代码提供元数据.简单理解注解可以看做是一个个标签,用来标记代码.是一种应用于类.方法.参数.变量.构造器及包的一种特殊修饰符. 1.2 注解的 ...