当前位置:   article > 正文

36D杯--记录_ctfshow 36d杯你没见过的注入

ctfshow 36d杯你没见过的注入

rsaEZ

公钥解析,得到e、n以及得到c1、c2、c3,分别打印三个m即可,最后找出属于flag的部分:

  1. from Crypto.PublicKey import RSA
  2. from Crypto.Util.number import *
  3. import gmpy2
  4. publickey = RSA.importKey(open(r'C:\Users\lenovo\Desktop\public.key','rb').read())
  5. e = publickey.e
  6. n = publickey.n
  7. p = 302825536744096741518546212761194311477
  8. q = 325045504186436346209877301320131277983
  9. c1 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message1','rb').read())
  10. c2 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message2','rb').read())
  11. c3 = bytes_to_long(open(r'C:\Users\lenovo\Desktop\encrypted.message3','rb').read())
  12. d = gmpy2.invert(e,(p-1)*(q-1))
  13. m1 = pow(c1,d,n)
  14. m2 = pow(c2,d,n)
  15. m3 = pow(c3,d,n)
  16. print(long_to_bytes(m1))
  17. print(long_to_bytes(m2))
  18. print(long_to_bytes(m3))
  19. #flag{3b6d3806-4b2b-11e7-95a0-000c29d7e93d}

justShow

看着冒号后面的,看起来就是把a移到了最后,应该是凯撒,得到:

gkbfnxeripjmxhemoc:abcdefghijklmnopqrstuvwxyz,看了wp才知道是playfair,冒号后面的就是key,但这里的key中i、j都有,26位,所以这里不需要用i代替j了,解出flag:

flagisctfshowicome


 

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/807549
推荐阅读
相关标签
  

闽ICP备14008679号