blackjack - pwnable
blackjack - pwnable
题目
题目要求我们在21点游戏中,赢得100万,就可以获得flag。也给出源码
源码分析
连上服务器玩了几盘之后发现,赢是可以赢的,也可以写脚本自动运行,但是赚钱速度太慢。题目提示我们去看看源码,一番查看之后我们发现这个重点:
//Global Variables
int bet;int betting() //Asks user amount to bet
{printf("\n\nEnter Bet: $");scanf("%d", &bet);if (bet > cash) //If player tries to bet more money than player has{printf("\nYou cannot bet more money than you have.");printf("\nEnter Bet: ");scanf("%d", &bet);return bet;}else return bet;
} // End Function
bet定义的是数值类型;判断下注金额与拥有的现金,仅仅通过bet>cash的简单判断语句。忽略了当bet为负数的情况。
我们尝试一下输入负赌注:
Cash: $500
-------
|D |
| 9 |
| D|
-------Your Total is 9The Dealer Has a Total of 10Enter Bet: $-999999999Would You Like to Hit or Stay?
Please Enter H to Hit or S to Stay.
sYou Have Chosen to Stay at 9. Wise Decision!The Dealer Has a Total of 12
The Dealer Has a Total of 14
The Dealer Has a Total of 16
The Dealer Has a Total of 18
Dealer Has the Better Hand. You Lose.You have 0 Wins and 1 Losses. Awesome!Would You Like To Play Again?
Please Enter Y for Yes or N for No
yYaY_I_AM_A_MILLIONARE_LOL //flagCash: $1000000499
-------
|H |
| 4 |
| H|
-------Your Total is 4The Dealer Has a Total of 4Enter Bet: $
flag再进行新一轮游戏的时候出来了。
blackjack - pwnable相关推荐
- pwnable.kr之blackjack
blackjack 这几天好忙,有点烦躁,这几天可能都没有什么时间刷题了...加油! 代码:http://cboard.cprogramming.com/c-programming/114023-si ...
- 【pwnable.kr】 blackjack - 成为百万富翁(millionaire)
本关是一个blackjack游戏(21点),源码在这里https://cboard.cprogramming.com/c-programming/114023-simple-blackjack-pro ...
- pwnable.kr---blackjack
pwnable.kr-blackjack 解题思路 万万没想到这个题突破点在这里,我本想不看别人的writeup 独立做出这个题目的,但还是败给了自己,加油! 1.先在服务器玩一下这个游戏,然后去看游 ...
- pwnable.kr之Toddler‘s Bottle 9~16题知识点记录
文章目录 第九题 mistake 总结 答案: 第十题 shellshock env指令 bash指令 解题 第十一题 coin1 findall(pattern, string, flags=0) ...
- Pwnable之[Toddler's Bottle](二)
Pwnable之[Toddler's Bottle](2) Pwn挑战地址 11.coin1 nc 连上. 要你玩一个游戏,游戏的规则是: 你手里拿了几枚金币. 然而,其中有一枚假币. 假币和真币一模 ...
- 【pwnable】asm之write up
首先查看源代码: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <s ...
- pwnable input2 之 write up
首先看源代码: 1 input2@ubuntu:~$ cat input.c 2 #include <stdio.h> 3 #include <stdlib.h> 4 #inc ...
- pwnable.kr lotto题解
ssh lotto@pwnable.kr -p2222 (pw:guest) 题目源码: #include <stdio.h> #include <stdlib.h> #inc ...
- 简单易懂的 pwnable.kr 第六题[random]Writeupt
简单易懂的 pwnable.kr 第六题[random]Writeupt 题目地址: http://pwnable.kr/play.php 题目: peak小知识 异或^ 据有如下几种性质: 2. 恒 ...
最新文章
- C#调用JAVA接口WSSE方式用WebClient方式
- 安卓系统换成linux系统软件,将旧安卓手机打造成“简易linux”机器,并部署AdGuardHome...
- java 外卖订餐系统_java外卖订餐系统小项目
- 9月第1周国内IT技术类网站:CSDN覆盖数持续走低
- educoder实训答案python_Educoder Python入门之经典函数实例
- linux下配置squid 服务器,最简单使用方式
- Burpsuite工具的代理抓包功能实验
- Java进阶:SpringBoot
- python list转json对象,python 对象和json互相转换方法
- threejs 快速入门小技巧
- linux vi 替换字符串,Linux vi编辑器如何查找与替换关键字
- GPS 经纬度换算方法和定位误差计算
- php将请求转发,PHP中实现请求转发(curl)和请求重定向
- java jre 1.8_jre1.8官方下载
- 国美在线php面试题,国美电器面试经验
- 蓝牙电话之PBAP同步电话簿协议分析
- python批量tif文件转化jpg文件格式
- NX/UG二次开发简单干涉
- Windows 10 系统精简方案参考
- node.js读取文件中文乱码问题
热门文章
- ios客户端学习-UIButton
- 201871010104-陈园园 《面向对象程序设计(java)》第四周学习总结
- 2017年美国计算机科学,2017年U.S.News美国大学研究生计算机科学专业排名
- m与n的数字运算python_python数值计算
- 中国人寿旗下多地国寿金融中心吸引新机构入驻
- 机架服务器最多有多少cpu,小身材却有大能量:高密度机架服务器
- VMware Workstation 16 Pro及Centos 7 x86-64 iso镜像 安装 激活 使用 及 解决vm安装报错eulas_agreed=1
- 修改Discuz! X2标题、底部和Archiver页面的版权信息
- 包,内部类,常用类,集合
- Android 10.0 进入recovery模式(等待用户选择recovery模式界面)实现自动恢复出厂设置