記一次新生賽BJDCTF(WP)


1.Hello_world:

進入網站后發現就clip_image001按鈕點了之后不是在前端頁面上跳轉而是跳轉到其它網頁。clip_image003

根據提示,在跳轉時抓包得到clip_image005

發現guest后面的是base64碼,解開后還是guest,於是想到在訪問時的數據包中加上id:admin+admin的base64, clip_image007

之后出現這個界面:

clip_image009

想到修改XFF偽裝成本地訪問

clip_image011

之后出現頁面如下:

clip_image013

於是想到修改Refer(偽造來源),得:clip_image015

得到flag

2.Hidden secrets

進入網頁后,隨便輸入個密碼,抓包

回復包中發現如下字段疑似md5碼:

clip_image016

解密后為112233:

clip_image018

輸入密碼后進入新頁面查看源碼,得到flag:

clip_image020

3.easy_md5:

隨便輸入個密碼,數據包中找到hint

clip_image021

暗示我讓where后面的東西返回true

想到sql注入的一個情況,要讓其變成password=’xxx’ or ‘1’的形式。

寫個腳本找滿足這樣條件的md5明文:

clip_image022

得到個ffifdyop

輸入后,查看跳轉后頁面的源碼

clip_image024

由源碼想到構造兩個值不同,md5相同的a,b傳進去:

QNKCDZO
240610708

clip_image026

這次變成了三個等於,於是想兩者都傳入數組繞過

clip_image028

得到flag

4.easy_upload

進去后讓傳文件,還只讓傳圖片,就傳了個圖片馬,看看能不能執行

clip_image030

clip_image032

上傳后,彈出文件的路徑:uploads/2e611bb0c1967c4f74746c36233567e9.jpg

猜測action參數后面傳入對應的路徑的文件能被執行,於是試試

clip_image034

測驗成功

,再傳入一句話木馬,列出文件,查看文件,得flag

clip_image036

clip_image038

5.這序列化也太簡單了吧

將傳入的序列化中的對象數設為2,根據提示,設置對象的值為/flag

Payload如下

clip_image040

6.簽個到?

Winhex打開發現頭部有個png,猜測其為png文件,於是改后綴為png后打開,圖片為二維碼,掃碼得flag

7.你猜我是個啥

用記事本軟件打開即可得flag

clip_image042

8.藏藏藏

Binwalk分析出有zip文件,foremost分離出來。打開壓縮包中的文件,掃描文件中的二維碼,得flag

9.認真你就輸了

binwalk分析出來發現有其它文件,用foremost分離后,在文件夾中找到flag.txt,打開得fag

clip_image044

10.just a rar

文件中,壓縮包的解壓密碼為4位數,直接爆破可得密碼為2016. clip_image045

winhex打開解壓后的圖片clip_image046發現flag

11.一葉障目

修改圖片寬高即可得圖片下方有flag

12.雞你太美

第一個圖看不出什么,用winhex打開第二個圖發現開為9a,猜測差了個GIF8,原本GIF文件開頭應為GIF89a,在前方添加后,發現圖片能打開了,圖片上顯示的即為flag

13.納尼

開頭為9a,猜測差了個GIF8,原本GIF文件開頭應為GIF89a,在前方添加后,發現圖片能打開了,保存每一幀的圖,圖片上顯示的按幀數順序拼起來為一個base64,解碼后即為flag

clip_image048

14.JustRe

ida打開,搜索文本BJD得到flag

clip_image049(去掉%d%d)

15. Sign In

直接16進制碼解碼

clip_image051

16. 編碼與調制

猜測為標准曼徹斯特編碼

直接解碼得flag

clip_image052

17. Every minute counts

直接BFS搜索,返回搜到Aqua時的前封面數

18. notakto_1

靜態博弈,代碼如下:

from pwn import *

pairs = {0: (0, 8),1: (1, 7), 2:(2, 6), 3:(3, 5)}

juststart=True

def find(x):

for i in range(4):

if(x) in pairs[i]:

return i

def choose(x):

global flag

p = pairs[find(x)]

if(x)==p[0]:

p = p[1]

else:

p = p[0]

k = [p-1, p+1, p-3, p+3]

for i in k:

