首页 > 代码库 > 百度杯WriteUp
百度杯WriteUp
十月第一场
签到题 misc
纯属脑洞题,在i春秋公众号里输入 百度杯么么哒 就可以拿到flag
我要变成一只程序猿 misc
下载文件,看到里面txt是一段c语言写的代码
#include<stdio.h> #include<string.h> void main() { char str[100]=""; int i; int len; printf("input string:\n"); gets(str); len=strlen(str); printf("result:\n"); for(i=0;i<len+1;i++) { putchar(str[len-i]); } printf("\n"); }
不难是倒序输出,flag为ba1f2511fc30423bdb的倒序
那些年我追过的贝丝
看题目和字符串最后的=号判断是base64,python脚本如下
#!/usr/bin/env python import base64 s = ‘ZmxhZ3tpY3FlZHVfZ29nb2dvX2Jhc2U2NH0=‘ print base64.b64decode(s)
flag{icqedu_gogogo_base64}
十月第二场
传说中的签到题 misc
自古签到多脑洞,扫二维码看到“就算你发现我但是知道flag是什么??” 所以flag就是 什么
challenge misc
666c61677b686578327374725f6368616c6c656e67657d
观察一下这一串字符串,由数字和字母组合,字母小于f(推测出很可能是16进制),数字小于8而且两位一组的看前面一位不是6就是7(推测出是ascii码),从而推测出是16进制转ascii,python脚本如下
#!/usr/bin/env python import binascii as ba b = ‘666c61677b686578327374725f6368616c6c656e67657d‘ a = ba.a2b_hex(b) print a
flag{hex2str_challenge}
剧情大反转 misc
}~144_0t_em0c14w{galf 一眼就看出来是把字符顺序反转,python脚本如下
#!/usr/bin/env python str = ‘}~144_0t_em0c14w{galf‘ print str[::-1]
flag{w41c0me_t0_441~}
十月第三周
表姐家的签到题 misc
居然没套路直接给答案,加个格式就行flag{123456abcdef}
try again misc
下载文件后扔进linux里用strings 命令打印出可打印字符再用grep命令结合管道过滤出含flag字段的 命令为:
strings babyre | grep flag
flag{re_start_007}
听说是RC4算法 misc
题目说明了是RC4算法,给出了key值为welcometoicqedu 密文为UUyFTj8PCzF6geFn6xgBOYSvVTrbpNU4OF9db9wMcPD1yDbaJw== 百度个python脚本修改一下
import random, base64 from hashlib import sha1 def crypt(data, key): x = 0 box = range(256) for i in range(256): x = (x + box[i] + ord(key[i % len(key)])) % 256 box[i], box[x] = box[x], box[i] x = y = 0 out = [] for char in data: x = (x + 1) % 256 y = (y + box[x]) % 256 box[x], box[y] = box[y], box[x] out.append(chr(ord(char) ^ box[(box[x] + box[y]) % 256])) return ‘‘.join(out) def tdecode(data, key, decode=base64.b64decode, salt_length=16): if decode: data = http://www.mamicode.com/decode(data)>
flag{rc4_l_keepgoing}
十月第四场
泄露的数据 misc
看题目第一反应就是MD5,数了一下密文长度32位基本确认,扔 http://www.dmd5.com/md5-decrypter.jsp 上秒出明文12345678,加上格式即可
考眼力 misc
从格式上就不难看出是凯撒密码,python脚本如下
# Caesar Cipher
MAX_KEY_SIZE = 26
def getMode():
while True:
print(‘Do you wish to encrypt or decrypt a message?‘)
mode = raw_input().lower()
if mode in ‘encrypt e decrypt d‘.split():
return mode
else:
print(‘Enter either "encrypt" or "e" or "decrypt" or "d".‘)
def getMessage():
print(‘Enter your message:‘)
return raw_input()
def getKey():
key = 0
while True:
print(‘Enter the key number (1-%s)‘ % (MAX_KEY_SIZE))
key = int(input())
if (key >= 1 and key <= MAX_KEY_SIZE):
return key
def getTranslatedMessage(mode, message, key):
if mode[0] == ‘d‘:
key = -key
translated = ‘‘
for symbol in message:
if symbol.isalpha():
num = ord(symbol)
num += key
if symbol.isupper():
if num > ord(‘Z‘):
num -= 26
elif num < ord(‘A‘):
num += 26
elif symbol.islower():
if num > ord(‘z‘):
num -= 26
elif num < ord(‘a‘):
num += 26
translated += chr(num)
else:
translated += symbol
return translated
mode = getMode()
message = getMessage()
if mode[0] != ‘d‘:
key = getKey()
print(‘Your translated text is:‘)
if mode[0] != ‘d‘:
print(getTranslatedMessage(mode, message, key))
else:
for key in range(1,MAX_KEY_SIZE + 1):
print(key,getTranslatedMessage(‘decrypt‘,message,key))
print(‘Your translated text is:‘)
print(getTranslatedMessage(mode, message, key))
跑出来一堆结果,但第一个就是flag flag{4c850c5b3b2756e67a91bad8e046ddac}
flag格式 misc
不知道考点是啥,直接复制就好了,flag{0ahief9124jfjir}
百度杯WriteUp