[b01lers2020]Welcome to Earth(python)

考察:写脚本

又来一道考察编写python脚本的题目。。当然也可以不用python编写

一开始反转就是不断地抓包看源码,最后到/fight/这里时:
[b01lers2020]Welcome to Earth(python)_第1张图片
就是对些字符串进行全排列,不过很明显pctf{hey_boys是开头,以}结尾的


itertools.permutations():就是返回可迭代对象的所有数学全排列方式

itertools.permutations()
它以任意迭代作为参数,并始终返回生成元组的迭代器。它没有(也不应该)特殊的字符串。要获得字符串列表,您可以自己加入元组:
list(map("".join, itertools.permutations('1234')))

from itertools import permutations

flag = ["{hey", "_boy", "aaaa", "s_im", "ck!}", "_baa", "aaaa", "pctf"]

item= permutations(flag) #对flag全排列,返回的是iterators(迭代器)

for i in item:
    #print(i)
    k="".join(i) #join连接成为字符串
    #print(k)
    if k.startswith('pctf{hey_boys') and k[-1]=='}':
        print(k)

你可能感兴趣的:(做题杂记~)