from sympy import factorint from Crypto.Util.number import inverse
# 给定参数 e = 65537 n = 7349515423675898192891607474991784569723846586810596813062667159281369435049497248016288479718926482987176535358013000103964873016387433732111229186113030853959182765814488023742823409594668552670824635376457830121144679902605863066189568406517231831010468189513762519884223049871926129263923438273811831862385651970651114186155355541279883465278218024789539073180081039429284499039378226284356716583185727984517316172565250133829358312221440508031140028515954553016396884149904097959425582366305748700291610280675014390376786701270107136492645593662763444032174543205008326706371954830419775515459878227148997362533 c = 3514741378432598036735573845050830323348005144476193092687936757918568216312321624978086999079287619464038817665467748860146219342413630364856274551175367026504110956407511224659095481178589587424024682256076598582558926372354316897644421756280217349588811321954271963531507455604340199167652015645135632177429144241732132275792156772401511326430069756948298403519842679923368990952555264034164975975945747016304948179325381238465171723427043140473565038827474908821764094888942553863124323750256556241722284055414264534546088842593349401380142164927188943519698141315554347020239856047842258840826831077835604327616
from Crypto.Util.number import inverse, long_to_bytes
n = 15124759435262214519214613181859115868729356369274819299240157375966724674496904855757710168853212365134058977781083245051947523020090726851248565503324715984500225724227315777864292625995636236219359256979887906731659848125792269869019299002807101443623257106289957747665586226912446158316961637444556237354422346621287535139897525295200592525427472329815100310702255593134984040293233780616515067333512830391860868933632383433431739823740865023004008736555299772442805617275890761325372253913686933294732259451820332316315205537055439515569011020072762809613676347686279082728000419370190242778504490370698336750029 e = 65537 dp = 1489209342944820124277807386023133257342259912189247976569642906341314682381245025918040456151960704964362424182449567071683886673550031774367531511627163525245627333820636131483140111126703748875380337657189727259902108519674360217456431712478937900720899137512461928967490562092139439552174099755422092113 c = 4689152436960029165116898717604398652474344043493441445967744982389466335259787751381227392896954851765729985316050465252764336561481633355946302884245320441956409091576747510870991924820104833541438795794034004988760446988557417649875106251230110075290880741654335743932601800868983384563972124570013568709773861592975182534005364811768321753047156781579887144279837859232399305581891089040687565462656879173423137388006332763262703723086583056877677285692440970845974310740659178040501642559021104100335838038633269766591727907750043159766170187942739834524072423767132738563238283795671395912593557918090529376173
# 计算e*dp -1 edp_1 = e * dp - 1
# 遍历可能的k值寻找p found = False for k inrange(1, e + 1): if edp_1 % k == 0: x = edp_1 // k p_candidate = x + 1 if n % p_candidate == 0: p = p_candidate found = True break
ifnot found: raise ValueError("Failed to factor n with given dp")
q = n // p phi = (p - 1) * (q - 1) d = inverse(e, phi) m = pow(c, d, n)
# 提示:需要推导如何从能量轨迹恢复为明文 flag defbits_to_text(bits): chars = [bits[i:i+8] for i inrange(0, len(bits), 8)] text = ''.join([chr(int(char, 2)) for char in chars]) return text
I thought of these words again from "One Hundred Years of Solitude." Lonelyness is a curse of creation to the group, and solitude is the only outlet for loneliness.Perhaps it was at this point that I finally understood Colonel Buendía and José Arcadio.Our hometown becomes a place we love not because it is our hometown, but because we believe it to be our hometown. Home is used as a place to rest a drifting soul, and that is why it smells of decay and death, like withered leaves and deserted yellow soil. To return home is to break the concept of "me" back into "us," to be integrated into such a huge whole that slowly becomes invisible, Macondo, the City of Mirrors.“On a winter night, the soup pot was boiling on the stove, but he missed the sweltering heat in the back hall of the bookstore. The hum of the sun's rays on the dusty almond trees, the faint sirens of the midday meal, as he had in Macondo yearned for the soup on the stove in winter, the call of the coffee-peddler, and the swift flight of the larks in spring. VTFWI{brx_duh_zlq!}"Rizhao," he said, turning to Macondo. The two types of nostalgia were like mirrors opposite, and he was stuck in between, confused, unable to maintain a sublime transcendence.”
中间的VTFWI{brx_duh_zlq!}不用多说,凯撒密码
SQCTF{you_are_win!}
你的天赋是什么
SQCTF{YOU-HAVE-TALENT}
Common Modulus
from libnum import n2s
# 扩展欧几里得算法,用于计算 gcd 和系数 x, y defextended_gcd(a, b): if a == 0: return b, 0, 1 else: gcd, x, y = extended_gcd(b % a, a) return gcd, y - (b // a) * x, x
import os import cv2 import struct import numpy as np
# Create directories for extracted and reconstructed frames os.makedirs('m_frame', exist_ok=True) os.makedirs('p_frame', exist_ok=True) os.makedirs('reconstructed', exist_ok=True)
# Extract frames from the magnitude and phase videos os.system('ffmpeg -i 1.mkv m_frame/%03d.png') os.system('ffmpeg -i 2.mkv p_frame/%03d.png')
# Get the list of frame files (assuming they are named sequentially, e.g., 001.png) files = sorted(os.listdir('m_frame'))
# Open the 'r' file containing min and max values for magnitude withopen('r', 'rb') as r_file: for file in files: # Read the min and max values for the magnitude (m) of the current frame data = r_file.read(8) # Two floats, 4 bytes each m_min, m_max = struct.unpack('!ff', data)
# Read the magnitude image (mapped m) from 1.mkv m_img = cv2.imread(f'm_frame/{file}', cv2.IMREAD_GRAYSCALE) # Reverse the mapping to recover the original m # Original mapping: new_data = (m - m_min) * 255 / (m_max - m_min) # Reverse: m = (m_img / 255) * (m_max - m_min) + m_min m = m_img / 255.0 * (m_max - m_min) + m_min
# Read the phase image (mapped p) from 2.mkv p_img = cv2.imread(f'p_frame/{file}', cv2.IMREAD_GRAYSCALE) # Reverse the mapping to recover the original p # Since p = np.angle(fft), it ranges from [-π, π] # Original mapping uses actual min and max, but only m's min/max are saved # Assume p ranges from -π to π: new_data = (p - (-π)) * 255 / (π - (-π)) # Reverse: p = (p_img / 255) * 2π - π p = p_img / 255.0 * (2 * np.pi) - np.pi
# Reconstruct the FFT magnitude from m # Original: m = np.log(np.abs(fft)), so np.abs(fft) = exp(m) mag = np.exp(m)
# The phase p is directly the angle # Reconstruct the FFT: fft = magnitude * exp(1j * phase) fft = mag * np.exp(1j * p)
# Reverse the fftshift applied in the original script fft = np.fft.ifftshift(fft)
# Apply the inverse FFT to recover the image img = np.fft.ifft2(fft)
# Take the real part (original image is real-valued) and clip to [0, 255] img = np.clip(np.real(img), 0, 255).astype(np.uint8)
# Save the reconstructed frame cv2.imwrite(f'reconstructed/{file}', img)
# Combine the reconstructed frames into a video os.system('ffmpeg -i reconstructed/%03d.png -r 25 -vcodec libx264 reconstructed.mp4')
SQCTF{HELLO}
小巷人家
SQCTF{西园寺}
问卷
SQCTF{this_is_real_end}
PWN
浅红欺醉粉,肯信有江梅
nc连接直接ls``cat
领取你的小猫娘
简单栈溢出
exp
from pwn import* context(arch='amd64',os='linux',log_level='debug') io=process('./pwn') io=remote('challenge.qsnctf.com',30010) elf=ELF('./pwn')