目录
web
我Flag呢?
导弹迷踪
Follow me and hack me
PHP是世界上最好的语言!!
Vim yyds
1zjs
crypto
Hex?Hex!(初级)
梦想是红色的 (初级)
原来你也玩原神 (初级)
家人们!谁懂啊,RSA签到都不会 (初级)
yafu (中级)
factordb (中级)
P_Leak
md5的破解
我测你vva
The same common divisor (高级)
Is this only base?
e的学问
misc
What_1s_BASE (初级)
404notfound (初级)
Take me hand (初级)
喜欢我的压缩包么 (初级)
破损的图片(初级)
这羽毛球怎么只有一半啊(恼 (初级)
F12
F12,调试器查看game.js代码
hackbar传同时传get和post
可以命令执行,先ls /,再cat /flag
vim泄露,访问/.index.php.bak下载备份文件,linux下使用vim -r index.php.bak恢复代码
jsfuck,控制台输出一下
16进制转码一下得到flag
社会主义核心价值观
百度提瓦特大陆的语言,然后对着字母表一个个翻译,最后得到
NSSCTF{YUANLAINIYEWANYUANSHENWWW}
简单的rsa题,直接上代码
import libnum
from Crypto.Util.number import long_to_bytes
p = 12567387145159119014524309071236701639759988903138784984758783651292440613056150667165602473478042486784826835732833001151645545259394365039352263846276073
q = 12716692565364681652614824033831497167911028027478195947187437474380470205859949692107216740030921664273595734808349540612759651241456765149114895216695451
c = 108691165922055382844520116328228845767222921196922506468663428855093343772017986225285637996980678749662049989519029385165514816621011058462841314243727826941569954125384522233795629521155389745713798246071907492365062512521474965012924607857440577856404307124237116387085337087671914959900909379028727767057
e = 65537
n = p*q
fn = (p-1)*(q-1)
d = libnum.invmod(e,fn)
print("d2=%d" % d)
m = pow(c, d, n)
flag = long_to_bytes(m)
print(flag)
把题目给的n用yafu分解一下,得到15个素数相乘
import libnum
from Crypto.Util.number import long_to_bytes
e = 65537
n = 15241208217768849887180010139590210767831431018204645415681695749294131435566140166245881287131522331092026252879324931622292179726764214435307
c = 12608550100856399369399391849907846147170257754920996952259023159548789970041433744454761458030776176806265496305629236559551086998780836655717
p1 = 2201440207
p2 = 3354884521
p3 = 4171911923
p4 = 2719600579
p5 = 2923522073
p6 = 2758708999
p7 = 2906576131
p8 = 2315495107
p9 = 4044505687
p10 = 4021078331
p11 = 2151018733
p12 = 3355651511
p13 = 2767137487
p14 = 2585574697
p15 = 3989697563
fn = (p1-1)*(p2-1)*(p3-1)*(p4-1)*(p5-1)*(p6-1)*(p7-1)*(p8-1)*(p9-1)*(p10-1)*(p11-1)*(p12-1)*(p13-1)*(p14-1)*(p15-1)
# print(fn)
d = libnum.invmod(e,fn)
# print("d=%d" % d)
m = pow(c, d, n)
flag = long_to_bytes(m)
# print("m=%d" % m)
print(flag)
将给的n用factordb分解一下得到pq,然后代入脚本解密
import libnum
from Crypto.Util.number import long_to_bytes
p = 275127860351348928173285174381581152299
q = 319576316814478949870590164193048041239
e = 65537
n = 87924348264132406875276140514499937145050893665602592992418171647042491658461
c = 87677652386897749300638591365341016390128692783949277305987828177045932576708
fn = (p-1)*(q-1)
d = libnum.invmod(e,fn)
print("d2=%d" % d)
m = pow(c, d, n)
flag = long_to_bytes(m)
print(flag)
dp泄露攻击,用脚本解密即可
import libnum
from Crypto.Util.number import long_to_bytes,bytes_to_long
e = 65537
dp= 5892502924236878675675338970704766304539618343869489297045857272605067962848952532606770917225218534430490745895652561015493032055636004130931491316020329
n= 50612159190225619689404794427464916374543237300894011803225784470008992781409447214236779975896311093686413491163221778479739252804271270231391599602217675895446538524670610623369953168412236472302812808639218392319634397138871387898452935081756580084070333246950840091192420542761507705395568904875746222477
c= 39257649468514605476432946851710016346016992413796229928386230062780829495844059368939749930876895443279723032641876662714088329296631207594999580050131450251288839714711436117326769029649419789323982613380617840218087161435260837263996287628129307328857086987521821533565738409794866606381789730458247531619
for i in range(1, e):
if(e*dp%i==1):
p=(e*dp-1)//i+1
if(n%p==0):
q=n//p
break
phi=(p-1)*(q-1)
d = libnum.invmod(e,phi)
m = pow(c, d, n)
flag=long_to_bytes(m)
print(flag)#转字节
给了flag内容的0~12位,15~17位,19~33位,35~37位还有flagmd5加密后的值
所以遍历13~14位,18位,34位,拼起来与给出的md5进行比较就能得到正确的flag
from Crypto.Util.number import *
from hashlib import md5
def get_md5(screct):
src=screct.encode('utf-8')
# mymd5=hashlib.md5()
# mymd5.update(src)
# md=mymd5.hexdigest()
md=md5(src).hexdigest()
return md
s='1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM'
for i in s:
for j in s:
for k in s:
for l in s:
screct='LitCTF{md5can'+i+j+'3de'+k+'rypt213thoughcr'+l+'sh}'
md=get_md5(screct)
# print(md)
if(md=='496603d6953a15846cd7cc476f146771'):
print(screct)
break
给了加密后的密文,根据加密算法可以看出,先将flag转成字符数组,然后遍历每个数据转成整型,如果下标是偶数这个值就加上下标,是奇数就减去下标,最后加密得到HYEQJvPZ~X@+Bp
python解密脚本:
flag=''
cipher='HYEQJvPZ~X@+Bp'
l=list(cipher)
# for i in range(14):
# print(l[i],end=' ')
for i in range(14):
if(i%2==0):
flag=ord(l[i])
flag=flag-i
print(chr(flag),end='')
if(i%2!=0):
flag=ord(l[i])
flag=flag+i
print(chr(flag),end='')
共享素数问题,需要通过n1,n2来求p,又因为n3=n1^n2,所以n2=n3^n1
import libnum,math
from Crypto.Util.number import long_to_bytes,bytes_to_long
e = 65537
n1= 9852079772293301283705208653824307027320071498525390578148444258198605733768947108049676831872672654449631852459503049139275329796717506126689710613873813880735666507857022786447784753088176997374711523987152412069255685005264853118880922539048290400078105858759506186417678959028622484823376958194324034590514104266608644398160457382895380141070373685334979803658172378382884352616985632157233900719194944197689860219335238499593658894630966428723660931647038577670614850305719449893199713589368780231046895222526070730152875112477675102652862254926169713030701937231206405968412044029177246460558028793385980934233
n3= 4940268030889181135441311597961813780480775970170156650560367030148383674257975796516865571557828263935532335958510269356443566533284856608454193676600884849913964971291145182724888816164723930966472329604608512023988191536173112847915884014445539739070437180314205284883149421228744714989392788108329929896637182055266508625177260492776962915873036873839946591259443753924970795669864031580632650140641456386202636466624658715315856453572441182758855085077441336516178544978457053552156714181607801760605521338788424464551796638531143900048375037218585999440622490119344971822707261432953755569507740550277088437182
c1= 7066425618980522033304943700150361912772559890076173881522840300333719222157667104461410726444725540513601550570478331917063911791020088865705346188662290524599499769112250751103647749860198318955619903728724860941709527724500004142950768744200491448875522031555564384426372047270359602780292587644737898593450148108629904854675417943165292922990980758572264063039172969633878015560735737699147707712154627358077477591293746136250207139049702201052305840453700782016480965369600667516646007546442708862429431724013679189842300429421340122052682391471347471758814138218632022564279296594279507382548264409296929401260
c2= 854668035897095127498890630660344701894030345838998465420605524714323454298819946231147930930739944351187708040037822108105697983018529921300277486094149269105712677374751164879455815185393395371001495146490416978221501351569800028842842393448555836910486037183218754013655794027528039329299851644787006463456162952383099752894635657833907958930587328480492546831654755627949756658554724024525108575961076341962292900510328611128404001877137799465932130220386963518903892403159969133882215092783063943679288192557384595152566356483424061922742307738886179947575613661171671781544283180451958232826666741028590085269
n2=n3^n1
p = math.gcd(n1,n2) # 欧几里得算法,p为两者的最大公约数
q = n1 // p #不论是用n1还是n2整除p得到的q,最后得到的都是同一个明文m
phi = (p-1)*(q-1)
d = libnum.invmod(e,phi)
m = pow(c1,d,n1)
print(m)
print(long_to_bytes(m))
看着像base64,但是base64的==是在末尾,根据提示,使用栅栏解密一下
再base64一下,很明显的凯撒再解密一下得到flag
gcd(fn,e)=2,说明e和phi不互素,这里看到e=74=2*37,那么就可以将2d看成一个整体来计算
import libnum,gmpy2
from Crypto.Util.number import long_to_bytes
p= 86053582917386343422567174764040471033234388106968488834872953625339458483149
q= 72031998384560188060716696553519973198388628004850270102102972862328770104493
c= 3939634105073614197573473825268995321781553470182462454724181094897309933627076266632153551522332244941496491385911139566998817961371516587764621395810123
e= 74 #2*37
n= p*q
fn=(p-1)*(q-1)
d2 = libnum.invmod(37,fn)
# print("d2=%d" % d)
m2 = pow(c, d2, n)
m,b = gmpy2.iroot(m2,2)
flag = long_to_bytes(m)
print(flag)
base64
图片丢到010editor查看,一下就看到flag
wireshark打开,第一条POST流量处存在flag
爆破一下得到密码114514,解压一下得到flag
将其文件头替换成png的文件头,打开即可得到flag
crc校验出错,图片宽高不对,爆破一下得到正确宽高,修改后再打开图片得到flag
import binascii
import struct
crcbp = open("羽毛球.png", "rb").read() #打开图片
crc32frombp = int(crcbp[29:33].hex(),16) #读取图片中的CRC校验值
print(crc32frombp)
for i in range(4000): #宽度1-4000进行枚举
for j in range(4000): #高度1-4000进行枚举
data = crcbp[12:16] + \
struct.pack('>i', i)+struct.pack('>i', j)+crcbp[24:29]
crc32 = binascii.crc32(data) & 0xffffffff
# print(crc32)
if(crc32 == crc32frombp): #计算当图片大小为i:j时的CRC校验值,与图片中的CRC比较,当相同,则图片大小已经确定
print(i, j)
print('hex:', hex(i), hex(j))
exit(0)
正确宽高: