是时候用一个简短的例子来结束短暂的STL学习了。
回文
回文是向前或向后阅读时相同的单词或短语,例如“racecar”或“Malayalam”。阅读回文时,习惯上会忽略空格、标点符号和大写字母,因此“Mr. Owl ate my metal worm”和“Go hang a salami! I'm a lasagna hog。”这两句话将被视为回文。
是时候用一个简短的例子来结束短暂的STL学习了。
回文是向前或向后阅读时相同的单词或短语,例如“racecar”或“Malayalam”。阅读回文时,习惯上会忽略空格、标点符号和大写字母,因此“Mr. Owl ate my metal worm”和“Go hang a salami! I'm a lasagna hog。”这两句话将被视为回文。
主要提下level6和level8,前者是靠call (void)win()
水过的,后者是花了比较多的精力才理解
You can modify the state of your target program with the
set
command. For example, you can use
set $rdi = 0
to zero out $rdi. You can use
set *((uint64_t *) $rsp) = 0x1234
to set the first value on
the stack to 0x1234. You can use
set *((uint16_t *) 0x31337000) = 0x1337
to set 2 bytes at
0x31337000 to 0x1337.
Suppose your target is some networked application which reads from some socket on fd 42. Maybe it would be easier for the purposes of your analysis if the target instead read from stdin. You could achieve something like that with the following gdb script:
start catch syscall read commands silent if ($rdi == 42) set $rdi = 0 end continue end continue
This example gdb script demonstrates how you can automatically break on system calls, and how you can use conditions within your commands to conditionally perform gdb commands.
In the previous level, your gdb scripting solution likely still required you to copy and paste your solutions. This time, try to write a script that doesn't require you to ever talk to the program, and instead automatically solves each challenge by correctly modifying registers / memory.
level5是通过实时在终端中打印出对应位置的随机值,再手动输入;这题更进一步,要求脚本自动给随机值找到并输入。
在卡了几天后参考这位师傅的博客找到了解决方案:[Debugging Refresher](https://j-shiro.github.io/p/debugging-refresher/)
1 | 0x00005798218a7d0b in main () |
运行22次空指令后能找到cmp %rax,%rdx
,再运行一次就会发现要让函数往下走的要求就是要rax
和rdx
相等。脚本就很好写了.
在main+686
中断并修改两个寄存器的值
1 | start |
然后最多运行64次continue
就可以得到flag了
As we demonstrated in the previous level, gdb has FULL control over the target process. Under normal circumstances, gdb running as your regular user cannot attach to a privileged process. This is why gdb isn't a massive security issue which would allow you to just immediately solve all the levels. Nevertheless, gdb is still an extremely powerful tool.
Running within this elevated instance of gdb gives you elevated
control over the entire system. To clearly demonstrate this, see what
happens when you run the command call (void)win()
.
Note that this will not get you the flag (it seems that we broke the win function!), so you'll need to work a bit harder to get this flag!
As it turns out, all of the levels other levels in module could be solved in this way.
GDB is very powerful!
当我们想要调用win()
函数时会发生什么?
1 | 0x00005b9bc84e6b99 in main () |
查看一下win()
的代码:
1 | 0x00005b9bc84e6951 <+0>: endbr64 |
1 | set $rip = 0x5bb43cb6b980 #实际上从win+35到win+47都行 |
==原文章链接:==[菜鸟笔记之pwn工具篇--pwntools库的基本使用 - XiDP - 博客园](https://www.cnblogs.com/XiDP0/p/18445564)
Pwntools 是一个用于漏洞利用和二进制分析的
Python 库
,广泛应用于安全研究、渗透测试和竞争性编程(如
CTF,Capture The
Flag)它为用户提供了一套强大的工具和功能,以简化与二进制文件的交互
、网络通信
以及各种常见任务的执行
。
题目要求:
In this level, you will be working with registers. You will be asked to modify or read from registers.
In this level, you will work with registers! Please set the following:
安装wsl后只有终端界面太单调了,遂网上寻找给Ubuntu添加图形界面的方法。中间遇见了一些坑,记下来以备查阅。
日常做不出题。。。要是功力有这师傅一半深就好了...orz...
记录在pwncollege里的一些学习笔记
考虑以下的递归公式:
\[ n! = \begin{cases} 1 & \text{if } n = 0 \\ n \times (n - 1)! & \text{otherwise} \end{cases} \]
用C语言表示如下:
数据库是一个有组织的、相互关联的数据集合,用来模拟现实世界中的某些方面(例如,模拟班级中的学生或数字音乐商店)。人们常常将“数据库”和“数据库管理系统”(例如 MySQL、Oracle、MongoDB)混为一谈。数据库管理系统(DBMS)是用于管理数据库的软件。
考虑一个模拟数字音乐商店(例如 Spotify)的数据库。假设这个数据库存储了关于艺术家及其发行的专辑的信息。
本节设计神经网络的学习中的一些重要的观点。主题有寻找最优权重参数的优化方法,权重参数的初始值,超参数的设定方法等。为了应对过拟合(神经网络在训练样本中表现过于优越,导致在验证数据集和测试数据集中表现不佳),还会介绍权值衰减,Dropout等正则化方法。