WEB|[b01lers2020]Welcome to Earth
网页提示AMBUSH!(伏击)You've gotta escape!(你得逃脱),只有按任意键就会跳转页面
抓包发送请求看到/chase/目录
访问/chase/,页面提示 You managed to chase one of the enemy fighters, but there's a wall coming up fast!(你设法追上了一名敌方战士,但有一堵墙即将到来 快起来!),并且源码看到/leftt/目录
访问/leftt/,提示You've got the bogey in your sights, take the shot!,得到目录/shoot/
访问目录/shoot/,得到/door/目录
继续访问,提示YOU APPROACH THE ALIEN CRAFT! How do you get inside?
猜测是点击数字然后check,但是太多一个一个点不是办法,使用selenium写一个脚本
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
driver = webdriver.Chrome()
driver.get('http://e5f33079-c8e3-4153-a64b-3ad8116e259f.node4.buuoj.cn:81/door/')
num_list = driver.find_elements(By.NAME, 'side')
for num in num_list:
num.click()
driver.find_element(By.TAG_NAME, 'button').click()
text = driver.find_element(By.TAG_NAME, 'h1').text
time.sleep(1)
driver.back()
但是跑完了也没有不同的页面,再查看网页源码发现js文件,应该是被误导了,
查看js文件,发现/open/目录
访问/open/目录,查看网页源码,发现js
访问js文件,得到/fight/目录
访问/fight/目录,没有内容,继续查看网页源码,发现js
访问js文件得到源码
// Run to scramble original flag
//console.log(scramble(flag, action));
function scramble(flag, key) {
for (var i = 0; i < key.length; i++) {
let n = key.charCodeAt(i) % flag.length;
let temp = flag[i];
flag[i] = flag[n];
flag[n] = temp;
}
return flag;
}
function check_action() {
var action = document.getElementById("action").value;
var flag = ["{hey", "_boy", "aaaa", "s_im", "ck!}", "_baa", "aaaa", "pctf"];
// TODO: unscramble function
}
代码提示猜测要实现的功能,console.log(scramble(flag, action));提示运行scramble函数,看了一下这里想要实现的是通过对flag内容的顺序的切换以排列出真正的flag
方法一:猜测flag
一般flag格式:flag{sss-asfds-asd-asd}
所以flag是以一个特殊字符开始,然后接 { 再加各种字符,最后以 } 结尾
pctf{hey_boys_im_baaaaaaaaaack!}
方法二:排列组合
排列出所有以 pctf {hey_ 开始,以 ck!} 结尾的组合,然后找出最像flag的一个,这里是最像一句话
脚本:
from itertools import permutations
flag = ["{hey", "_boy", "aaaa", "s_im", "ck!}", "_baa", "aaaa", "pctf"]
item = permutations(flag)
for i in item:
k = ''.join(list(i))
if k.startswith('pctf{hey') and k.endswith('ck!}'):
print(k)