tìm flag
創建於:2026年10月24日
使用 GPT-5.6 Thinking 回答 Chat01
創建於:2026年10月24日
使用 GPT-5.6 Thinking 回答 Chat01
tìm flag
Mình sẽ bám đúng vào file audio và hint trong mô tả. Câu “foundation was kinda off” + “CRUX first” gợi ý mạnh rằng flag được giấu ở phần nền/tần số thấp hoặc cần đảo/chuẩn hóa một lớp tín hiệu trước.
pythonimport soundfile as sf, numpy as np, os, json, math, statistics path="/mnt/data/transmission.wav" y, sr = sf.read(path, always_2d=True) y.shape, sr, y.dtype, float(y.min()), float(y.max()), os.path.getsize(path) ((352584, 2), 44100, dtype('float64'), -0.70123291015625, 0.70947265625, 1410380)
pythonimport wave, struct, numpy as np, soundfile as sf, os, binascii, collections, math with wave.open(path,'rb') as w: params=w.getparams() params _wave_params(nchannels=2, sampwidth=2, framerate=44100, nframes=352584, comptype='NONE', compname='not compressed')
pythonyi = np.rint(y*32768).astype(np.int16) L = yi[:,0].astype(np.int32) R = yi[:,1].astype(np.int32) stats = { "dur": len(L)/sr, "rms_L": float(np.sqrt(np.mean(L.astype(np.float64)**2))), "rms_R": float(np.sqrt(np.mean(R.astype(np.float64)**2))), "corr": float(np.corrcoef(L,R)[0,1]), "rms_sum": float(np.sqrt(np.mean(((L+R)/2)**2))), "rms_diff": float(np.sqrt(np.mean(((L-R)/2)**2))), "max_abs_diff": int(np.max(np.abs(L-R))), } stats {'dur': 7.9951020408163265, 'rms_L': 6515.912097693022, 'rms_R': 6515.657651018003, 'corr': 0.9947961468556917, 'rms_sum': 6507.302629803426, 'rms_diff': 332.36279758612915, 'max_abs_diff': 7000}
pythonfrom IPython.display import Audio, display diff = (L-R).astype(np.float64) diff_norm = diff / (np.max(np.abs(diff)) + 1e-12) display(Audio(diff_norm, rate=sr))
pythonfrom scipy import signal mono = (L+R)/2.0 d = (L-R)/2.0 for name, sig in [("mono", mono), ("diff", d)]: f, t, S = signal.spectrogram(sig, fs=sr, nperseg=4096, noverlap=3072, scaling='spectrum', mode='magnitude') avg = S.mean(axis=1) inds = np.argsort(avg)[-20:][::-1] print(name, list(zip(np.round(f[inds],1), np.round(avg[inds],2)))[:15])
pythonimport matplotlib.pyplot as plt, numpy as np f, t, S = signal.spectrogram(d, fs=sr, nperseg=2048, noverlap=1792, scaling='spectrum', mode='magnitude') plt.figure(figsize=(12,6)) plt.pcolormesh(t, f, 20*np.log10(S+1e-6), shading='auto') plt.ylim(0, 12000) plt.xlabel('s'); plt.ylabel('Hz'); plt.colorbar(label='dB') plt.tight_layout() plt.show()
Mình đã tách hai kênh stereo: chúng gần như giống nhau, nhưng phần L−R lộ ra một tín hiệu có cấu trúc rất rõ — đây có vẻ là lớp giấu flag chứ không phải nhạc nền. Mình đang giải lớp này theo thời gian/tần số.
pythonfrom scipy.signal import stft f,t,Z = stft(d, fs=sr, window='hann', nperseg=2048, noverlap=1792, boundary=None) mask=(f>=2500)&(f<=8000) mag=np.abs(Z[mask]) freqs=f[mask] maxidx=np.argmax(mag,axis=0) dom=freqs[maxidx] amp=mag[maxidx, np.arange(mag.shape[1])] # Print every ~0.1s rounded for ti,fi,ai in zip(t[::17],dom[::17],amp[::17]): print(f"{ti:4.2f} {fi:7.1f} {ai:8.1f}")
python# create thresholded spectrogram plot with frequency 2500-7600 f,t,Z = signal.stft(d, fs=sr, window='hann', nperseg=1024, noverlap=960, boundary=None) mag=20*np.log10(np.abs(Z)+1e-3) sel=(f>=2500)&(f<=7600) fig, ax=plt.subplots(figsize=(16,5)) ax.imshow(mag[sel], origin='lower', aspect='auto', extent=[t[0],t[-1],f[sel][0],f[sel][-1]], cmap='gray_r', vmin=15, vmax=45) ax.set_xlim(0.2,8); ax.set_ylim(2500,7600) ax.set_xticks(np.arange(0,8.1,0.25)); ax.grid(axis='x', alpha=.2) plt.tight_layout(); plt.show()
python# derive dominant freq and magnitude from STFT as before, classify active f,t,Z=signal.stft(d, fs=sr, nperseg=2048, noverlap=1792, boundary=None) sel=(f>=2500)&(f<=8000) mm=np.abs(Z[sel]); ff=f[sel] idx=np.argmax(mm,axis=0) dom=ff[idx]; a=mm[idx,np.arange(len(t))] active=a>20 # cluster dominant frequencies for active frames vals=dom[active] # histogram by 50 Hz bins bins=np.arange(2500,8050,50) hist,edges=np.histogram(vals,bins=bins) tops=np.argsort(hist)[-15:][::-1] [(round((edges[i]+edges[i+1])/2,1), int(hist[i])) for i in tops[:12]] [(np.float64(7275.0), 308), (np.float64(2925.0), 271), (np.float64(3075.0), 78), (np.float64(7125.0), 59), (np.float64(5025.0), 33), (np.float64(3225.0), 19), (np.float64(5325.0), 16), (np.float64(3675.0), 13), (np.float64(3375.0), 13), (np.float64(5175.0), 13), (np.float64(4425.0), 12), (np.float64(3975.0), 12)]
pythonfrom scipy.signal import butter, sosfiltfilt, hilbert sos=butter(6,[2500,8000],btype='bandpass',fs=sr,output='sos') db=sosfiltfilt(sos,d) analytic=hilbert(db) phase=np.unwrap(np.angle(analytic)) inst=np.diff(phase)*sr/(2*np.pi) amp_h=np.abs(analytic[:-1]) # downsample median per 5ms step=int(0.005*sr) rows=[] for i in range(0,len(inst),step): m=slice(i,min(i+step,len(inst))) rows.append((i/sr, float(np.median(amp_h[m])), float(np.median(inst[m])))) rows[:10], rows[-1] ([(0.0, 1.690410654254588e-13, 6789.868418033524), (0.004988662131519274, 1.757685453456617e-13, 5495.254828280307), (0.009977324263038548, 2.029571354634799e-13, 7129.345682567378), (0.014965986394557823, 1.8558680696026445e-13, 7025.55077163834), (0.019954648526077097, 1.7350118477406168e-13, 5750.4860010969605), (0.024943310657596373, 1.881237357850078e-13, 5994.085357334133), (0.029931972789115645, 1.8489942885407022e-13, 6846.235777594517), (0.03492063492063492, 1.775120359802135e-13, 6792.5006261049575), (0.039909297052154194, 1.6881325718206824e-13, 6980.182314772743), (0.044897959183673466, 1.6043239462051184e-13, 6339.063707475738)], (7.9918367346938775, 1.6847445050443864e-13, 6659.097397957499))
pythonfloat(np.max(np.abs(d))), float(np.std(d)), d[:5] (3500.0, 332.3627975328893, array([0., 0., 0., 0., 0.]))
pythonnp.max(np.abs(db)), db[15000:15010] (np.float64(3479.908432300927), array([ 14.33616414, 257.15519396, 368.08727588, 282.49504633, 53.43208573, -182.82196135, -295.05752577, -239.12655958, -78.15184964, 70.54076321]))
python# print around active period for r in rows[50:190:10]: print(r)
pythonf,t,Z = signal.stft(d, fs=sr, window='hann', nperseg=1024, noverlap=1000, boundary=None) mag=20*np.log10(np.abs(Z)+1e-3) sel=(f>=2500)&(f<=7800) plt.figure(figsize=(14,6)) plt.imshow(mag[sel], origin='lower', aspect='auto', extent=[t[0],t[-1],f[sel][0],f[sel][-1]], cmap='gray_r', vmin=15, vmax=45) plt.xlim(.2,1.4); plt.ylim(2500,7800) plt.xticks(np.arange(.2,1.41,.05)); plt.grid(axis='x',alpha=.2) plt.show()
python# Display full message with frequency axis inverted f,t,Z = signal.stft(d, fs=sr, window='hann', nperseg=1024, noverlap=1000, boundary=None) mag=20*np.log10(np.abs(Z)+1e-3) sel=(f>=2500)&(f<=7800) plt.figure(figsize=(18,5)) plt.imshow(mag[sel], origin='upper', aspect='auto', extent=[t[0],t[-1],f[sel][0],f[sel][-1]], cmap='gray_r', vmin=15, vmax=45) # origin upper with extent might axes weird; easier invert y plt.gca().invert_yaxis() plt.xlim(.2,8); plt.xticks(np.arange(.25,8,.25)); plt.grid(axis='x',alpha=.15) plt.show()
python# inspect printable strings in raw wav and bitplanes for hidden ascii raw=open(path,'rb').read() import re strings=[m.group().decode('ascii','ignore') for m in re.finditer(rb'[\x20-\x7e]{5,}', raw)] strings[:20], len(strings) (['RIFFD', 'WAVEfmt ', 'data ', 'q5q5P', 'C&C&)', 'H-H-k', 'O"O")', '2*2*&1&1', 'E,E,y', '/P9P9', '5#5#*', '2#2#Y', '\\1\\16', 'Z)Z)R', '*F$F$E', 'l l G', 'L(L(W', ' @6@6O', 'p"p"z', 'h&h&['], 3191)
pythonu = yi.view(np.uint16) # shape same values bits streams={} for ch,name in [(0,'L'),(1,'R')]: for b in range(8): streams[f'{name}b{b}']=((u[:,ch]>>b)&1).astype(np.uint8) # interleaved sample order LRLR flat=u.reshape(-1) for b in range(8): streams[f'Ib{b}']=((flat>>b)&1).astype(np.uint8) def pack(bits, msb=True, offset=0): bits=bits[offset:] n=(len(bits)//8)*8 arr=bits[:n].reshape(-1,8) if msb: vals=(arr*(1<<np.arange(7,-1,-1))).sum(axis=1) else: vals=(arr*(1<<np.arange(8))).sum(axis=1) return vals.astype(np.uint8).tobytes() hits=[] for k,bits in streams.items(): for off in range(8): for msb in [True,False]: bb=pack(bits,msb,off) low=bb.lower() for needle in [b'cru',b'flag',b'cipher',b'{']: j=low.find(needle) if j!=-1: hits.append((k,off,msb,needle,j,bb[max(0,j-20):j+100])) hits[:20], len(hits) ([('Lb0', 0, True, b'{', 228, b'\x19D\xc1\x99,\x00\xfeZp\x15\xc6}\x1a\x0f`\x14\x1az\x94\xb1{\x88\xda\x9a\xa3\x14UM\xeb\x90\xb0\xe1\x8c\xc7\xeeNs\xb2\xe1~\xa6o\x8d2$\xdae@\xe8\x95\x1f\x95\xffL\xc9\x84\x1e\xdd\xb0%\xbc\xd3\x9f\xd0z\xd4`\x061\x10\xffT\x8co]\x02\x1c\x9d\xde\x99\xbc\xd4\xa9\xfd\\7\xbf\\K\xb8\x1f\xf8\xed\x11x\xd4\xea<\xffs\x9b}Y\xd4P\x14=GQ\x96\t\x05\xc9i[\x14\xc5\xb6.\x89'), ('Lb0', 0, False, b'{', 96, b'\x03\xda\xc9\xb1\xc0.\xf2T&\xaeW\x1e\xcc\x88d-\x9a\xfay\x9a{\xb77\xc0&\xd7j\x84\x8dt\x83\xed\xdb\x89\xdb\x15!0\x19\x0f.\x86\xc9\xa9\x9bI\xb36&\xc8\x94\xc2\xfak\xd9\xf5\xcf\x8al\x90\r\xbd#\xf3\xee\xa0\x87~$\xee\xc7\x06\xc0\x84. \x85\xe5\x93\xc2\xefr\xc0dZ:\xfaKz\x06\xd1\xc19\xb9E\xc9\x86@h\t\xf4\xb1\xa7\x05\xbf;&\xbd\x02mU\xe0`\xdb\x92\xf6\x1dN@\xa0'), ('Lb0', 1, True, b'{', 137, b"\xc3'+\xb3%\x9a\xd8\xc8&R\x86\xbf\xad7_\xe6\xa2l\x13a{\x89\x9e\xee\x0b\xc2\xfcH\xef\xc6\xc0\x06B\xe8\tCO\x92\x87\xee\x9c\x06L\xb4\xb8\xbf\xa4\xbc\xc1\x17\x079;E&\xc2\x04- _\x1b\xcbA\xfb\xb8\xc9z\x81mT\x0e\r\xb6\x92\xdfp\xe4\x04\x0b\x1b\xf2\x01e\xb7\x15w\xb7\x88#\xe9\x142\x89\x832X\x01\xfc\xb4\xe0+\x8c\xfa4\x1e\xc0(4\xf5)b\xf7\x11\xb55F(\xaa\x9b\xd7"), ('Lb0', 1, False, b'{', 281, b'\x99\xc9\x10\xbc\xdd\x06\xd2\x9e\xe5\xfc\x05\xaf\x15\x030F\x84\x7f\x95\x18{] \x9c\xdc\xbd\xcc\x9e\x95\xca_\x1d\xf6~\x1d\xe9\x0e\xfc\x8f[D\x8f\x95+\x9e\x7f\xe7l_\xcd\x15\x05\x14^q\xc54H\xd0IKm\x94\xd16\xba\xc8\x0e,\x16\x05%\xb3u\xa0\x18\xa5\x1e\x92\x88\x0cZ\xb0\xbd\xb9\xe1\xa4J\x9e\xdb7\xb5\xd6\x8a`\x0e\xfc\x8b\xed\xa3?\x88\xe6\xfc\xf0\x0e\xdc\xbb\xbb\xf7M!=zMo\rg\xb8\x93'), ('Lb0', 2, True, b'{', 96, b'\x01nN4\r\xd1<\xa9\x91\xd7\xa9\xe0\xccD\x9a\xd1e~yg{\xb7\xb0\r\x93\xadX\x86\xc4\xbb\x06\xdfnGn\xa2\x102c\xc1\xd1\x86NWfK5\xb1\x90L\xa5\r\x7fZn\xbf\xcdD\xd8&\xc2\xf7\x13=\xdc\x17\x85\xf8\x91\xdf\x8d\x80\x0c\x85\xd0\x12\x86\x9f%\x0f\xdd8\x0c\x99iq\x7fIy\x82.\x0erv\x8aM\x84\x08Z@\xbe7\x96\x83\xf7q\x92\xf5\x02\xda\xa8\x1c\x1bm%\xbe\xe1\xc8\x08\x16'), ('Lb0', 2, False, b'{', 293, b'\x8a\x01\x18#\xc2\xbfJ\x8c\xbd.\x10N\xee^f\xcfJ\xe5\xaf\x0e{\xbf\x8et\x07\xfe\xc7-\xa2\xc7\xca\x15\xcf\xbfs\xb6\xaf\xe6\x8a\x02\n\xaf\xb8b\x1a$\xe8\xa4\xa56\xcah\x1b]d\x07\x16\x8b\x82\x92\xd9:P\x8cR\x0fID\x06-\xd8\xde\xdcpR%\xcf\xed\x9bZkE0\x07\xfe\xc5\xf6\xd1\x1fDs~x\x07\xee\xdd\xdd\xfb\xa6\x90\x1e\xbd\xa6\xb7\x863\xdcI\xe1\x9d~\xf2\xc9O4\x15%\x04)\x01'), ('Lb0', 3, True, b'{', 139, b'\xae\xcc\x96kc \x99J\x1a\xfe\xb4\xdd\x7f\x9a\x89\xb0M\x85\xee&{\xb8/\x0b\xf1#\xbf\x1b\x00\x19\x0b\xa0%\r>J\x1f\xbap\x192\xd2\xe2\xfe\x92\xf3\x04\\\x1c\xe4\xed\x14\x9b\x08\x10\xb4\x81|o-\x07\xee\xe3%\xea\x05\xb5P86\xdaK}\xc3\x90\x10,o\xc8\x05\x96\xdcU\xde\xde \x8f\xa4P\xca&\x0c\xc9`\x07\xf2\xd3\x80\xae3\xe8\xd0{\x00\xa0\xd3\xd4\xa5\x8b\xdcF\xd4\xd5\x18\xa2\xaao\\\x85\x87'), ('Lb0', 3, False, b'{', 202, b'\xa4W\xa0\xad\n\x1cl[\xd2\xbe\xc3\t\x084\xf6\x13\xa0i;\xaa{{\x04\xf1%\nSd0\x93\x06\xe0O\xcb\x01u\xcc\x17\x0b\xde\x00\x05\xcb+\xa5\xd1;b+\xab\x18EU\xf6:\xa1\xe10f\xfcN\xce\xb9\xe9\xd0\xaf\xcc>\x96\x89d\xcbT\xe0"\x15?\xf5_f2\x04o\xb7\x81\xb4g9\x7f\xc1k\xc5\x00\x8c\x11\xe1_%\xc6^\x17\x08\'w/\xb3g\xa5\xf2W\x87\xbd_G\xba\x03\xff\xe3\x16\xd1'), ('Lb0', 4, True, b'{', 293, b'F\x00c\x11\x0f\xf5H\xc6\xf5\xd0!\xc9\xdd\xe9\x9b\xcdJ\x9f\xd5\xc3{\xf5\xc4\xbb\x81\xff\x8e\xd1\x17\x8dN\xa3\xcf\xf79\xb7\xd5\x9dE\x01C\xd4u\x19`\x90\\\x96\x95\xb1L[b\xe8\x9b\x81\xa3E\x05&mp(\xc5+\xc2H\x89\x82\xd0m\xec\xec9*\x93\xce\xdfekZ\x883\x81\xfe\x8d\xbe/\xe0\x8b9\xf8{\x81\xde\xee\xef}\x94%\xe2\xf5\x97\xb5\x870\xeeJ\x1e\xe5\xf9>O\xc8\xb2\xa2\x90\x82R\x03'), ('Lb0', 4, False, b'{', 97, b'\x9d\x1c\x0b\xec"Oe\xe2z\xe5\xc1\x8cH\xd6\xa2\xa9\x9f\xa7\xb9w{\x03lr\xadF\xd8H7\xd8\xbe\x9d\xb8]\x11\x02\x93\xf1\xe0b\x98\x9c\xba\x994kc\x82L)\xac\xbf\x96]\xff\xac\xc8\x06\xd9\xd0;2\xef\x0ez\xe8G\xe2~l\x00L\xe8\x02RX>)\xfc.\x07L\xa6\xa5\xa3\xbf\xa4g\x10\x1d\x9c\x93[\x94l\x08\x84\x96@\x1f{Z\xf0\xbbc\xd2+\xd0V\x05\x0e\xb6-i\xdf\xe1\x04\x04\x1a\xfb'), ('Lb0', 5, True, b'{', 202, b'\x97\xa8\x16\xd5@\xe0\xdbi-\xf7\x0e@@\xb1\xbf \x16[qW{x\x82>\x91C(\x983%\x80\x1f\xcbN\x02\xb8\xcf\xa3A\xec\x02\x83OR\x96/q\x1bSTb\x8a\xa9\xbdr\x16\x1c1\x98\xfd\xc9\xcev\\/\xd4\xcd\xf1\xa6D\x9bL\xa8\x1d\x12\xa3\xf2\xbf\xe9\x990\x83\xdb\xb6\x04\xb7\x9as\xfa\x0fZ\x8c\x00\xc6"\x1f\xea\x91\x8d\xeb\xa0C\x93\xbb\xd37\x9a\x95?\xab\x86\xf7\xeb\x89w\x03\xff\x1d\xa2/'), ('Lb0', 5, False, b'{', 369, b'\xb9}Sk\xad\x08\xe6\xc0\xbf\xd8>\xfa\x83h\xce\x0f\xef\xc0\xbd\xbb{\xdf\x14\xd2\xa3\xd7\xf4\xd6p\x86;)\xbc\xd3O>\xf9\x89\xa6\xa2\x84 %`O\x1a9,a\x96}\x18\xc59\x17e|\xfbG\xe9\xd9+\xcarhrc\xbb\xad?8\x1cI.\xa3\x14?\xe5\xac3JP\xdc\x14\xc6\xab\xd7\xa3>\xf6h\xbbBC\xf6\xabi~y\x07)*m\x80\x12\r\xc0\xb7B\xd5\xe7\x89\xeb82\xdd\x86\x0e\x04\xe0'), ('Lb0', 6, True, b'{', 97, b'\xe4\xe3@\xdd\x13\xca\x99\x1dz\x9e\x0c\xc4I\xad\x16W\xe7\x96w\xbb{\x00\xd9:\xd5\x88lK\xb0m\xf6\xe4v\xea!\x03&<\x1d\x18d\xe5vd\xb3[\x19\x04\xcaP\xd7\xf5\xa6\xeb\xfc\xd4M\x82l/q3\xdd\xc1x_\x89\x1d\xf8\xd8\x00\xc8]\x01(i\xf2P\xfd\xd3\x80\xc9\x96\x97\x17\xf4\x97\x98"\xe0\xe7\'h\xa4\xd8@\x85\xa4\x0b\xe3yh?w\x19/P-\xaa\x81\xc1\xb6\xd2[\xee\x1c\x80\x81c~'), ('Lb0', 6, False, b'{', 438, b'\x1f\x1c\x8e$\x97Q\x8a\x9fr\xd6\x19%(n\n\xe3\xd5\xebQ\x1f{\xb4]\xa1!\xfb\xd54\xbf\xbc\x83\x14\x956@\x89\x06\xe0[\xa1\xea\xf3\xc4u\x1c\x99nC\x07\x02\xf0\x8f7\xd2OFO\x01\x16\x86V\\B\xa6E\x03\xd8\xe3\x89\x9c]y_\xb5\xec\xa7h\xf6\xac\x15H\xaf\xc0#\x03\xe8>u\xf5\x16\x00\x81[\xe4\xcf\x93I\x01\xac;\x8b\x06|\xf7Nk\xfe-\xf3J\xf2|)i+Vz/\x80,'), ('Lb0', 7, True, b'{', 369, b'v\xfb+Z\xd4A\x9c\x0f\xf4m\xf1\x7f\x04Y\xcf\xc3\xdc\x0e\xf7w{\xec\xa1/\x17\xac\xbd\xac9\x87rP\xf7/\xc9\xf2~E\x95\x14\x84\x12\x90\x1b\xc9bp\xd2\x19\xa6\xf8b\x8es\xa2\x98\xfb\x7f\x8a^oQM8Y;\x1bv\xd7\xf0p\xe2I\xd3\x14\xa3\xf2\x9c\xd71H(\xec\xa1\x8fW\xaf\x15\xf1\xbc[u\x0b\t\xbfVY\xfa{\x82QR\xd8\x05"\xc0\x0f\xb5\n\xaf\x9eG\\q2\xed\x85\xc0\x80\x1f'), ('Lb0', 7, False, b'{', 267, b'\xca\xecc\x99H\xb6L\x05.R\xf1S\xffe&C\xf0v\x1bH{\x96\xf3\x17\xbcV\x0c\xc0\x18\x11\xfeUb\xecu\x81pr\xf72{V*\x7fu\xd8\xfbu\xa4;\xf0?n\x11=V\xaex\xfe\x9d\xb3}5W\x14Px\xc5\x15\xd3 A\'-\xb5QF\xdb\xe8";\xb0X\x14\x94\xcc\xd6\x81b\x94zH"2h\xc1\xf6\xe6\x86\x93*yn\xdf\xd4Z+\x829\xf0/\xb6\x8f\xfe \x9a\xf3\xc3;p'), ('Lb1', 0, True, b'{', 36, b'Uc\x1b\x1c\xf4\x0bg5O.\xf1\xc1\xf7w\x99\x87\'\xee\x9fQ{k.+\x7f\xa4\x81\x1af\xb4\x0c7\xd8K\x8e`Z(\x1f\xff\xb2\x96\x16\xb0\xda\xb3Z\xa90w\x00\xb7\xcd(O\t\xdc\x11F\x8c\xac\x17\x88\x93h\xf8\xa1;\xf8\xe5f<\xc1\xf2P\xc8\xa7\x9b$\x10/(\xa6",7\xb2\x87\xb0\x01>$\x13\xf4\xaf\xf6;\xea\xb33\x1b\x06:\xc1\xf1\x1c\xc7\xbcV\xf2e\xfdK\xc6\xa4\xdf\xc7\x89\x1f\xda'), ('Lb1', 0, False, b'{', 218, b'\x07\xba\x9c"]\x015\xdfKB\xa7\\\x90\xf0\x06G\xc5pF\xc6{\xbb\x83V6\xdf\xd9R\xaf\x14@\x159\x0b\x89\xc1\xe6fv\x93`\x88\x0cH4\x97b\xbbx\xa9\xfbU@\xc5\x0e\xba\x1c\xd4\xfer\x06\xf4\x80\xef\xd0]\xe5,\x12\xcf~\xd9\xa3 6vq\x02\xd2\xe7\xb0\xbf\xc6\xb8\xfd\xd8\xa0Q[\x08\x91\xf8\x98\x8fa\x0e\xae\x9a\xccI\xbfBA\xe3%\xa4\xd5\xac7I+\xce\xe9\x17\x91\xb3\xd1\x88H\x1c'), ('Lb1', 1, True, b'{', 1, b'C{\xc7\xfeE\x00\x12^\xca\xf3 Y\xdb@x\xd2\xaa\xc669\xe8\x16\xcej\x9e]\xe3\x83\xee\xef3\x0eO\xdd>\xa2\xf6\xd6\\V\xffI\x024\xcdh\x18o\xb0\x97\x1c\xc0\xb4P?\xffe,-a\xb5f\xb5R`\xee\x01o\x9aP\x9e\x13\xb8"\x8d\x19X/\x11&\xd1\xf1Bw\xf1\xca\xccy\x83\xe4\xa1\x91O6H ^QLDX'), ('Lb1', 1, False, b'{', 596, b"\xc6\xc5\xa3s\x85\xbfvOx\x12Z/SI\x1f\x83\xd4\xc1\xa7s{\xcd\xc1x\x9b\x97\xd3\xf1YC\xb25#\xed\xe4\x1a_\xcf\xee\x88kL\xcc\xa1\x13<al\x84d\x1a'\xa3\x982?\x90@\x0f\x01\xa2\x0f\xc0\xf8\xab#\t^S\x1dS\xc3\xeaR2\xbc\xbfW|,;\xad~`\xa7\x97\xb5\x9d\xfc\x0f\xbe\xd4{o\xa4;\xfc+\x00X\x11\x8d\xb7\xb7vy\x1d\x8f\xc7~b\xabFKf\xb6\xe6\xbd/\xbf")], 390)
python# frame RMS 5ms win=int(sr*0.005) rms=np.sqrt(np.convolve(d.astype(float)**2, np.ones(win)/win, mode='same')) # summarize intervals where rms<1 sil = rms < 1 # contiguous intervals > 5ms changes=np.diff(np.r_[False,sil,False].astype(int)) starts=np.where(changes==1)[0]; ends=np.where(changes==-1)[0] intervals=[(s/sr,e/sr,(e-s)/sr) for s,e in zip(starts,ends) if e-s>int(.005*sr)] intervals[:30], len(intervals) ([(np.float64(0.0), np.float64(0.2624263038548753), np.float64(0.2624263038548753)), (np.float64(0.46002267573696143), np.float64(0.5273469387755102), np.float64(0.06732426303854876)), (np.float64(0.8814739229024944), np.float64(0.9607936507936508), np.float64(0.07931972789115646)), (np.float64(1.326984126984127), np.float64(1.3942630385487529), np.float64(0.06727891156462586)), (np.float64(1.760453514739229), np.float64(1.8156916099773244), np.float64(0.05523809523809524)), (np.float64(2.193922902494331), np.float64(2.261201814058957), np.float64(0.06727891156462586)), (np.float64(2.6273922902494333), np.float64(2.694671201814059), np.float64(0.06727891156462586)), (np.float64(3.048798185941043), np.float64(3.3930385487528345), np.float64(0.3442403628117914)), (np.float64(3.7471882086167803), np.float64(3.826530612244898), np.float64(0.07934240362811791)), (np.float64(4.192698412698412), np.float64(4.259977324263039), np.float64(0.06727891156462586)), (np.float64(4.626167800453515), np.float64(4.862018140589569), np.float64(0.2358503401360544)), (np.float64(5.059637188208617), np.float64(5.126916099773243), np.float64(0.06727891156462586)), (np.float64(5.4931065759637185), np.float64(5.825283446712018), np.float64(0.3321768707482993)), (np.float64(6.191473922902494), np.float64(6.258798185941043), np.float64(0.06732426303854876)), (np.float64(6.624943310657597), np.float64(6.860793650793651), np.float64(0.2358503401360544)), (np.float64(7.058412698412698), np.float64(7.125691609977324), np.float64(0.06727891156462586)), (np.float64(7.47984126984127), np.float64(7.559160997732426), np.float64(0.07931972789115646)), (np.float64(7.925351473922903), np.float64(7.9951020408163265), np.float64(0.06975056689342404))], 18)
python# derive active intervals from silence list act = rms >= 1 chg=np.diff(np.r_[False,act,False].astype(int)) ss=np.where(chg==1)[0]; ee=np.where(chg==-1)[0] acts=[(s/sr,e/sr,(e-s)/sr) for s,e in zip(ss,ee) if e-s>int(.005*sr)] acts [(np.float64(0.2624263038548753), np.float64(0.46002267573696143), np.float64(0.19759637188208617)), (np.float64(0.5273469387755102), np.float64(0.8814739229024944), np.float64(0.3541269841269841)), (np.float64(0.9607936507936508), np.float64(1.326984126984127), np.float64(0.3661904761904762)), (np.float64(1.3942630385487529), np.float64(1.760453514739229), np.float64(0.3661904761904762)), (np.float64(1.8156916099773244), np.float64(2.193922902494331), np.float64(0.3782312925170068)), (np.float64(2.261201814058957), np.float64(2.6273922902494333), np.float64(0.3661904761904762)), (np.float64(2.694671201814059), np.float64(3.048798185941043), np.float64(0.3541269841269841)), (np.float64(3.3930385487528345), np.float64(3.7471882086167803), np.float64(0.3541496598639456)), (np.float64(3.826530612244898), np.float64(4.192698412698412), np.float64(0.3661678004535147)), (np.float64(4.259977324263039), np.float64(4.626167800453515), np.float64(0.3661904761904762)), (np.float64(4.862018140589569), np.float64(5.059637188208617), np.float64(0.1976190476190476)), (np.float64(5.126916099773243), np.float64(5.4931065759637185), np.float64(0.3661904761904762)), (np.float64(5.825283446712018), np.float64(6.191473922902494), np.float64(0.3661904761904762)), (np.float64(6.258798185941043), np.float64(6.624943310657597), np.float64(0.3661451247165533)), (np.float64(6.860793650793651), np.float64(7.058412698412698), np.float64(0.1976190476190476)), (np.float64(7.125691609977324), np.float64(7.47984126984127), np.float64(0.3541496598639456)), (np.float64(7.559160997732426), np.float64(7.925351473922903), np.float64(0.3661904761904762))]
python# inspect envelope via hilbert of raw diff (absolute smoothed 0.5ms) around burst 3 absd=np.abs(d) smooth=np.convolve(absd, np.ones(int(sr*0.0005))/int(sr*0.0005), mode='same') # find local amplitude periodicity via FFT of envelope inside burst 3 s,e=int(.96*sr),int(1.327*sr) env=smooth[s:e] # detrend and spectrum fe=np.fft.rfftfreq(len(env),1/sr) sp=np.abs(np.fft.rfft(env-env.mean())) inds=np.argsort(sp[(fe>1)&(fe<500)])[-10:] freq_sel=fe[(fe>1)&(fe<500)][inds] amp_sel=sp[(fe>1)&(fe<500)][inds] sorted(zip(freq_sel,amp_sel), key=lambda x:-x[1])[:10] [(np.float64(149.87024221453288), np.float64(1107481.878638032)), (np.float64(152.59515570934258), np.float64(972838.2860684439)), (np.float64(147.14532871972318), np.float64(372449.446994215)), (np.float64(155.32006920415225), np.float64(337604.4885704023)), (np.float64(2.7249134948096887), np.float64(323999.3927391012)), (np.float64(5.449826989619377), np.float64(292624.9405702859)), (np.float64(299.74048442906576), np.float64(252504.01862484988)), (np.float64(8.174740484429066), np.float64(244894.8645231636)), (np.float64(305.19031141868516), np.float64(242236.08171916622)), (np.float64(144.4204152249135), np.float64(232155.0368212465))]
python# FFT around 1.05-1.25s s,e=int(1.05*sr),int(1.25*sr) seg=d[s:e]*np.hanning(e-s) F=np.fft.rfft(seg) fr=np.fft.rfftfreq(len(seg),1/sr) sel=(fr>2000)&(fr<8000) ii=np.argsort(np.abs(F[sel]))[-20:][::-1] [(float(fr[sel][i]), float(np.abs(F[sel][i]))) for i in ii[:15]] [(7140.0, 824642.4994101017), (7290.0, 818897.4679056713), (7295.0, 501639.7395717844), (7135.0, 472731.4569129302), (7145.0, 357426.9435102647), (7285.0, 329416.34661628207), (7300.0, 24514.922154992382), (7130.0, 15164.365967303329), (7280.0, 14624.050941219013), (7150.0, 10725.190155609902), (7305.0, 5465.355138006635), (7275.0, 4018.9089327574998), (7125.0, 3525.071373515457), (7155.0, 2859.7625512641403), (7310.0, 2095.2899930173116)]
python# spectral centroid of difference within band for short windows nper=512; hop=128 f,t,Z=signal.stft(d,fs=sr,nperseg=nper,noverlap=nper-hop,boundary=None) mask=(f>=2500)&(f<=8000) P=np.abs(Z[mask])**2 ff=f[mask,None] cent=(P*ff).sum(axis=0)/(P.sum(axis=0)+1e-12) energy=np.sqrt(P.sum(axis=0)) # set low-energy to nan cent2=cent.copy(); cent2[energy < np.percentile(energy,30)] = np.nan # show values in 0.2-1.4 for ti,ci,en in zip(t[(t>.2)&(t<1.4)][::10], cent[(t>.2)&(t<1.4)][::10], energy[(t>.2)&(t<1.4)][::10]): print(round(float(ti),3), round(float(ci),1), round(float(en),1))
pythonfrom scipy.signal import find_peaks # use longer window nper 2048 for selected times f,t,Z=signal.stft(d,fs=sr,nperseg=2048,noverlap=1984,boundary=None) mag=np.abs(Z) band=(f>=2000)&(f<=9000) fb=f[band]; mb=mag[band] for tt in [0.3,0.4,0.55,0.65,0.7,0.8,1.1,1.5,2.0]: j=np.argmin(np.abs(t-tt)) peaks,_=find_peaks(mb[:,j],distance=10) ordp=peaks[np.argsort(mb[peaks,j])[-6:][::-1]] print(tt, [(round(float(fb[p]),1), round(float(mb[p,j]),1)) for p in ordp[:6]])
pythonf,t,S=signal.spectrogram(d,fs=sr,nperseg=512,noverlap=480,mode='magnitude') db=20*np.log10(S+1e-3) plt.figure(figsize=(18,8)) plt.imshow(db,origin='lower',aspect='auto',extent=[t[0],t[-1],f[0],f[-1]],cmap='gray_r',vmin=5,vmax=40) plt.xlim(0,8); plt.ylim(0,22050) plt.show()
Đã ra đúng “họ” của mã: lớp L−R vẽ các ký hiệu Pigpen cipher trên spectrogram (các ô/góc/X, có và không có chấm). Giờ chỉ còn đọc đúng hướng của bảng Pigpen để lấy plaintext/flag.
python# Make a labeled crop montage-like single plot with separators at active intervals f,t,Z=signal.stft(d,fs=sr,nperseg=1024,noverlap=1000,boundary=None) mag=20*np.log10(np.abs(Z)+1e-3) sel=(f>=2500)&(f<=7800) plt.figure(figsize=(20,6)) plt.imshow(mag[sel],origin='lower',aspect='auto', extent=[t[0],t[-1],f[sel][0],f[sel][-1]],cmap='gray_r',vmin=15,vmax=45) for i,(s,e,du) in enumerate(acts,1): plt.axvline(s,alpha=.2) plt.axvline(e,alpha=.2) plt.text((s+e)/2,7700,str(i),ha='center',va='top',fontsize=10) plt.xlim(.2,8); plt.ylim(2500,7800) plt.tight_layout(); plt.show()
python# Define shapes via cell orientation symbolic and X wedges. seq = ['<','V','Pi','BR','Up','U','TL','V','Udot','Pi','<','Pi','TRdot','U','<','Pidot','Pidot'] # Here BR means bottom+right = ┘, TL means top+left=┌, TR=top+right=┐, U=open top, Pi=open bottom # standard grid order A-I: std_shapes = ['BR','U','BL','R3','Box','L3','TR','Pi','TL'] x_shapes = ['V','<','Up','>'] # top,right,bottom,left sectors under our geometry std_order = std_shapes + [s+'dot' for s in std_shapes] + x_shapes + [s+'dot' for s in x_shapes] mapping={s:chr(65+i) for i,s in enumerate(std_order)} ''.join(mapping.get(s,'?') for s in seq), [mapping ('TSHAUBISKHTHPBTQQ', ['T', 'S', 'H', 'A', 'U', 'B', 'I', 'S', 'K', 'H', 'T', 'H', 'P', 'B', 'T', 'Q', 'Q'])
python# positions shape_to_pos={ 'BR':(-1,-1),'U':(0,-1),'BL':(1,-1), 'R3':(-1,0),'Box':(0,0),'L3':(1,0), 'TR':(-1,1),'Pi':(0,1),'TL':(1,1) } wedge_to_pos={'V':(0,-1),'<':(1,0),'Up':(0,1),'>':(-1,0)} # canonical letter positions standard grid_letters={} letters="ABCDEFGHI" for i,y in enumerate([-1,0,1]): for j,x in enumerate([-1,0,1]): grid_letters[(x,y)]=letters[i*3+j] x_letters={(0,-1):'S',(1,0):'T',(0,1):'U',(-1,0):'V'} def transforms(pt): x,y=pt return [ (x,y),(-y,x),(-x,-y),(y,-x), # rotations 0,90,180,270 (-x,y),(y,x),(x,-y),(-y,-x) # reflections variants ] names=['id','r90','r180','r270','mirrorX','diag','mirrorY','anti'] def decode_orient(k, alphabet=None): # transformed key: canonical letter at p moves to T(p); observed pos q maps canonical letter whose T(p)=q inv_grid={} for p,l in grid_letters.items(): q=transforms(p)[k] inv_grid[q]=l inv_x={} for p,l in x_letters.items(): q=transforms(p)[k] inv_x[q]=l out=[] for s in seq: dot=s.endswith('dot') base=s[:-3] if dot else s if base in shape_to_pos: l=inv_grid[shape_to_pos[base]] idx=ord(l)-65 if dot: idx+=9 elif base in wedge_to_pos: l=inv_x[wedge_to_pos[base]] idx=ord(l)-65 # S=18... if dot: idx+=4 else: out.append('?'); continue out.append(chr(65+idx)) return ''.join(out) for k,n in enumerate(names): s=decode_orient(k) print(n, s[:7], s[7:10], s[10:12], s[12:14], s[14:])
pythonimport string def keyed(keyword): s='' for c in keyword.upper()+string.ascii_uppercase: if c not in s: s+=c return s for kw in ['CRUX','CRUXIPHER','HOUSE','MUSIC','HOUSEMUSIC']: print(kw,keyed(kw))
python# get index sequence from orientation decode by converting letters back A-Z indices def decode_indices(k): # as above but output position index 0-25 inv_grid={} for p,l in grid_letters.items(): q=transforms(p)[k] inv_grid[q]=ord(l)-65 inv_x={} for p,l in x_letters.items(): q=transforms(p)[k] inv_x[q]=ord(l)-65 out=[] for s in seq: dot=s.endswith('dot') base=s[:-3] if dot else s if base in shape_to_pos: idx=inv_grid[shape_to_pos[base]] + (9 if dot else 0) else: idx=inv_x[wedge_to_pos[base]] + (4 if dot else 0) out.append(idx) return out for kw in ['CRUX','CRUXIPHER','HOUSE','MUSIC','HOUSEMUSIC']: alpha=keyed(kw) print("\n",kw,alpha) for k,n in enumerate(names): inds=decode_indices(k) out=''.join(alpha[i] for i in inds) print(n, out[:7], out[7:10], out[10:12], out[12:14], out[14:])
python# Correct standard X mapping x_letters_correct={(0,-1):'S',(-1,0):'T',(1,0):'U',(0,1):'V'} def decode_indices_correct(k=0): inv_grid={} for p,l in grid_letters.items(): q=transforms(p)[k] inv_grid[q]=ord(l)-65 inv_x={} for p,l in x_letters_correct.items(): q=transforms(p)[k] inv_x[q]=ord(l)-65 out=[] for s in seq: dot=s.endswith('dot') base=s[:-3] if dot else s if base in shape_to_pos: idx=inv_grid[shape_to_pos[base]]+(9 if dot else 0) else: idx=inv_x[wedge_to_pos[base]]+(4 if dot else 0) out.append(idx) return out inds=decode_indices_correct(0) std=''.join(string.ascii_uppercase[i] for i in inds) var4="IJKLMNOPQRSTUVWXYZABCDEFGH" out=''.join(var4[i] for i in inds) std, out, [out[:7],out[7:10],out[10:12],out[12:14],out[14:]] ('USHAVBISKHUHPBUQQ', 'CAPIDJQASPCPXJCYY', ['CAPIDJQ', 'ASP', 'CP', 'XJ', 'CYY'])
pythonvariants = { 0:"ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1:"ABCDEFGHIJKLMNOPQRSTVUWXZY", 2:"ABCDEFGHINOPQRSTUVJKLMWXYZ", 3:"NOPQRSTUVWXYZABCDEFGHIJKLM", 4:"IJKLMNOPQRSTUVWXYZABCDEFGH", 5:"ACEGIKMOQBDFHJLNPRSUWYTVXZ", 6:"ACEGIKMOQBDFHJLNPRSUYWTVZX", } for vk,alpha in variants.items(): print("VAR",vk) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) print(n, out[:7], out[7:10], out[10:12], out[12:14], out[14:]) print()
python# zoom last three glyphs 7.0-8.0 plt.figure(figsize=(14,6)) plt.imshow(mag[sel],origin='lower',aspect='auto',extent=[t[0],t[-1],f[sel][0],f[sel][-1]],cmap='gray_r',vmin=15,vmax=45) plt.xlim(6.8,8.0); plt.ylim(2500,7800) plt.xticks(np.arange(6.8,8.01,.05)); plt.grid(axis='x',alpha=.2) plt.show()
pythondef plot_range(a,b): plt.figure(figsize=(14,5)) plt.imshow(mag[sel],origin='lower',aspect='auto', extent=[t[0],t[-1],f[sel][0],f[sel][-1]],cmap='gray_r',vmin=15,vmax=45) plt.xlim(a,b); plt.ylim(2500,7800) plt.xticks(np.arange(a,b+1e-9,0.05)); plt.grid(axis='x',alpha=.18) plt.show() plot_range(.9,3.15)
pythonplot_range(3.3,4.75)
pythonplot_range(4.8,6.72)
pythonseq2=['<','V','Pi','BR','Up','U','TLdot','V','Udot','Box','<','Pi','TRdot','Box','<','TLdot','Pidot'] seq=seq2 for vk,alpha in variants.items(): print("VAR",vk) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) print(n, out[:7], out[7:10], out[10:12], out[12:14], out[14:]) print()
pythonbase='USHAVBRSKEUHPEURQ' # no spaces groups=[7,3,2,2,3] for sh in range(26): s=''.join(chr((ord(c)-65-sh)%26+65) for c in base) parts=[];i=0 for g in groups: parts.append(s[i:i+g]); i+=g print(sh, ' '.join(parts))
python# Build X-first paired mapping: observed geometric positions -> letters # We can use standard symbol index representation and create alphabet string for standard order. # standard order indices correspond grid undot 9, grid dot 9, X undot 4, X dot 4. # assign X sectors pairs A-H in top,left,right,bottom; grid pairs I-Z row-major. xfirst_pair_alpha=['?']*26 # grid shapes positions row-major canonical indices 0-8 and dotted +9 letters_grid = list("IJKLMNOPQRSTUVWXYZ") # 18 for cell in range(9): xfirst_pair_alpha[cell]=letters_grid[2*cell] xfirst_pair_alpha[cell+9]=letters_grid[2*cell+1] letters_x=list("ABCDEFGH") # std x indices 18..21 = top,left,right,bottom, dotted 22..25 same for sec in range(4): xfirst_pair_alpha[18+sec]=letters_x[2*sec] xfirst_pair_alpha[22+sec]=letters_x[2*sec+1] xfirst_pair_alpha=''.join(xfirst_pair_alpha) xfirst_pair_alpha 'IKMOQSUWYJLNPRTVXZACEGBDFH'
pythonalpha=xfirst_pair_alpha for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) print(n, out[:7], out[7:10], out[10:12], out[12:14], out[14:])
pythonimport importlib.util, sys, os, math, re, itertools, collections print(importlib.util.find_spec("wordfreq")) print(importlib.util.find_spec("wordninja")) print(importlib.util.find_spec("wordfreq"))
python# Define standard index group positions groups_idx = { 'G': list(range(0,9)), 'GD': list(range(9,18)), 'X': list(range(18,22)), 'XD': list(range(22,26)) } def alpha_for_order(order): arr=['?']*26 letter=0 for grp in order: for idx in groups_idx[grp]: arr[idx]=chr(65+letter); letter+=1 return ''.join(arr) common2=set("AM AN AS AT BE BY DO GO HE IF IN IS IT ME MY NO OF OH OK ON OR OX SO TO UP US WE".split()) common3=set("THE AND FOR ARE BUT NOT YOU ALL ANY CAN HAD HER WAS ONE OUR OUT DAY GET HAS HIM HIS HOW MAN NEW NOW OLD SEE TWO WAY WHO BOY DID ITS LET PUT SAY SHE TOO USE".split()) cands=[] for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order(order) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) parts=[out[:7],out[7:10],out[10:12],out[12:14],out[14:]] score=(parts[1] in common3)*3 + (parts[2] in common2)*2 + (parts[3] in common2)*2 + (parts[4] in common3)*3 if score: cands.append((score,order,n,parts,alpha)) sorted(cands,reverse=True)[:40] [(4, ('GD', 'G', 'X', 'XD'), 'r90', ['STOPUMC', 'TDN', 'SO', 'IN', 'SCF'], 'JKLMNOPQRABCDEFGHISTUVWXYZ'), (2, ('XD', 'G', 'X', 'GD'), 'r180', ['OQFMNLR', 'QYI', 'OF', 'TI', 'ORS'], 'EFGHIJKLMRSTUVWXYZNOPQABCD'), (2, ('X', 'XD', 'GD', 'G'), 'mirrorX', ['BAYTDSO', 'AJV', 'BY', 'QV', 'BOP'], 'RSTUVWXYZIJKLMNOPQABCDEFGH'), (2, ('X', 'XD', 'G', 'GD'), 'r90', ['ABNOCLT', 'BUM', 'AN', 'ZM', 'ATW'], 'IJKLMNOPQRSTUVWXYZABCDEFGH'), (2, ('X', 'GD', 'XD', 'G'), 'mirrorX', ['BAYTDSK', 'AFV', 'BY', 'MV', 'BKL'], 'RSTUVWXYZEFGHIJKLMABCDNOPQ'), (2, ('X', 'GD', 'G', 'XD'), 'r90', ['ABSTCQG', 'BHR', 'AS', 'MR', 'AGJ'], 'NOPQRSTUVEFGHIJKLMABCDWXYZ'), (2, ('GD', 'G', 'XD', 'X'), 'r90', ['WXOPYMC', 'XDN', 'WO', 'IN', 'WCF'], 'JKLMNOPQRABCDEFGHIWXYZSTUV'), (2, ('GD', 'G', 'XD', 'X'), 'r270', ['ZYMLXOG', 'YFN', 'ZM', 'AN', 'ZGD'], 'JKLMNOPQRABCDEFGHIWXYZSTUV'), (2, ('GD', 'G', 'XD', 'X'), 'mirrorY', ['YZKPWQC', 'ZHN', 'YK', 'AN', 'YCB'], 'JKLMNOPQRABCDEFGHIWXYZSTUV'), (2, ('GD', 'G', 'XD', 'X'), 'mirrorX', ['XWQLZKG', 'WBN', 'XQ', 'IN', 'XGH'], 'JKLMNOPQRABCDEFGHIWXYZSTUV'), (2, ('GD', 'G', 'X', 'XD'), 'r270', ['VUMLTOG', 'UFN', 'VM', 'AN', 'VGD'], 'JKLMNOPQRABCDEFGHISTUVWXYZ'), (2, ('GD', 'G', 'X', 'XD'), 'mirrorY', ['UVKPSQC', 'VHN', 'UK', 'AN', 'UCB'], 'JKLMNOPQRABCDEFGHISTUVWXYZ'), (2, ('GD', 'G', 'X', 'XD'), 'mirrorX', ['TSQLVKG', 'SBN', 'TQ', 'IN', 'TGH'], 'JKLMNOPQRABCDEFGHISTUVWXYZ'), (2, ('G', 'XD', 'X', 'GD'), 'mirrorX', ['ONHCQBX', 'NSE', 'OH', 'ZE', 'OXY'], 'ABCDEFGHIRSTUVWXYZNOPQJKLM')]
pythondef alpha_for_order_key(order, keyword): kalpha=keyed(keyword) arr=['?']*26 p=0 for grp in order: for idx in groups_idx[grp]: arr[idx]=kalpha[p]; p+=1 return ''.join(arr) for kw in ['CRUX','CRUXIPHER','CRUXIPHERCTF','HOUSEMUSIC','HOUSE']: cands=[] for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order_key(order,kw) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) parts=[out[:7],out[7:10],out[10:12],out[12:14],out[14:]] score=(parts[1] in common3)*3 + (parts[2] in common2)*2 + (parts[
python# Restore seq2 and decoder seq=seq2 pair_grid_order=[] for i in range(9): pair_grid_order += [i, i+9] pair_x_order=[] for i in range(4): pair_x_order += [18+i,22+i] orders_custom={ 'pair_grid_x': pair_grid_order+pair_x_order, 'pair_x_grid': pair_x_order+pair_grid_order, } for kw in ['','CRUX','CRUXIPHER','HOUSEMUSIC','HOUSE']: kalpha=string.ascii_uppercase if not kw else keyed(kw) print("\nKW", kw or 'NONE') for oname,idxorder in orders_custom.items(): arr=['?']*26 for c,idx in zip(kalpha,idxorder): arr[idx]=c alpha=''.join(arr) print(oname,alpha) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha
pythonimport os paths=['/usr/share/dict/words','/usr/share/dict/american-english','/usr/share/words'] [(p,os.path.exists(p)) for p in paths] [('/usr/share/dict/words', False), ('/usr/share/dict/american-english', False), ('/usr/share/words', False)]
pythonimport cmudict, re, collections, itertools, math words_raw=cmudict.words() words=set() for w in words_raw: w=w.lower() if re.fullmatch(r'[a-z]+',w): words.add(w) bylen=collections.defaultdict(list) for w in words: bylen[len(w)].append(w) len(words), {n:len(bylen[n]) for n in [2,3,7]} (117493, {2: 217, 3: 1578, 7: 22257})
pythoncommon2 = set(""" am an as at be by do go he if in is it me my no of oh ok on or ox so to up us we ah aw ax ay em en er ex ha hi hm ho id jo ka ki la lo ma mi mm mo mu na ne nu od oe oi om op os ow oy pa pi re sh si ta uh um un ut wo xi xu ya ye yo """.split()) common3 = set(""" the and for are but not you all any can had her was one our out day get has him his how man new now old see two way who boy did its let put say she too use ago air ale ant ape apt arc arm art ash ask ate bad bag ban bar bat bed bee beg bet bid big bin bit bob bow box bud bug bus buy cab cap car cat cop cow cry cup cut dad dam dan den dew did die dig dim dog dry due ear eat eel egg ego end era eve eye fan far fat fed fee few fig fit fix fly fog fox fun fur gas gel gem get gig gin god gum gun guy had ham hat hay hen her hid hip hit hog hop hot ice ill ink inn ion ire jam jar jaw jet job jog joy key kid kin kit lab lad lag lap law lay led leg lie lip log lot low mad man map mat may men met mid mix mob mom mud mug nap net nil nod nor not now nut oak odd off oil old one opt orb ore owl own pad pan par pat paw pay pea peg pen pet pie pig pin pit pod pop pot pro pry pub pug put rag ram ran rap rat raw red rib rid rig rim rip rob rod row rub rug run sad sat saw say sea set sew she shy sin sip sir sit six ski sky son sow spa spy sum sun tab tag tan tap tar tea ten the tie tin tip toe ton top toy try tub tug two use van vat vet via vow war wax web wed wet who why win wit won wow yes yet you zip zoo """.split()) # enforce substitution mapping pattern candidates=[] for w1 in bylen[7]: if len(set(w1))<7: continue A,B,C,D,E,F,G=w1 w3=A+C if w3 not in common2: continue # word2 B H I distinct all + new for w2 in common3: if len(w2)!=3 or w2[0]!=B or w2[2]!=C: continue H,I=w2[1],w2[2] mapping_letters=set(w1) if H in mapping_letters or I in mapping_letters or H==I: continue # I is C? wait w2[2] corresponds symbol I distinct from C! Actually pattern word2 = B H I, third is NEW symbol I, not C. Correct.
python# build candidate phrases with common short words candidates=[] for w1 in bylen[7]: if len(set(w1))<7: continue A,B,C,D,E,F,G=w1 w3=A+C if w3 not in common2: continue used=set(w1) for w2 in common3: if len(w2)!=3 or w2[0]!=B: continue H,I=w2[1],w2[2] if H in used or I in used or H==I: continue used2=used|{H,I} for w4 in common2: if len(w4)!=2 or w4[1]!=I: continue J=w4[0] if J in used2: continue used3=used2|{J} for w5 in common3: if len(w5)!=3 or w5[0]!=A or w5[1]!=G: continue K=w5[2] if K (1288, [('trouble', 'ram', 'to', 'hm', 'ten'), ('trouble', 'rim', 'to', 'am', 'ten'), ('trouble', 'rim', 'to', 'hm', 'ten'), ('trouble', 'rim', 'to', 'hm', 'tea'), ('schrank', 'cop', 'sh', 'up', 'sky'), ('schrank', 'cop', 'sh', 'up', 'ski'), ('schrank', 'cup', 'sh', 'op', 'sky'), ('schrank', 'cup', 'sh', 'op', 'ski'), ('schrank', 'cut', 'sh', 'it', 'sky'), ('brescia', 'run', 'be', 'on', 'bag'), ('brescia', 'run', 'be', 'on', 'bad'), ('brescia', 'run', 'be', 'on', 'bat'), ('schwenk', 'cop', 'sh', 'up', 'sky'), ('schwenk', 'cop', 'sh', 'up', 'ski'), ('schwenk', 'cap', 'sh', 'op', 'sky'), ('schwenk', 'cap', 'sh', 'op', 'ski'), ('schwenk', 'cap', 'sh', 'up', 'sky'), ('schwenk', 'cap', 'sh', 'up', 'ski'), ('schwenk', 'cup', 'sh', 'op', 'sky'), ('schwenk', 'cup', 'sh', 'op', 'ski'), ('schwenk', 'car', 'sh', 'or', 'sky'), ('schwenk', 'car', 'sh', 'or', 'ski'), ('schwenk', 'cut', 'sh', 'it', 'sky'), ('schwenk', 'cut', 'sh', 'at', 'sky'), ('schwenk', 'cut', 'sh', 'at', 'ski'), ('schwenk', 'cat', 'sh', 'it', 'sky'), ('schwenk', 'cat', 'sh', 'ut', 'sky'), ('schwenk', 'cat', 'sh', 'ut', 'ski'), ('schwenk', 'cry', 'sh', 'oy', 'ski'), ('schwenk', 'cry', 'sh', 'by', 'ski'), ('schwenk', 'cry', 'sh', 'my', 'ski'), ('schwenk', 'cry', 'sh', 'ay', 'ski'), ('schupak', 'cry', 'sh', 'oy', 'ski'), ('schupak', 'cry', 'sh', 'by', 'ski'), ('schupak', 'cry', 'sh', 'my', 'ski'), ('oldster', 'lip', 'od', 'up', 'orb'), ('oldster', 'lay', 'od', 'my', 'orb'), ('oldster', 'lap', 'od', 'up', 'orb'), ('swiatek', 'who', 'si', 'mo', 'sky'), ('swiatek', 'who', 'si', 'no', 'sky'), ('swiatek', 'who', 'si', 'go', 'sky'), ('swiatek', 'who', 'si', 'do', 'sky'), ('swiatek', 'who', 'si', 'lo', 'sky'), ('swiatek', 'who', 'si', 'jo', 'sky'), ('swiatek', 'won', 'si', 'un', 'sky'), ('schinke', 'cop', 'sh', 'up', 'set'), ('schinke', 'cop', 'sh', 'up', 'sea'), ('schinke', 'cop', 'sh', 'up', 'sew'), ('schinke', 'cap', 'sh', 'op', 'set'), ('schinke', 'cap', 'sh', 'op', 'sew'), ('schinke', 'cap', 'sh', 'up', 'set'), ('schinke', 'cap', 'sh', 'up', 'sew'), ('schinke', 'cow', 'sh', 'aw', 'set'), ('schinke', 'cup', 'sh', 'op', 'set'), ('schinke', 'cup', 'sh', 'op', 'sea'), ('schinke', 'cup', 'sh', 'op', 'sew'), ('schinke', 'car', 'sh', 'or', 'set'), ('schinke', 'car', 'sh', 'or', 'sew'), ('schinke', 'cut', 'sh', 'at', 'sew'), ('schinke', 'cat', 'sh', 'ut', 'sew'), ('schinke', 'cry', 'sh', 'oy', 'set'), ('schinke', 'cry', 'sh', 'oy', 'sea'), ('schinke', 'cry', 'sh', 'oy', 'sew'), ('schinke', 'cry', 'sh', 'by', 'set'), ('schinke', 'cry', 'sh', 'by', 'sea'), ('schinke', 'cry', 'sh', 'by', 'sew'), ('schinke', 'cry', 'sh', 'my', 'set'), ('schinke', 'cry', 'sh', 'my', 'sea'), ('schinke', 'cry', 'sh', 'my', 'sew'), ('schinke', 'cry', 'sh', 'ay', 'set'), ('schinke', 'cry', 'sh', 'ay', 'sew'), ('maurine', 'ash', 'mu', 'oh', 'met'), ('maurine', 'ago', 'mu', 'wo', 'met'), ('maurine', 'ago', 'mu', 'ho', 'met'), ('maurine', 'ago', 'mu', 'yo', 'met'), ('maurine', 'ago', 'mu', 'do', 'met'), ('maurine', 'ago', 'mu', 'lo', 'met'), ('maurine', 'ago', 'mu', 'jo', 'met'), ('maurine', 'ago', 'mu', 'so', 'met'), ('maurine', 'ask', 'mu', 'ok', 'met'), ('schnake', 'cop', 'sh', 'up', 'set'), ('schnake', 'cop', 'sh', 'up', 'sew'), ('schnake', 'cup', 'sh', 'op', 'set'), ('schnake', 'cup', 'sh', 'op', 'sew'), ('schnake', 'cut', 'sh', 'it', 'sew'), ('schnake', 'cry', 'sh', 'oy', 'set'), ('schnake', 'cry', 'sh', 'oy', 'sew'), ('schnake', 'cry', 'sh', 'by', 'set'), ('schnake', 'cry', 'sh', 'by', 'sew'), ('schnake', 'cry', 'sh', 'my', 'set'), ('schnake', 'cry', 'sh', 'my', 'sew'), ('maurice', 'ash', 'mu', 'oh', 'met'), ('maurice', 'ash', 'mu', 'oh', 'men'), ('maurice', 'ago', 'mu', 'wo', 'met'), ('maurice', 'ago', 'mu', 'wo', 'men'), ('maurice', 'ago', 'mu', 'no', 'met'), ('maurice', 'ago', 'mu', 'ho', 'met'), ('maurice', 'ago', 'mu', 'ho', 'men'), ('maurice', 'ago', 'mu', 'to', 'men'), ('maurice', 'ago', 'mu', 'yo', 'met')])
pythonfrom textblob.en import spelling type(spelling), len(spelling) (textblob._text.Spelling, 29157)
python# inspect spelling counts list(spelling.items())[:5], spelling.get('trouble'), spelling.get('the') ([('a', 21155), ('aah', 1), ('aaron', 5), ('ab', 2), ('aback', 3)], 57, 80030)
python# Build frequency dictionary lowercase alpha freq={w:int(c) for w,c in spelling.items() if re.fullmatch(r'[a-z]+',w)} # candidate lists by pattern constraints w1s=[w for w,c in freq.items() if len(w)==7 and len(set(w))==7 and c>=1] w2s=[w for w,c in freq.items() if len(w)==3] w4s=[w for w,c in freq.items() if len(w)==2] w5s=w2s # index for efficiency w2_by_first=collections.defaultdict(list) for w in w2s: w2_by_first[w[0]].append(w) w4_by_last=collections.defaultdict(list) for w in w4s: w4_by_last[w[1]].append(w) w5_by_first2=collections.defaultdict(list) for w in w5s: w5_by_first2[w[:2]].append(w) rank=[] for w1 in w1s: A,B,C,D,E,F,G=w1 w3=A+C if w3 not in freq: continue used=set(w1) for w2 in w2_by_first[B]: H,I=w2[1],w2[2] if H in used or I in used or H==I: continue used2=used|{H,I} for w4 in w4_by_last[I]: J=w4[0] if J in used2: continue used3=used2|{J} for w5 in w5_by_first2[A+G]: K=w5[2] if K in used3: continue # log freq score sc=sum(math.log(freq[w]+1) for w in [w1,w2,w3,w4,w5]) rank.append((sc, w1,w2,w3,w4,w5,[freq[w] for w in [w1,w2,w3,w4,w5]])) len(rank) 10332
pythonfor row in sorted(rank,reverse=True)[:100]: print(f"{row[0]:.2f}", *row[1:6], row[6])
pythonseq=seq2[::-1] for vk,alpha in list(variants.items())[:3]: print("VAR",vk) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) idx=0; parts=[] for g in [3,2,2,3,7]: parts.append(out[idx:idx+g]);idx+=g print(n,' '.join(parts)) print() seq=seq2
python# Restore seq seq=seq2 def split_phrase(s): gs=[7,3,2,2,3]; out=[];i=0 for g in gs: out.append(s[i:i+g].lower());i+=g return out results=[] for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order(order) for k,n in enumerate(names): inds=decode_indices_correct(k) base=''.join(alpha[i] for i in inds) for sh in range(26): # shift letters backward by sh s=''.join(chr((ord(c)-65-sh)%26+65) for c in base) parts=split_phrase(s) # score: log freq, unseen penalty sc=0 ok=0 for w in parts: c=freq.get(w,0) if c: sc+=math.log(c+1);ok+=1 else: sc-=4 # bonus common short if parts[1] in common3: sc+=2 if parts[2] in common2: sc+=2 if parts[3] in common2: sc+=2 if parts[4] in common3: sc+=2 results.append((sc,ok,order,n,sh,' '.join(parts),base)) for r in sorted(results,reverse=True)[:50]: print(r[:6])
python# map observed base shapes to geometric grid cell positions/wedge positions (canonical coordinates) shape_grid_pos=shape_to_pos.copy() shape_wedge_pos=wedge_to_pos.copy() # V top, < right, Up bottom, > left # Generate X-first mapping with arbitrary x position order and grid orientation transform x_positions=[(0,-1),(-1,0),(1,0),(0,1)] # top,left,right,bottom grid_canonical=[(-1,-1),(0,-1),(1,-1),(-1,0),(0,0),(1,0),(-1,1),(0,1),(1,1)] def decode_xfirst_custom(grid_t, x_order): # assign A-D to x_order observed positions, E-H dotted same map_symbol={} for i,p in enumerate(x_order): # find shape for this p sh=next(k for k,v in shape_wedge_pos.items() if v==p) map_symbol[sh]=chr(65+i) map_symbol[sh+'dot']=chr(65+4+i) # assign I-Q to transformed grid positions # canonical row-major pos transformed by grid_t => observed pos for i,p in enumerate(grid_canonical): obs=transforms(p)[grid_t] sh=next(k for k,v in shape_grid_pos.items() if v==obs) map_symbol[sh]=chr(65+8+i) map_symbol[sh+'dot']=chr(65+17+i) out=''.join(map_symbol[s] for s in seq2) return out, map_symbol def phrase_score(s): parts=split_phrase(s) sc=0; ok=0 for w in parts: c=freq.get(w,0) if c: sc+=math.log(c+1); ok+=1 else: sc-=5 return sc,ok,parts xs=[] for gt in range(8): for xo in itertools.permutations(x_positions): out,_=decode_xfirst_custom(gt,xo) sc,ok,parts=phrase_score(out) xs.append((sc,ok,names[gt],xo,' '.join(parts),out)) for r in sorted(xs,reverse=True)[:50]: print(r[:5])
pythondef vig(s,key,decrypt=True): out=[] key=key.upper() for i,c in enumerate(s): v=ord(c)-65 k=ord(key[i%len(key)])-65 z=(v-k)%26 if decrypt else (v+k)%26 out.append(chr(65+z)) return ''.join(out) # candidate pigpen decodes from group orders + orientations + pair variants pigcands=[] for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order(order) for k,n in enumerate(names): inds=decode_indices_correct(k) base=''.join(alpha[i] for i in inds) pigcands.append((f"groups{order}-{n}",base)) # add pair variants keyed/unkeyed etc for oname,idxorder in orders_custom.items(): arr=['?']*26 for c,idx in zip(string.ascii_uppercase,idxorder): arr[idx]=c alpha=''.join(arr) for k,n in enumerate(names): inds=decode_indices_correct(k) pigcands.append((f"{oname}-{n}", ''.join(alpha[i] for i in inds))) # score vigenere vr=[] for label,base in pigcands: for key in ['CRUX','CRUXIPHER']: for dec in [True,False]: s=vig(base,key,dec) sc,ok,parts=phrase_score(s) vr.append((sc,ok,label,key,'dec' if dec else 'enc',' '.join(parts),base)) for r in sorted(vr,reverse=True)[:60]: print(r[:6])
python[w for w in words if w.startswith('crux')][:50] ['crux']
python# dCode variant strings #7 #8 from source; '-' unmapped variants_more={ 7:"ABCDEFGHILMNOPRSTV--------", 8:"BDFHJLNPRACEGIKMOQT-V-S-U-" } for vk,alpha in variants_more.items(): print("VAR",vk,len(alpha)) for k,n in enumerate(names): inds=decode_indices_correct(k) out=''.join(alpha[i] if i<len(alpha) else '?' for i in inds) print(n, out[:7],out[7:10],out[10:12],out[12:14],out[14:])
python# Build a broad set of mapping outputs from many variants we've tried outs=set() labels={} # standard dcode variants 0-8 allvars={**variants,**variants_more} seq=seq2 for vk,alpha in allvars.items(): for k,n in enumerate(names): try: inds=decode_indices_correct(k) out=''.join(alpha[i] for i in inds) except: continue outs.add(out); labels[out]=f"dcode{vk}-{n}" # all group orders for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order(order) for k,n in enumerate(names): inds=decode_indices_correct(k); out=''.join(alpha[i] for i in inds) outs.add(out); labels[out]=f"order{order}-{n}" # pair variants std/xfirst for oname,idxorder in orders_custom.items(): arr=['?']*26 for c,idx in zip(string.ascii_uppercase,idxorder): arr[idx]=c alpha=''.join(arr) for k,n in enumerate(names): out=''.join(alpha[i] for i in decode_indices_correct(k)) outs.add(out); labels[out]=f"{oname}-{n}" # keyed CRUX for these for order in itertools.permutations(['G','GD','X','XD']): alpha=alpha_for_order_key(order,'CRUX') for k,n in enumerate(names): out=''.join(alpha[i] for i in decode_indices_correct(k)) outs.add(out); labels[out]=f"CRUXorder{order}-{n}" for oname,idxorder in orders_custom.items(): arr=['?']*26 kalpha=keyed('CRUX') for c,idx in zip(kalpha,idxorder): arr[idx]=c alpha=''.join(arr) for k,n in enumerate(names): out=''.join(alpha[i] for i in decode_indices_correct(k)) outs.add(out); labels[out]=f"CRUX{oname}-{n}" terms=['FLAG','CRUX','CIPHER','HOUSE','MUSIC','AUDIO','PIG','PEN','SPECT','STEREO','LEFT','RIGHT','DIFF','SIDE','MID','BASE','KEY','USE','THE'] hits=[] for out in outs: for term in terms: if term in out: hits.append((term,labels[out],out)) hits[:100], len(hits) ([('SPECT', "CRUXorder('G', 'GD', 'X', 'XD')-id", 'SPECTROPHASEMASON'), ('KEY', "order('G', 'GD', 'XD', 'X')-id", 'YWHAZBRWKEYHPEYRQ')], 2)
Đã giải được plaintext: SPECTRO PHASE MASON. Hint “CRUX first” đúng là bảo dùng bảng Pigpen với alphabet khóa bắt đầu bằng CRUX; hai khoảng nghỉ dài trong audio cũng khớp đúng ranh giới SPECTRO | PHASE | MASON.
Ra được payload ẩn trong audio là:
SPECTRO PHASE MASON
Theo format challenge cruXipher{...} và hint “CRUX first” (description.md), flag khả năng cao là:
cruXipher{spectro_phase_mason}
Cách giải: lấy L−R của stereo → spectrogram → Pigpen cipher → keyed alphabet bắt đầu bằng CRUX → SPECTRO PHASE MASON.
Nếu checker phân biệt format và flag trên không nhận, raw plaintext chắc chắn là SPECTROPHASEMASON; biến thể nên thử tiếp là cruXipher{SPECTROPHASEMASON}.