首页 > 其他分享 >[GWCTF 2019]babyRSA

[GWCTF 2019]babyRSA

时间:2024-11-09 18:19:16浏览次数:1  
标签:F1 F2 babyRSA pow bytes GWCTF 2019 solutions print

from Crypto.Util.number import *
from gmpy2 import *
from sympy import *

p = 797862863902421984951231350430312260517773269684958456342860983236184129602390919026048496119757187702076499551310794177917920137646835888862706126924088411570997141257159563952725882214181185531209186972351469946269508511312863779123205322378452194261217016552527754513215520329499967108196968833163329724620251096080377747699
q = 797862863902421984951231350430312260517773269684958456342860983236184129602390919026048496119757187702076499551310794177917920137646835888862706126924088411570997141257159563952725882214181185531209186972351469946269508511312863779123205322378452194261217016552527754513215520329499967108196968833163329724620251096080377748737
N = 636585149594574746909030160182690866222909256464847291783000651837227921337237899651287943597773270944384034858925295744880727101606841413640006527614873110651410155893776548737823152943797884729130149758279127430044739254000426610922834573094957082589539445610828279428814524313491262061930512829074466232633130599104490893572093943832740301809630847541592548921200288222432789208650949937638303429456468889100192613859073752923812454212239908948930178355331390933536771065791817643978763045030833712326162883810638120029378337092938662174119747687899484603628344079493556601422498405360731958162719296160584042671057160241284852522913676264596201906163
e = 65537
m1=90009974341452243216986938028371257528604943208941176518717463554774967878152694586469377765296113165659498726012712288670458884373971419842750929287658640266219686646956929872115782173093979742958745121671928568709468526098715927189829600497283118051641107305128852697032053368115181216069626606165503465125725204875578701237789292966211824002761481815276666236869005129138862782476859103086726091860497614883282949955023222414333243193268564781621699870412557822404381213804026685831221430728290755597819259339616650158674713248841654338515199405532003173732520457813901170264713085107077001478083341339002069870585378257051150217511755761491021553239
m2=487443985757405173426628188375657117604235507936967522993257972108872283698305238454465723214226871414276788912058186197039821242912736742824080627680971802511206914394672159240206910735850651999316100014691067295708138639363203596244693995562780286637116394738250774129759021080197323724805414668042318806010652814405078769738548913675466181551005527065309515364950610137206393257148357659666687091662749848560225453826362271704292692847596339533229088038820532086109421158575841077601268713175097874083536249006018948789413238783922845633494023608865256071962856581229890043896939025613600564283391329331452199062858930374565991634191495137939574539546

phi_n = (p-1)*(q-1)
d = inverse(e,phi_n)
c1 = pow(m1,d,N)
c2 = pow(m2,d,N)

F1,F2 = symbols('F1,F2')        #首先定义了F1,F2这两个未知数
equation1 = Eq(F1+F2,c1)        #然后定义了equation1和equation2两个方程
equation2 = Eq(pow(F1,3)+pow(F2,3),c2)
solutions = solve((equation1,equation2),(F1,F2))     #利用sympy这个库解出F1和F2的值
print(list(solutions[0]))                                       #打印出解列表1 虽然有两个解 但是都是一样的
print(long_to_bytes(list(solutions[0])[1]).decode(),end='')     #long_to_bytes返回的是一个二进制字符类型 decode是将bytes转化为str  end=''是将22和23的print结果合并在一起
print(long_to_bytes(list(solutions[0])[0]).decode(),end='')

标签:F1,F2,babyRSA,pow,bytes,GWCTF,2019,solutions,print
From: https://www.cnblogs.com/sauy/p/18537094

相关文章

  • [极客大挑战 2019]BabySQL 1
    [极客大挑战2019]BabySQL1打开实例,源代码审计,发现登录请求check.php页面路径,采用get方法根据题目可知这是sql注入,尝试万能密码无果?username=admin'or1=1--+&password=admin尝试orderby、堆叠注入和union联合注入,发现都无效,怀疑字段被过滤(这边基本确定or被过滤)尝试......
  • [ZJCTF 2019]NiZhuanSiWei 1
    [ZJCTF2019]NiZhuanSiWei1打开实例,发现为代码审计,确认为文件包含漏洞需要三个参数text、file、password,首先是text验证,逻辑显示text必须有值,且读取文件内容得是welcometothezjctf采用读取本地文件绕过,在E盘新建文件发现无效尝试data流?text=data://,welcometothe......
  • [SUCTF 2019]EasySQL 1
    [SUCTF2019]EasySQL1根据题目所得是个sql注入题,尝试万能密码显示不对,说明存在输入过滤,尝试堆叠注入1;showdatabases;成功显示数据库列表,并且发现数据库ctf查询数据表,查询出表Flag1;usectf;showtables;尝试select*fromFlag;发现出现错误\思考其sql语句为se......
  • [RoarCTF 2019]Easy Calc 1
    [RoarCTF2019]EasyCalc1打开实例发现是个计算器查看源代码看见设置了WAF的提示,并看见计算器的请求方法,注意到calc.php页面访问calc.php页面,查看到逻辑处理源代码,根据代码显示,确定这是一道RCE题,blacklist为黑名单过滤数组,总结:绕过数组就可以任意代码执行传递num=ls,发现......
  • [极客大挑战 2019]Http 1
    [极客大挑战2019]Http1代码审计发现页面Secret.php访问后显示页面,判断这题为头信息伪造Hackerbar梭哈,最终payload为GET/Secret.phpHTTP/1.1Host:node5.buuoj.cn:25132User-Agent:SycloverAccept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0......
  • [极客大挑战 2019]HardSQL 1
    [极客大挑战2019]HardSQL1打开实例,发现是个登陆页面,查看源代码,发现又是GET提交check.php万能密码尝试不太行,怀疑字段或者空格被过滤,尝试闭合不加其他东西确认空格、union、and等都被过滤了,尝试加个括号并未出现你可知被我速住了,臭弟弟字样,()未被过滤吧,尝试采用upda......
  • [极客大挑战 2019]BuyFlag 1
    [极客大挑战2019]BuyFlag1打开实例发现pay.php页面,有提示信息打开源码发现passwordpost提交逻辑burpsuite抓包传参,传入money和password参数,这里password是==弱比较,所以加个字符就可以绕过password=404a&money=100000000回显发现并没有变化注意到学生需要CUIT(Only......
  • [强网杯 2019]随便注 1
    [强网杯2019]随便注1万能密码上一波,回显成功,判断为'闭合注入?inject=1'or1=1--+(?inject=1unionselect1,2,3)union尝试,根据回显,发现存在字段过滤,过滤了select包括where等操作/select|update|delete|drop|insert|where|\./i尝试闭合堆叠?inject=1';showdat......
  • [极客大挑战 2019]Upload 1
    [极客大挑战2019]Upload1打开实例为文件上传页面,代码审计,发现为php文件,采用php马采用bp抓包修改后缀绕过,上传一句话木马<?phpphpinfo();@eval($_POST['cmd']);?>回显错误,显示不能为php,存在文件类型过滤尝试采用phtm文件包含php绕过显示非image文件尝试采用GIF89......
  • [极客大挑战 2019]Secret File 1
    [极客大挑战2019]SecretFile1代码审计发现页面/Archive_room.php访问页面点击SECRET按钮,bp抓包发现302重定向,附带一个注释页面secr3t.php访问secr3t.php,代码审计访问flag.php,发现一个贱贱的页面,确认是文件包含看不到页面且禁用../等参数,考虑用php的base64回显,paylo......