if((i//3==p//3 or i%3 == p%3)and i<=8 and i>=0 and i!=4 and flag[find(i)]==0):

return i

def iswin(s):

global flag

global juststart

if(s.find("ROUND") != -1):

juststart = True

p = s.find("ROUND")

print(s[p-12:p+15])

flag = [0 for x in range(4)]

def recv(s):

p = s.find("My move:")

if(p==-1):

return -1

for i in s:

try:

if(i[0] == 'M'):

recv = int(i[9])

return recv

except:

pass

else:

return -1

r = remote("222.186.56.247", 8122)

s = r.recvuntil("Your move")

flag = [0 for i in range(4)]

while(1):

iswin(s)

if(juststart==False):

k = s.find( "My move" )

else:

k = -1

if(k==-1):

r.sendline("4")

print("send:", 4)

juststart = False

else:

k = int(s[k+9])

print("recv:", k)

flag[int(find(k))] = 1

p = choose(k)

print('send:', p)

r.sendline(str(p))

flag[find(p)] = 1

try:

s = r.recvuntil("Your move")

except:

s = r.recvuntil( "}" )

print(s)

break

19. Pyramid

打表,找規律

之后解決代碼如下:

#include<stdio.h>

#include<iostream>

#include<map>

#include<algorithm>

#include<cstring>

#include<string.h>

#include<math.h>

#include<vector>

#include<map>

using namespace std;

typedef long long ll;

#define MAXN 1000005

#define INF 0x3f3f3f3f

#define MOD 1000000007

const double pi = acos(-1.0);

const double eps = 1e-6;

ll qpow(ll a, ll b, ll c)

{

ll ans = 1;

while(b)

{

if(b&1)

ans = ans*a%c;

a = a*a%c;

b >>= 1;

}

return ans;

}

int main()

{

ll n;

scanf("%lld", &t);

ll inv24 = qpow(24, MOD-2, MOD);

scanf("%lld", &n);

ll ans = n*(n+1)%MOD*(n+2)%MOD*(n+3)%MOD*inv24%MOD;

cout << ans << '\n';

return 0;

}

20. Real Hero

最短路問題,這題我用Dijkstra

解決代碼如下:

#include<cstdio>

#include<vector>

#include<queue>

#include<utility>

#include<cstring>

using namespace std;

#define MAXN 1020

#define INF 0x3f

typedef long long ll;

//b、dijkstra 堆優化 O(nlogn)

typedef pair<ll, ll> P; //first是到源點最短距離,second是頂點的編號

struct edge { ll to, cost;

edge (ll too, ll costt) { to = too; cost = costt; }

};//指向頂點to的權值為cost的邊

vector <edge> G[MAXN];//存圖 可以理解為二維的,每個G包含若干項,這些項是以當前編號點為起點, 若干項邊結構體(edge)的v為終點,cost為權值的邊

void addedge (ll u, ll v, ll w) {

G[u].push_back (edge (v, w)); //添加從u到v權值為w的邊

}

ll ma[MAXN][MAXN];

ll kl[MAXN];

ll dis[MAXN][MAXN];

//ll pre[MAXN];//記錄前驅節點

ll d[MAXN];//最短距離

ll n, m, s ;//頂點數 邊數 起點

//vector<ll> path;//路徑

priority_queue<P, vector<P>, greater<P> > que;

void dijkstra () {

//fill (d, d + n + 1, INF); //fill (pre, pre + n + 1, -1);

memset(d,INF,sizeof(d));

d[s] = 0; que.push (P (0, s));

while (!que.empty()) {//核心

P p = que.top(); que.pop();

ll v = p.second;

if (d[v] < p.first) continue;

for (ll i = 0; i < G[v].size(); i++) {

edge e = G[v][i];

if (d[e.to] > d[v] + e.cost) {

d[e.to] = d[v] + e.cost;

que.push (P (d[e.to], e.to));

//pre[e.to]=v;

}

}

}

}

int main()

{

int t=1;

ll S,k,c;

memset(ma,INF,sizeof(ma));

scanf("%lld%lld%lld%lld%lld",&n,&m,&S,&k,&c);

for(ll i=0;i<k;i++)

{

scanf("%lld",&kl[i]);

}

ll x,y,z;

for(ll i=0;i<m;i++)

{

scanf("%lld%lld%lld",&x,&y,&z);

ma[x][y]=ma[y][x]=min(ma[x][y],z);

}

for(ll i=1;i<=n;i++)

{

G[i].clear();

}

for(ll i=1;i<=n;i++)

{

for(ll j=1;j<=n;j++)

{

if(ma[i][j]<=10010)

{

addedge(i,j,ma[i][j]);

//addedge(j,i,ma[i][j]);

}

}

}

s=S;

dijkstra();

ll ans1=-1,ans2=-1;//temp=0x3f3f3f3f;

for(ll i=1;i<=n;i++)

ans1=max(ans1,d[i]);

for(ll i=0;i<k;i++)

{

s=kl[i];

dijkstra();

for(int j=1;j<=n;j++)

if(s!=j)dis[s][j]=d[j];

}

ll temp=0x3f3f3f3f;

for(int j=1;j<=n;j++)

{

temp=0x3f3f3f3f;

for(int i=0;i<k;i++)

{

temp=min(temp,dis[kl[i]][j]);

}

ans2=max(ans2,temp);

}

if(m==0)

{

printf("0\n");

continue;

}

if(ans1<=c*ans2)printf("%lld\n",ans1);

else printf("%lld\n",ans2);

return 0;

}

21.base??

換個base64碼表,腳本如下:

s = "JKLMNOxyUVzABCDEFGH789PQIabcdefghijklmWXYZ0123456RSTnopqrstuvw+/="

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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM