## Description* **Name:** [Crack the key](https://2019.peactf.com/problems)* **Points:** 450* **Tag:** Crypto


## Tools* Firefox Version 60.8.0 https://www.mozilla.org/en-US/firefox/60.8.0/releasenotes/* Vigenere Solver https://www.guballa.de/vigenere-solver* Vigenere cipher breaker https://planetcalc.com/7956/#calculator7948* Vigenere-Cipher-Breaker https://github.com/drewp41/Vigenere-Cipher-Breaker
## WriteupDownload the file called enc.txt (954283747bbbcc4caf8a684a5bde520a) through the link where we find a Vigenere cipher text.
```bashroot@1v4n:~/CTF/peaCTF2019/crypto/Crackthekey# wget https://shell1.2019.peactf.com/static/a4836f4c3f6a10f05c2383a4486bd934/enc.txtroot@1v4n:~/CTF/peaCTF2019/crypto/Crackthekey# md5sum enc.txt954283747bbbcc4caf8a684a5bde520a  enc.txtroot@1v4n:~/CTF/peaCTF2019/crypto/Crackthekey# file enc.txtenc.txt: ASCII textroot@1v4n:~/CTF/peaCTF2019/crypto/Crackthekey# cat enc.txtDVMDVRWOUISIERRRGNNVMWPOPGTOHSBUIHTCSSMJIVUWEXHTCTKZKFXIENWTDDOVMEOWDZRQEBQPVLFWKJBGLEEDALGCIVLQGLTWTCMFXSIAQTLTUGZQZZWOPVGIRCSLRUZRJUZBQSXSPXGJMGTPRPUGRSIVRGUDAFXHTNLVVBMFZMQSFUWTWTFSWHIGXHTQLGCUSRGLEIWWXXWWCJDAIFXGAPDWGWFHTZSVOBISITRVUTTVRTWTDGMCPHGGNRDBPOIZZWZPGHTTDQPHOYIUTUEWJDCPWORWDAZREDNHYSJZRJPAFSOCPDXZVPLVPGMNIWPFWUVRDUJINIDFXLYIUTENWAHITVJZRJPVQEFAJEXWIMQVIYPTWGZYYYXKTNNVMQJTPVZRJHEBVDWPOKGEIUDCAHDJGTRYKLHSILXHPIZPVDEMDZGLEEGTDWDMGSTRAHXIPFGRVKPLUEDPHEVSEKHSZREMDCELWGVHKQBYSCXRLLRRGLQFLESIZGGDQXCQPETTXEXGKLHDBUIRPCTQSCWLIPNHBTTY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VWGLEGUTKMIIEPKXEFITCLWIJRJZGLFDPWFGOIULIFENTCZVEFYVQMNWTCTLVDPILVPGIECWLRVJLLVPNRDPHDXJFRJPANRYILZSJUMQPZLLOGHPWHLXWDORXHTGLAZZXHHBEMPTSZAFYMVCWFIGPKPLADEVDURAHPIDXMGMGPXCIAGPYGWRRGXVSECIWPASJRRIWSJIGHEVSKILCBRPLXVPRUVFXIPRAAHJYMNVVVPTYCRTHAIUKIGUWELIHHEISUMQTAFSFRWLVSTXHGIAHTGTXIFUSXHXBAEGHZJOFVNPNGIRIWPLGIWHHKNQEBJCMWCXKTEUMTTVZELRRGQMANABXYXZVHRCSRCBTCUEEZRZPAGLEDAOIKKEQXUNPOCISIXRVPPVQXHTLZVKKXHBXRVESWPWWCHRBBNPKTSLRVNLHCPRHISXEASJYVJIYPYIDXECVWRBMPCNXRLPJVQDGSSSRXCDXSEGHWMJSUASDEQKLDIOBHHPSRMNVRKXUNXAXAESCVISIPRJLXTDSXWFXIBUETWTHSMCHVDWAIRWPGIZRHQDBNMLPCORGWPLTANPOCTLQGEKWWMNRIBPWWGEXKTNNVMWTYINVVOPCTLESXQEKBIGLPLLELDFPVJEBIPNXHTHLAFFXKXVTXOAPFKZRXQTDRVTWTWIKJALIPBYTDEPRDPEGBQGXICVTXZVADHLRZOITOXGSSATZGLEILZSXKLHBCFYAAAJWHVRWIPRMRHJYHSPWWDORXHTGTRLYIVBIYPPPSOSUBFHNWAHTWTZVUYEUSOEEZXCRWAUIENAVHEPCORWMIUHXREKXCR```We use the [Vigenere online tool](https://www.guballa.de/vigenere-solver) to break the message >

or we eliminate new spaces and lines. Then we break the code of force with the python tool Vigenere-Cipher-Breaker.l.
```bashcat enc.txt | tr -d '\040\011\012\015' > output.txtroot@1v4n:~/CTF/peaCTF2019/crypto/School# git clone https://github.com/drewp41/Vigenere-Cipher-Breaker.gitroot@1v4n:~/CTF/peaCTF2019/crypto/School/Vigenere-Cipher-Breaker# python Vigenere_cipher.pyEnter e to encrypt, or d to decrypt: dEnter ciphertext to decrypt:...(output.txt)Do you know the key to decrypt with? Enter y or n: nKey length is most likely 13Key: redpineapplesPlaintext: mrjonesofthemanorfarmhadlockedthehenhousesforthenightbutwastoodrunktoremembertoshutthepopholeswiththeringoflightfromhislanterndancingfromsidetosidehelurchedacrosstheyardkickedoffhisbootsatthebackdoordrewhimselfalastglassofbeerfromthebarrelinthesculleryandmadehiswayuptobedwheremrsjoneswasalreadysnoringassoonasthelightinthebedroomwentouttherewasastirringandaflutteringallthroughthefarmbuildingswordhadgoneroundduringthedaythatoldmajortheprizemiddlewhiteboarhadhadastrangedreamonthepreviousnightandwishedtocommunicateittotheotheranimalsithadbeenagreedthattheyshouldallmeetinthebigbarnassoonasmrjoneswassafelyoutofthewayoldmajorsohewasalwayscalledthoughthenameunderwhichhehadbeenexhibitedwaswillingdonbeautywassohighlyregardedonthefarmthateveryonewasquitereadytoloseanhourssleepinordertohearwhathehadtosayatoneendofthebigbarnonasortofraisedplatformmajorwasalreadyensconcedonhisbedofstrawunderalanternwhichhungfromabeamhewastwelveyearsoldandhadlatelygrownratherstoutbuthewasstillamajesticlookingpigwithawiseandbenevolentappearanceinspiteofthefactthathistusheshadneverbeencutbeforelongtheotheranimalsbegantoarriveandmakethemselvescomfortableaftertheirdifferentfashionsfirstcamethethreedogsbluebelljessieandpincherandthenthepigswhosettleddowninthestrawimmediatelyinfrontoftheplatformthehensperchedthemselvesonthewindowsillsthepigeonsfluttereduptotheraftersthesheepandcowslaydownbehindthepigsandbegantochewthecudthetwocarthorsesboxerandclovercameintogetherwalkingveryslowlyandsettingdowntheirvasthairyhoofswithgreatcarelestthereshouldbesomesmallanimalconcealedinthestrawcloverwasastoutmotherlymareapproachingmiddlelifewhohadneverquitegotherfigurebackafterherfourthfoalboxerwasanenormousbeastnearlyeighteenhandshighandasstrongasanytwoordinaryhorsesputtogetherawhitestripedownhisnosegavehimasomewhatstupidappearanceandinfacthewasnotoffirstrateintelligencebuthewasuniversallyrespectedforhissteadinessofcharacterandtremendouspowersofworkafterthehorsescamemurielthewhitegoatandbenjaminthedonkeybenjaminwastheoldestanimalonthefarmandtheworsttemperedheseldomtalkedandwhenhediditwasusuallytomakesomecynicalremarkforinstancehewouldsaythatgodhadgivenhimatailtokeepthefliesoffbutthathewouldsoonerhavehadnotailandnofliesaloneamongtheanimalsonthefarmheneverlaughedifaskedwhyhewouldsaythathesawnothingtolaughatneverthelesswithoutopenlyadmittingithewasdevotedtoboxerthetwoofthemusuallyspenttheirsundaystogetherinthesmallpaddockbeyondtheorchardgrazingsidebysideandneverspeakingnwxpsyugbpplrpnlnvalbyrlnzppngbjyewneps```
### Flag`peaCTF{redpineapples}`