You can extract N and e by a series of commands:
$ PUBKEY=`grep -v -- ----- 1.pub | tr -d '\n'`
$ echo $PUBKEY | base64 -d | openssl asn1parse -inform DER -i
$ echo $PUBKEY | base64 -d | openssl asn1parse -inform DER -i -strparse 18
or
openssl asn1parse -in 1.pub
openssl asn1parse -in 1.pub -strparse 18
(thanks to http://stackoverflow.com/questions/3116907/rsa-get-exponent-and-modulus-given-a-public-key)
#1
I found a nice tool: http://www.sympy.org/en/index.html
p=9733382803370256893136109840971590971460094779242334919432347801491641617443615856221168611138933576118196795282443503609663168324106758595642231987245583L
q=9733382803370256893136109840971590971460094779242334919432347801491641617443615856221168611138933576118196795282443503609663168324106758595642231987246769L
Password= 'XtCgoEKksjKFWlqOSxqsEhK/+tsr1k5c'
#2
N shared common factor, previous q
p=12401828372292379853813876769631673931562555174641979554254424458038243058638417065284301266881242433017828663818811606556559256084249679274024474025282343L
q=9733382803370256893136109840971590971460094779242334919432347801491641617443615856221168611138933576118196795282443503609663168324106758595642231987246769L
Password= 'rlSpJ6HbP+cZXaOuSPOe4pgfevGnXtLt'
#3
Use factorint again
p=158304142767773473275973624083670689370769915077762416888835511454118432478825486829242855992134819928313346652550326171670356302948444602468194484069516892927291240140200374848857608566129161693687407393820501709299228594296583862100570595789385365606706350802643746830710894411204232176703046334374939501731L
q=54311
Password= 'hQdK+dKleMJqth/dofWyFaiWp3PW7jil'
#4
Use wiener attack (thanks to https://github.com/ctfs/write-ups-2015/blob/master/plaidctf-2015/crypto/curious/wiener_attack.py)
p=10843221374140991753173625949764386011485161421520044246309105053489500519257941272796681417497061734054081478280518835582353321569961722963922828311576983L
q=10114792273660656874618568712406420344176220457790563178092222929337786916374923318745284718351487926620784106195715878875311958793629905453919697155685507L
Password= '/3aAP5dF2zmrPh9K6A4AqMLsIiYDk2C2'
※ alternatively,
openssl rsa -text -in 1.pub
'CTF' 카테고리의 다른 글
PlaidCTF 2016 butterfly (pwnable 150) Writeup (0) | 2016.04.18 |
---|---|
PlaidCTF 2016 pound (pwnable 290) Writeup (0) | 2016.04.18 |
Boston Key Party 2016 Cookbook (pwnable 6) Writeup (EN) (0) | 2016.03.07 |
Boston Key Party 2016 Cookbook (pwnable 6) Writeup (KR) (0) | 2016.03.07 |
HDCON 2015 Track3 writeup (0) | 2015.11.19 |