2023“强网杯”部分WP

发布时间 2023-12-26 20:41:35作者: 清纯少女小琪

强网先锋

SpeedUp

题目

我的解答:

分析代码可知是求2的27次方的阶乘的每一位的和。

使用在线网址直接查看:https://oeis.org/A244060/list

然后sha256加密

flag{bbdee5c548fddfc76617c562952a3a3b03d423985c095521a8661d248fad3797}

MISC

谍影重重2.0

题目

我的解答:

根据题目信息飞机流量很容易想到ADS-B协议

我们导出TCP流数据

tshark -r attach.pcapng -Y "tcp" -T fields -e tcp.segment_data > tcp.txt

解析一下数据

import pyModeS

with open('tcp.txt','r')as f:
    lines = f.readlines()
for data in lines:
    if len(data)==47:
        print(pyModeS.decoder.tell(data[18:]))

然后发现79a05e的飞机速度最快为371 knots,然后md5 ICAO address即为flag

flag{4cf6729b9bc05686a79c1620b0b1967b}

CRYPTO

not_only_rsa

题目

from Crypto.Util.number import bytes_to_long
from secret import flag
import os

n = 6249734963373034215610144758924910630356277447014258270888329547267471837899275103421406467763122499270790512099702898939814547982931674247240623063334781529511973585977522269522704997379194673181703247780179146749499072297334876619475914747479522310651303344623434565831770309615574478274456549054332451773452773119453059618433160299319070430295124113199473337940505806777950838270849
e = 641747
m = bytes_to_long(flag)

flag = flag + os.urandom(n.bit_length() // 8 - len(flag) - 1)
m = bytes_to_long(flag)

c = pow(m, e, n)

with open('out.txt', 'w') as f:
    print(f"{n = }", file=f)
    print(f"{e = }", file=f)
    print(f"{c = }", file=f)
n = 6249734963373034215610144758924910630356277447014258270888329547267471837899275103421406467763122499270790512099702898939814547982931674247240623063334781529511973585977522269522704997379194673181703247780179146749499072297334876619475914747479522310651303344623434565831770309615574478274456549054332451773452773119453059618433160299319070430295124113199473337940505806777950838270849
e = 641747
c = 730024611795626517480532940587152891926416120514706825368440230330259913837764632826884065065554839415540061752397144140563698277864414584568812699048873820551131185796851863064509294123861487954267708318027370912496252338232193619491860340395824180108335802813022066531232025997349683725357024257420090981323217296019482516072036780365510855555146547481407283231721904830868033930943

我的解答:

n分解得到p,但发现gcd(e,phi)=e因此我们可以用sagemath自带的nth_root()

#sage
from Crypto.Util.number import *

p = 91027438112295439314606669837102361953591324472804851543344131406676387779969
n = 6249734963373034215610144758924910630356277447014258270888329547267471837899275103421406467763122499270790512099702898939814547982931674247240623063334781529511973585977522269522704997379194673181703247780179146749499072297334876619475914747479522310651303344623434565831770309615574478274456549054332451773452773119453059618433160299319070430295124113199473337940505806777950838270849
e = 641747
c = 730024611795626517480532940587152891926416120514706825368440230330259913837764632826884065065554839415540061752397144140563698277864414584568812699048873820551131185796851863064509294123861487954267708318027370912496252338232193619491860340395824180108335802813022066531232025997349683725357024257420090981323217296019482516072036780365510855555146547481407283231721904830868033930943

res = Zmod(n)(c).nth_root(e, all=True)
# print(res)

for m in res:
    flag = long_to_bytes(int(m))
    if b"flag" in flag:
        print(flag)
        break
#flag{c19c3ec0-d489-4bbb-83fc-bc0419a6822a}