MoeCTF2020
PS.这里并不全且仅供参考
文章目录
WEB
EZmath
import requests
import re
url='http://39.98.86.109:10001/'
s=requests.Session()
r=s.get(url)
r.encoding='utf-8'
print(r.text)
data1=re.findall(r'</p><br>\n\d{1,3}\+\d{1,3}',r.text)
print('data')
print(data1)
data2="".join(data1)
print('data2')
print(data2)
num=eval(data2.lstrip('</p><br>\n'))
print(str(num))
r=s.post(url,data={'a':num})
r.encoding='utf-8'
print(r.text)
基础脚本题,掌握request库即可~
Moe unserialize
vim异常退出,访问下载.index.php.swp文件
vim -r index.php.swp 恢复原来的vim文件
payload:
flag=O:3:“Moe”:3:{s:1:“a”;s:1:“1”;s:4:"%00*%00b";s:1:“2”;s:6:"%00Moe%00c";s:1:“3”;}
三心二意
<?php
$a = $_GET['a'];
$b = $_POST['b'];
$c = $_REQUEST['c'];
$d = $_COOKIE['d'];
if (!isset($a, $b, $c, $d)) {
highlight_file(__FILE__);
} else {
if (is_numeric($a) and $a == false) {
echo 'A is OK!';
echo '<br/>';
if (!is_numeric($b) and $b == 0x125e591) {
echo 'B is OK!';
echo '<br/>';
if ($c != 240610708 and md5($c) == md5(240610708)) {
echo 'C is OK!';
echo '<br/>';
if (strlen($d) < 7 and $d != 0 and $d ** 2 == 0) {
include('/flag');
} else {
echo "D is not wanted.<br/>";
highlight_file(__FILE__);
}
} else {
echo "C is not wanted.<br/>";
highlight_file(__FILE__);
}
} else {
echo "Too young too simple.<br/>";
highlight_file(__FILE__);
}
} else {
echo "A is not wanted.<br/>";
highlight_file(__FILE__);
}
}
a=0&c=QNCKDZO
b=19260817%00 # 00截断
b=19260817a 过了:php弱比较
#d[]=“234” ??这样也过了 此处存疑
d=1e-300 数字足够小的话d**2==0
结果:
A is OK!
B is OK!
C is OK!
moectf{PHP_1s_the_besT_lAngu@ge}
EzMath2
#!/usr/bin/env python3 from flask import Flask,render_template,request from black import black_list app = Flask(__name__) # flag is in /flag @app.route('/',methods=['GET','POST'])
def index():
if request.method=='POST':
input=request.form['a']
if input==None:
return render_template('index.html',answer="nothing")
else:
for i in black_list:
if i in input:
return render_template('index.html',answer='nonono!')
try:
ans=str(eval(input))
except: ans="nonono!"
return render_template('index.html',answer=ans)
if request.method=='GET':
return render_template('index.html')
@app.route('/source')
def source():
return open("app.py","r").read()
if __name__ == '__main__':
app.run(host="0.0.0.0",port=10004,debug=False)
模版还在学,打扰了
misc
不会吧 就这
不会吧? 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 就这¿ 就这¿ 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 就这¿ 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 就这¿ 就这¿ 就这¿ 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 不会吧? 就这¿ 就这¿ 不会吧? 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 就这¿ 就这¿ 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 就这¿ 不会吧? 就这¿ 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 不会吧? 不会吧? 就这¿ 就这¿ 不会吧? 就这¿ 不会吧? 就这¿ 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 不会吧? 就这¿ 就这¿
10011010000011001010111011111010111011100001011000101100001
011101111110010110100000011000111011010001100100111101111101
00010111000010110100011001100101011111100
Process finished with exit code 0
逆序后
(ascii码->二进制后首位必定是0,ascii 马的范围为0-127
00111111
01010011
00110001
01101000
01110100
01011111
01111001
00110001
01101110
00110000
00101101
00111111
01110100
00110100
01101000
01110111
01011111
01110101
00110000
01011001
1100000010101100110011101001011110001011101000001000011011001110100100011100111111010010110000001000101111001011100101111000100010100000100010101100111110100110
Process finished with exit code 0
?S1ht_y1n0-?t4hw_u0Y 再倒过来
死了 misc渣渣落泪 题目好讽刺我这个辣鸡啊
base64?
找了个脚本
# coding:utf-8
# s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
s = "vwxrstuopq34567ABCDEFGHIJyz012PQRSTKLMNOZabcdUVWXYefghijklmn89+/"
def My_base64_encode(inputs):
# 将字符串转化为2进制
bin_str = []
for i in inputs:
x = str(bin(ord(i))).replace('0b', '')
bin_str.append('{:0>8}'.format(x))
# print(bin_str)
# 输出的字符串
outputs = ""
# 不够三倍数,需补齐的次数
nums = 0
while bin_str:
# 每次取三个字符的二进制
temp_list = bin_str[:3]
if (len(temp_list) != 3):
nums = 3 - len(temp_list)
while len(temp_list) < 3:
temp_list += ['0' * 8]
temp_str = "".join(temp_list)
# print(temp_str)
# 将三个8字节的二进制转换为4个十进制
temp_str_list = []
for i in range(0, 4):
temp_str_list.append(int(temp_str[i * 6:(i + 1) * 6], 2))
# print(temp_str_list)
if nums:
temp_str_list = temp_str_list[0:4 - nums]
for i in temp_str_list:
outputs += s[i]
bin_str = bin_str[3:]
outputs += nums * '='
print("Encrypted String:\n%s " % outputs)
def My_base64_decode(inputs):
# 将字符串转化为2进制
bin_str = []
for i in inputs:
if i != '=':
x = str(bin(s.index(i))).replace('0b', '')
bin_str.append('{:0>6}'.format(x))
# print(bin_str)
# 输出的字符串
outputs = ""
nums = inputs.count('=')
while bin_str:
temp_list = bin_str[:4]
temp_str = "".join(temp_list)
# print(temp_str)
# 补足8位字节
if (len(temp_str) % 8 != 0):
temp_str = temp_str[0:-1 * nums * 2]
# 将四个6字节的二进制转换为三个字符
for i in range(0, int(len(temp_str) / 8)):
outputs += chr(int(temp_str[i * 8:(i + 1) * 8], 2))
bin_str = bin_str[4:]
print("Decrypted String:\n%s " % outputs)
print()
print(" *************************************")
print(" * (1)encode (2)decode *")
print(" *************************************")
print()
num = input("Please select the operation you want to perform:\n")
if (num == "1"):
input_str = input("Please enter a string that needs to be encrypted: \n")
My_base64_encode(input_str)
else:
input_str = input("Please enter a string that needs to be decrypted: \n")
My_base64_decode(input_str)
两只企鹅
方法1:图片winhex看密码:ctrl+F搜索key
方法2:stegSolve看图片详细信息,分块后直接看到密码
解开压缩包发现.pyc文件
在线python反编译
。。。然后。。。。。。。啊啊啊啊wsl
ps:后来看群里讨论是pyc隐写
Classic Crypto
大帝的征程#1
zbrpgs{p0adh3e_gu3_j0eyq}
ROT13
特定恺撒密码名称
根据偏移量的不同,还存在若干特定的恺撒密码名称:
- 偏移量为10:Avocat(A→K)
- 偏移量为13:ROT13
- 偏移量为-5:Cassis (K 6)
- 偏移量为-6:Cassette (K 7)
套用ROT13到一段文字上仅仅只需要检查字元字母顺序并取代它在13位之后的对应字母,有需要超过时则重新绕回26英文字母开头即可。A换成N、B换成O、依此类推到M换成Z,然后序列反转:N换成A、O换成B、最后Z换成M。只有这些出现在英文字母里头的字元受影响;数字、符号、空白字元以及所有其他字元都不变。因为只有在英文字母表里头只有26个,并且26=2×13,ROT13函数是它自己的逆反:
对任何字元x:ROT13(ROT13(x))=ROT26(x)=x。
换句话说,两个连续的ROT13应用函式会回复原始文字(在数学上,这有时称之为对合(involution);在密码学上,这叫做对等加密(reciprocalcipher))。
转换可以利用查找表完成,如下例所示:
moectf{c0nqu3r_th3_w0rld}
大帝的征程#2
先试探规律:
text='mpgfxk{j8w05q4_8xk_d7mhqfht}'
for i in text:
print(ord(i),end=' ')
text2='moectf'
print('\n')
for k in text2:
print(ord(k),end=' ')
规律很明显,但是本fw写的很垃圾,写了很久
text='mpgfxk{j8w05q4_8xk_d7mhqfht}'
a=-1
flag=''
key='0123456789abcdefghijklmnopqrstuvwxyz'
for i in text:
print(ord(i),end='\t')
print(chr(ord(i)), end='\t')
print('\n')
for i in text:
a+=1
if 48<=ord(i)<=57:
index=ord(i)-48
s=(index-a+36)%36
print(str(s))
flag=flag+key[s]
elif 97<=ord(i)<=122:
index=ord(i)-97+11
s = (index - a + 36) % 36
print(str(s))
flag = flag + key[s-1]
else:
flag = flag + i
print(flag)
moectf{c0nquer_th3_un1v3rs3}
外面的世界
mc{i33ny_-n~otR1n_cp1FN}efaFc32Tsuy
栅栏密码,栏数为3
moectf{Rai1F3nc3_3nc2ypT_1s-FunNy~}
在线解码:https://www.qqxiuzi.cn/bianma/zhalanmima.php
大帝的征程#3
@64E7L4_?BF6C0E9b0)s$trN
发现是ROT47
moectf{c0nquer_th3_XDSEC}
大帝的征程#维吉尼亚
pgieqi{k0_ajxW_k-R3zq?}
通过上面的表格,找到密钥dsecx
在线https://www.qqxiuzi.cn/bianma/weijiniyamima.php
moectf{s0_whaT_s-N3xt?}
Crypto
easycrypto
题目就是给了加密函数enc;写出解密函数即可
直接py爆破
from math import sqrt
def enc(plain):
cipher = []
for i in plain:
m = ord(i)
cipher.append(5 * m ** 2 + 6 * m - 8)
return cipher
def dec(cipher):
plain=[]
for i in cipher:
for m in range(10,200): # 其实只要到127即可,ascii马限制
k=5 * m ** 2 + 6 * m - 8
if k==i:
plain.append(chr(m))
return plain
cipher=[60051, 62263, 51603, 49591, 67968, 52624, 76375, 38359, 51603, 58960, 49591, 62263, 60051, 51603, 45687, 67968, 62263, 45687, 22839, 65656, 73923, 63384, 67968, 62263, 78867]
print(''.join(dec(cipher)))
def dec(cipher):
plain=[]
for i in cipher:
for m in range(10,200): # 其实只要到127即可,ascii马限制
k=5 * m ** 2 + 6 * m - 8
if k==i:
plain.append(chr(m))
return plain
cipher=[60051, 62263, 51603, 49591, 67968, 52624, 76375, 38359, 51603, 58960, 49591, 62263, 60051, 51603, 45687, 67968, 62263, 45687, 22839, 65656, 73923, 63384, 67968, 62263, 78867]
print(''.join(dec(cipher)))