ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

DASCTF Sept X 浙江工业大学秋季挑战赛wp

2021-09-26 22:03:59  阅读:284  来源: 互联网

标签:www com wp flag html https B3 DASCTF Sept


DASCTF Sept X 浙江工业大学秋季挑战赛wp

Crypto

签到

题目([网鼎杯 2020 青龙组]原题)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Util.number import *
import random
flag=b'flag{******************}'
n = 2 ** 256
flaglong=bytes_to_long(flag)
m = random.randint(2, n-1) | 1
c = pow(m, flaglong, n)
print('m = ' + str(m))
print('c = ' + str(c))

# m = 73964803637492582853353338913523546944627084372081477892312545091623069227301
# c = 21572244511100216966799370397791432119463715616349800194229377843045443048821

其实乍一看你会发现他和RSA加密很像,最后的加密过程为c = pow(m, bytes_to_long(flag), n)

RSA加密就是明文为m,取公钥e和n,密文c=pow(m,e,n)

这边的一个明显区别为,可以理解为flag明文作为RSA加密里面的公钥e进行的求解。

这个在密码学里面是基于离散对数的一种加密,我们在求解明文的时候,也就相当于是求解基于同余运算和原根的一种对数运算。

求解这种问题的话我们用python的sympy模块的discrete_log函数进行求解就可以了。discrete_log(n,c,m)

解题脚本

import sympy
from Crypto.Util.number import *
n = 2 ** 256
m = 73964803637492582853353338913523546944627084372081477892312545091623069227301
c = 21572244511100216966799370397791432119463715616349800194229377843045443048821
flag=sympy.discrete_log(n,c,m)

print(long_to_bytes(flag))

Misc

Girlfriend’s account

题目

jackie的女朋友又偷偷用他的信用卡买东西了,你能算算一共花了多少钱吗?

image-20210925162931953

解题

excel的函数将人民币大写金额转换成数字,在用查找替换将件数转化成数字(不知道预期操作是啥,反正我这么做也得到flag了)

=SUM(ISNUMBER(SEARCH(TEXT({1,2,3,4,5,6,7,8,9},"[dbnum2]"&{"0亿";"0仟!*万";"0佰!*万";"0拾!*万";"0万";"万!*0仟";"万!*0佰";"万!*0拾";"0元";"0角";"0分"}),IF(ISERR(FIND("万",A2)),"万",)&A2))*{1,2,3,4,5,6,7,8,9}*10^{8;7;6;5;4;3;2;1;0;-1;-2})

=IF(B3=”壹”,1,IF(B3=”贰”,2,IF(B3=”叁”,3,IF(B3=”肆”,4,IF(B3=”伍”,5,IF(B3=”陆”,6,IF(B3=”柒”,7,IF(B3=”捌”,8,IF(B3=”玖”,9)))))))))  [赛后找到的公式]

python脚本(这里需要先把账单里面的件数手动转成阿拉伯数字,然后把文件另存为xls)

image-20210926215433408


import xlrd
def hantonum(str1):
    dict1 = {'壹': 1, '贰': 2, '叁': 3, '肆': 4, '伍': 5, '陆': 6, '柒': 7, '捌': 8, '玖': 9}
    dict2 = {'拾': 10, '佰': 100, '千': 1000, '万': 10000, '元': 1, '角': 0.1, '分': 0.01}
    result = 0
    for index,i in enumerate(str1):
        if index<len(str1)-1:
            if (i in dict1 and str1[index+1] in dict2) or (i in dict2 and str1[index+1]=='万'):
                if str1[index+1] !='万':
                    result += dict1[i] * dict2[str1[index+1]]
                elif i in dict2:
                    result *=10000
                else:
                    result += dict1[i]
                    result *= 10000
    return result
print(hantonum('壹佰壹拾玖元玖角玖分'))
workBook = xlrd.open_workbook('D:\\桌面\\1.xlsx')

sheet1_content1 = workBook.sheet_by_index(0) # sheet索引从0开始
# 4. 获取整行和整列的值(数组)
count = 0
for i in range(1,5001):
    rows = sheet1_content1.row_values(i)
    rows[0] = round(hantonum(rows[0]),2)
    count = count+(float(rows[0])*float(rows[1]))
print("flag{"+str(round(count,2))+"}")

如果Python读取xls文件报错:raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+‘; not supported‘)

只需要下载pyexcel-xls

pip install pyexcel-xls

image-20210926215616079

双目失明,身残志坚

题目

image-20210925163844110

解题

盲水印脚本:https://github.com/chishaxie/BlindWaterMark

相关文档:http://www.manongjc.com/detail/19-creiiewvkgwfziy.html

python3命令

python bwmforpy3.py decode original.png blind.png flag.png –oldseed

本来以为是 0、1 然后尝试二进制和摩斯 不对

后来了解到是盲文(题目提示的好啊,身残志坚,一开始没往那方面想 )

image-20210925164430844 image-20210925164501207

最后对照着翻译过来就浙江工业大学的汉语拼音了(其中giang 应该是jiang ie是ye 差点栽在汉语拼音手上)

盲文对照表:https://blog.csdn.net/weixin_30785593/article/details/96365878

PWN

萌新不会,看大佬的吧

https://www.cnblogs.com/LynneHuan/p/15335597.html

RE

萌新不会,看大佬的吧

三道re:
https://www.cnblogs.com/holittech/articles/15335668.html
https://www.cnblogs.com/holittech/articles/15335673.html
https://www.cnblogs.com/holittech/articles/15335676.html

大佬wp

http://www.snowywar.top/?p=2592

标签:www,com,wp,flag,html,https,B3,DASCTF,Sept
来源: https://blog.csdn.net/weixin_46198176/article/details/120498034

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有