PCTF个人题解

PCTF题解

misc流量分析还要加深学习,其他方向后面也会有时间就去接触了。

MISC

cancanneed

img

img

后面的就是电话

1z_gif

img

gif分解

img

img

U2FsdGVkX1/Jnjw7kjk86/l86VHMyAu3l4UtTWLT/NTnMII6rmLIsitb/RJr0rUt iw0mlEma4zdBD337n+RM+Q==

AES或者3DES加密

img

key

img

密文有个空格记得去掉

Cyber_Master

img

解码

img

base91

img

base32

img

base32

zmx已经出来了

img

base64

env_forensics

img

看到了hint.txt和flag.zip

img

可疑进程cmd.exe

img

cmdscan扫描

ez_vol

img

密码提取

img

还有一半在这里

w3nx1z1去哪儿

img

查坐标,在厦门,那应该是刚结束的美亚杯

img

万*朝宗

flag{美亚杯_白瓷观止美术馆}

PyChallenge

img

逃逸进目录

img

提示很明显

img

OvO的礼物

img

去做异或运算

# coding:utf-8
# @Author:Tummy

def xor_encrypt_decrypt(input_file, output_file, key):
    with open(input_file, 'rb') as f:
        data = bytearray(f.read())

    # 对数据进行抑或操作
    for i in range(len(data)):
        data[i] ^= key

    with open(output_file, 'wb') as f:
        f.write(data)

def main():
    input_file = r"E:\CTF脚本\0x23.txt"  # 输入文件名
    encrypted_file = 'E:\CTF脚本\encrypted'  # 加密后文件名
    decrypted_file = 'E:\CTF脚本\decrypted'  # 解密后文件名
    key = 0x23  # 可以自定义密钥,范围为0x00到0xFF,文件名提示0x23

    # 加密
    xor_encrypt_decrypt(input_file, encrypted_file, key)
    print(f'文件 {input_file} 已被加密并保存为 {encrypted_file}.')

    # 解密
    xor_encrypt_decrypt(encrypted_file, decrypted_file, key)
    print(f'文件 {encrypted_file} 已被解密并保存为 {decrypted_file}.')

if __name__ == "__main__":
    main()

得到文件

img

查看文件签名,为png

img

用stegsolve

img

WEB

Sign In

img

控制台在空页面打开,然后去看php页面

img

easyupload

img

先造一个这样的文件

img

上传文件,修改filename

img

REVERSE

文学ida与化学gdb

img

看不懂,但是打开就有

baby_python

img

脚本逆向

import base64

# 用户输入:脚本接受用户输入 ( a)
a = input()
b = []

# XOR 运算:它迭代输入中的每个字符,与 0x10(十进制的 16)执行 XOR 运算,并将结果附加到列表 ( b)
for i in a:
    b.append(chr(ord(i) ^ 0x10))
    
#它将列表中的异或字符连接起来以创建一个新字符串 ( b)
b = "".join(b)

# 使用 Base64 对异或字符串进行编码。
encoded_result = base64.b64encode(b.encode('utf-8'))
if bytes.decode(encoded_result) == "dnxxd2tAaWR4X35PIWNPYnVxISEpT3l+ZHVidWNkWX53IWkxMTFt":
    print("You are right!!!")
else:
    print("nonono, try again.")

源码分析

xor这次比赛考查的比较多

crypto

原神,启动!

img

原神字符,手动解码

在这里插入图片描述

baby_python
# -*- coding: utf-8 -*-
import gmpy2
import time


# 展开为连分数
def continuedFra(x, y):
    cF = []
    while y:
        cF += [x / y]
        x, y = y, x % y
    return cF


def Simplify(ctnf):
    numerator = 0
    denominator = 1
    for x in ctnf[::-1]:
        numerator, denominator = denominator, x * denominator + numerator
    return (numerator, denominator)


# 连分数化简
def calculateFrac(x, y):
    cF = continuedFra(x, y)
    cF = map(Simplify, (cF[0:i] for i in xrange(1, len(cF))))
    return cF


# 解韦达定理
def solve_pq(a, b, c):
    par = gmpy2.isqrt(b * b - 4 * a * c)
    return (-b + par) / (2 * a), (-b - par) / (2 * a)


def wienerAttack(e, n):
    for (d, k) in calculateFrac(e, n):
        if k == 0: continue
        if (e * d - 1) % k != 0: continue
        phi = (e * d - 1) / k
        p, q = solve_pq(1, n - phi + 1, n)
        if p * q == n:
            return abs(int(p)), abs(int(q))
    print
    'not find!'


time.clock()
n = 7014146481864932983614894110831332509103387549853658254259827375677922729485167647372390237238184995025425752119039146186010813040313425917316949832151617
e = 4778503335635619935190878916122172868154385882208731133793725852425155334251003752094703669146172170604574703611006806466807793696614573611672437476381499
c = 2027621276203969349393569990976149581012128863819625391920546398399170289247469537365399608065540439647873909575003230404104801456945714033977361448390603
print('e', e, 'n', n)

p, q = wienerAttack(e, n)
print '[+]Found!'
print '  [-]p =', p
print '  [-]q =', q
print '  [-]n =', p * q
d = gmpy2.invert(e, (p - 1) * (q - 1))
print '  [-]d =', d
print '  [-]m is:' + '{:x}'.format(pow(c, d, n)).decode('hex')
print '\n[!]Timer:', round(time.clock(), 2), 's'
print '[!]All Done!'

python2代码,已知n e c,计算

img

mobile

find_the_cat

img

主活动,取证思路

雑魚mobile

img
dexdump

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值