当前位置:网站首页>2022dasctf APR x fat epidemic prevention challenge crypto easy_ real

2022dasctf APR x fat epidemic prevention challenge crypto easy_ real

2022-04-23 20:22:00 After the rain &

Not at all , Yes . Only the sign in question of password

Title Description

import random
import hashlib

flag = 'xxxxxxxxxxxxxxxxxxxx'
key = random.randint(1,10)
for i in range(len(flag)):
    crypto += chr(ord(flag[i])^key)
m = crypto Of ascii Hexadecimal
e = random.randint(1,100)
print(hashlib.md5(e))
p = 64310413306776406422334034047152581900365687374336418863191177338901198608319
q = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
n = p*q
c = pow(m,e,n)
print(n)
print(c)
#37693cfc748049e45d87b8c7d8b9aacd
#4197356622576696564490569060686240088884187113566430134461945130770906825187894394672841467350797015940721560434743086405821584185286177962353341322088523
#3298176862697175389935722420143867000970906723110625484802850810634814647827572034913391972640399446415991848730984820839735665233943600223288991148186397

It's not hard to see from the code that

#37693cfc748049e45d87b8c7d8b9aacd Corresponding to the corresponding e Of md5 value

Go to the corresponding website to decrypt

e=23

Others are defined separately

n=4197356622576696564490569060686240088884187113566430134461945130770906825187894394672841467350797015940721560434743086405821584185286177962353341322088523
c=3298176862697175389935722420143867000970906723110625484802850810634814647827572034913391972640399446415991848730984820839735665233943600223288991148186397
p = 64310413306776406422334034047152581900365687374336418863191177338901198608319

According to the code , It's not hard for us to see , This is typical rsa encryption

Directly find the value of plaintext

from Crypto.Util.number import inverse,long_to_bytes

n=4197356622576696564490569060686240088884187113566430134461945130770906825187894394672841467350797015940721560434743086405821584185286177962353341322088523
c=3298176862697175389935722420143867000970906723110625484802850810634814647827572034913391972640399446415991848730984820839735665233943600223288991148186397
p = 64310413306776406422334034047152581900365687374336418863191177338901198608319
q=n//p
e=23
phi=(q-1)*(p-1)
d=inverse(e,phi)
m = pow(c, d, n)  
print(m);
//m=2976168736142380455841784134407431434784057911773423743751382131043957
//m="ndios_;9kgE;WK8e;W?gWn<\;k|nu"

Let's continue to observe

key It's a random value

But there is scope

Let's go straight to violence

import random
import hashlib
import math
from Crypto.Util.number import inverse,long_to_bytes

n=4197356622576696564490569060686240088884187113566430134461945130770906825187894394672841467350797015940721560434743086405821584185286177962353341322088523
c=3298176862697175389935722420143867000970906723110625484802850810634814647827572034913391972640399446415991848730984820839735665233943600223288991148186397
p = 64310413306776406422334034047152581900365687374336418863191177338901198608319
q=n//p
e=23
phi=(q-1)*(p-1)
d=inverse(e,phi)
m = pow(c, d, n)  
print(m);
m="ndios_;9kgE;WK8e;W?gWn<\;k|nu"
for key in range(11):
  flag=""
  for i in range(len(m)):
    flag+=chr(ord(m[i])^key)
  print(flag)

Go straight out flag

Playing so many games , Or vegetables? .

Many questions didn't reappear after the game , What a failed vegetable chicken , Purring .

There are too few teachers to communicate in the school , It's said that the United team is recruiting new people recently , Ready to try .

版权声明
本文为[After the rain &]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232020423016.html