Write up

1.

打开后发现是这样的一串UZZJAM{UIXETGR7TMWD42SKTCWEP4AG_mhrlmshnayfihzl}

放进随波逐流中在众多解密中找到了令人心动的 NSSCTF{NBQXMZK7MFPW42LDMVPXI4TZ_fakeflagtrybase}

然我们去尝试一下base,把NBQXMZK7MFPW42LDMVPXI4TZ放进basecrack,是base32密码

得到fiag:have_a_nice_try

2.

打开是这样的:“SWZxWl=F=DQef0hlEiSUIVh9ESCcMFS9NF2NXFzM,今年是本世纪的第23年呢”

base中在结尾出现==是正常现象,但是这个不正常,题目标签提示有栅栏密码,但是普通穷举分栏后并没有什么有用信息,那么这个栅栏是怎么用的呢,查了一下变异栅栏:栅栏密码详解,发现还有一种w型栅栏,分栏23

EXP

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

vector<int> allocate(const int& n, const int& h) { //n个字符,加密深度为h
	vector<int> cnt(h);
	int cnt_phase = n / (h - 1);
	int cnt_lowerphase = cnt_phase / 2;
	int cnt_upperphase = cnt_phase - cnt_lowerphase;
	cnt[0] = cnt_upperphase;
	cnt[h - 1] = cnt_lowerphase;
	for (int i = 1; i <= h - 2; i++) {
		cnt[i] = cnt_phase;
	}
	int remain = n - cnt_phase * (h - 1);
	if (remain == 0)
		return cnt;
	if (cnt_phase % 2 == 0) {
		for (int i = 0; i <= remain - 1; ++i)
			++cnt[i];
	}
	else {
		for (int i = h - 1; i >= h - remain; --i)
			++cnt[i];
	}
	return cnt;

}

vector<string> getLines(const string& encrypted, const int& h) {
	vector<string> line(h);
	vector<int> cnt = allocate(encrypted.length(), h);
	line[0] = encrypted.substr(0, cnt[0]);
	int length = 0;
	for (int i = 1; i <= h - 1; i++) {
		length += cnt[i - 1];
		line[i] = encrypted.substr(length, cnt[i]);
	}
	return line;
}

string decrypt(const string& encrypted, const int& h) {
	vector<string>line = getLines(encrypted, h);
	int length = encrypted.length();
	int director = 0;
	int now = 0;
	int mark[100];
	for (int i = 0; i < h; i++) {
		mark[i] = 0;
	}

	string decrypted;
	for (int i = 0; i < length; i++) {
		if (now == 0)
			director = 1;
		else if (now == h - 1)
			director = -1;
		decrypted += line[now][mark[now]];
		++mark[now];
		now += director;
	}
	return decrypted;
}

int main() {
	string text = "SWZxWl=F=DQef0hlEiSUIVh9ESCcMFS9NF2NXFzM";
	cout << decrypt(text, 23);
	return 0;
}

运行得到:SWZxWlFDe0liUV9ScF9FNFMzX2NSMCEhISEhfQ==

嗯~,很标准的base64,得到:IfqZQC{IbQ_Rp_E4S3_cR0!!!!!}

但是要NSSCTF{}包裹,再使用一次凯撒,移位23,哈哈,23真是个神奇的数字呢

3.

瓦提特文字

这么多的字符从头找起太费时间了,所以观察到最后一行有{},那么里面的很有可能是flag

对照下表得到:LITCTF{YUANLAINIYEWANYUANSHENWWW}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值