예제 #1
0
 def test_basics_quickbrownfox(self):
     """
     This returns true becaue by default chi squared returns true so long as it's less than 10 items it's processed
     """
     lc = LanguageChecker()
     result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
     self.assertEqual(result, True)
예제 #2
0
 def test_hex_spaces_yes(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     a = "68656c6c6f206f 6c 69 76 69 61 20 69 20 72 65 61 6c 6c 79 20 6c 69 6b 65 20 79 6f 75 72 20 64 6f 67"
     a = a.replace(" ", "")
     result = ep.decrypt(a)
     self.assertEqual(result['IsPlaintext?'], True)
예제 #3
0
 def test_binary_spaces_yes(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     result = ep.decrypt(
         "01001000 01100101 01101100 01101100 01101111 00100000 01001001 00100000 01101100 01101001 01101011 01100101 00100000 01100100 01101111 01100111 01110011 00100000 01100001 01101110 01100100 00100000 01100011 01100001 01110100 01110011"
     )
     self.assertEqual(result['IsPlaintext?'], True)
예제 #4
0
 def test_caesar_english_comparison(self):
     lc = LanguageChecker()
     c = Caesar(lc)
     result = c.decrypt(
         "Pm ol ohk hufaopun jvumpkluaphs av zhf, ol dyval pa pu jpwoly, aoha pz, if zv johunpun aol vykly vm aol slaalyz vm aol hswohila, aoha uva h dvyk jvbsk il thkl vba."
     )
     self.assertEqual(result['IsPlaintext?'], True)
예제 #5
0
 def test_caesar_yes(self):
     """Checks to see if it returns True (it should)"""
     lc = LanguageChecker()
     c = Caesar(lc)
     result = c.decrypt(
         "uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg"
     )
     self.assertEqual(result['IsPlaintext?'], True)
예제 #6
0
 def test_caesar_what_is_this(self):
     """Checks to see if it returns True (it should)
     Ok so this returns false becaues caesar only does up to 25, not 26
     so plaintext returns false!"""
     lc = LanguageChecker()
     c = Caesar(lc)
     result = c.decrypt("?")
     self.assertEqual(result['IsPlaintext?'], False)
예제 #7
0
 def test_caesar_english_comparison_yeet(self):
     lc = LanguageChecker()
     c = Caesar(lc)
     result = c.decrypt(
         "Onrs hr mnv knbjdc enq fnnc. Sgzmj xnt zkk enq ozqshbhozshmf, zmc okdzrd bnmshmtd sn unsd enq sgd itcfdldms xnt zfqdd vhsg. Zr nsgdq trdqr gzud onhmsdc nts, sgdqd hr zcchshnmzk hmenqlzshnm sgzs NO gzr kdes nts ne sgdhq nqhfhmzk onrs sgzs sgdx gzud zccdc hm sgdhq bnlldmsr, rn okdzrd qdzc etqsgdq sn fds sgd etkk rbnod ne sgd rhstzshnm."
     )
     self.assertEqual(
         result['Plaintext'],
         "Post is now locked for good. Thank you all for participating, and please continue to vote for the judgement you agree with. As other users have pointed out, there is additional information that OP has left out of their original post that they have added in their comments, so please read further to get the full scope of the situation."
         .lower())
예제 #8
0
    def test_integration_addition(self):
        """
        Makes sure you can add 2 lanuggae objecs together
        """
        lc = LanguageChecker()
        result = lc.checkLanguage("hello my darling")

        lc2 = LanguageChecker()
        result = lc.checkLanguage("sad as dasr as s")

        temp = lc.getChiScore()
        temp2 = lc2.getChiScore()
        temp3 = temp + temp2
        lc3 = lc + lc2

        self.assertAlmostEqual(lc3.getChiScore(), temp3)
예제 #9
0
파일: main.py 프로젝트: ra2003/Ciphey
    def __init__(self, text, cipher):
        # general purpose modules
        self.ai = NeuralNetwork()
        self.lc = LanguageChecker()
        self.mh = mathsHelper.mathsHelper()

        # the one bit of text given to us to decrypt
        self.text = text

        # the decryptor components
        self.basic = BasicParent(self.lc)
        self.hash = HashParent()
        self.encoding = EncodingParent(self.lc)

        self.level = 1
        self.sickomode = False
        self.cipher = cipher
예제 #10
0
 def test_chi_maxima_true(self):
     """
     This returns false because s.d is not over 1 as all inputs are English
     """
     lc = LanguageChecker()
     result = lc.checkLanguage("The quick brown fox jumped over the lazy dog")
     result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.")
     result = lc.checkLanguage("Hypertext Transfer Protocol (HTTP) parameters, including HTTP headers, allow the client and the server to pass additional information with the request or the response.")
     result = lc.checkLanguage("HTTP parameters and headers can often reveal information about how a web application is transmitting data and storing cookies. Clients send parameters including the user agent of the browser.")
     result = lc.checkLanguage("You probably build websites and think your shit is special. You think your 13 megabyte parallax-ative home page is going to get you some f*****g Awwward banner you can glue to the top corner of your site. You think your 40-pound jQuery file and 83 polyfills give IE7 a boner because it finally has box-shadow. Wrong, m**********r. Let me describe your perfect-ass website:")
     result = lc.checkLanguage("You. Are. Over-designing. Look at this shit. It's a motherfucking website. Why the f**k do you need to animate a f*****g trendy-ass banner flag when I hover over that useless piece of shit? You spent hours on it and added 80 kilobytes to your f*****g site, and some m**********r jabbing at it on their iPad with fat sausage fingers will never see that shit. Not to mention blind people will never see that shit, but they don't see any of your shitty shit.")
     result = lc.checkLanguage("This entire page weighs less than the gradient-meshed facebook logo on your f*****g Wordpress site. Did you seriously load 100kb of jQuery UI just so you could animate the f*****g background color of a div? You loaded all 7 fontfaces of a shitty webfont just so you could say at 100px height at the beginning of your site? You piece of shit.")
     result = lc.checkLanguage("You dumbass. You thought you needed media queries to be responsive, but no. Responsive means that it responds to whatever motherfucking screensize it's viewed on. This site doesn't care if you're on an iMac or a motherfucking Tamagotchi.")
     result = lc.checkLanguage("Like the man who's never grown out his beard has no idea what his true natural state is, you have no f*****g idea what a website is. All you have ever seen are shitty skeuomorphic bastardizations of what should be text communicating a f*****g message. This is a real, naked website. Look at it. It's f*****g beautiful.")
     result = lc.checkLanguage("Have you guys noticed that sometimes the foremost academic websites with lots of scientific information tend to look like this?")
     result = lc.checkLanguage("That's because academics do Save as Website from Microsoft Word and call it a day.")
     result = lc.checkLanguage("In case anyone was interested, f**k is used 33 times in the page.")
     result = lc.checkLanguage("Hi! I just checked this URL and it appeared to be unavailable or slow loading (Connection timed out after 8113 milliseconds). Here are some mirrors to try:")
     result = lc.checkLanguage("There can only be one way to make this work for real and I really do enjoy the long thought out process of drinking milk")
     self.assertEqual(result, False)
예제 #11
0
 def test_basics(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("Hello my name is new and this is an example of some english text")
     self.assertEqual(result, True)
예제 #12
0
 def test_morse(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     a = ".... . .-.. .-.. --- / -- -.-- / -. .- -- . / .. ... / -... .-. .- -. -.. --- -."
     result = ep.decrypt(a)
     self.assertEqual(result['IsPlaintext?'], True)
예제 #13
0
 def test_ascii(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     a = "68 65 6C 6C 6F 20 64 6F 67"
     result = ep.decrypt(a)
     self.assertEqual(result['IsPlaintext?'], True)
예제 #14
0
 def test_integration_unusual_7(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999")
     self.assertEqual(result, False)
예제 #15
0
 def test_integration_unusual_7(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("")
     self.assertEqual(result, False)
예제 #16
0
 def test_base64_spaces_yes(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     result = ep.decrypt("SGVsbG8gSSBsaWtlIGRvZ3MgYW5kIGNhdHM=")
     self.assertEqual(result['IsPlaintext?'], True)
예제 #17
0
 def test_basic_parent_reverse_yes_2(self):
     lc = LanguageChecker()
     bp = BasicParent(lc)
     result = bp.decrypt("sevom ylpmis rac eht ciffart ruoy lla gnillenut si hcihw redivorp NPV a ekilnU")
     self.assertEqual(result['IsPlaintext?'], True)
예제 #18
0
 def test_basic_parent_caesar_yes(self):
     lc = LanguageChecker()
     bp = BasicParent(lc)
     result = bp.decrypt("uryyb zl sngure uryyb zl zbgure naq v ernyyl qb yvxr n tbbq ratyvfu oernxsnfg")
     self.assertEqual(result['IsPlaintext?'], True)
예제 #19
0
 def test_chi_maxima_true(self):
     """
     This returns false because s.d is not over 1 as all inputs are English
     """
     lc = LanguageChecker()
     result = lc.checkLanguage("sa dew fea dxza dcsa da fsa d")
     result = lc.checkLanguage("df grtsf a sgrds fgserwqd")
     result = lc.checkLanguage("fd sa fe safsda srmad sadsa d")
     result = lc.checkLanguage(" oihn giuhh7hguygiuhuyguyuyg ig iug iugiugiug")
     result = lc.checkLanguage("oiuhiuhiuhoiuh7 a opokp[poj uyg ytdra4efriug oih kjnbjhb jgv")
     result = lc.checkLanguage("r jabbi tb y jyg ygiuygytff  u0")
     result = lc.checkLanguage("ld oiu oj uh t t er s d gf hg g  h h")
     result = lc.checkLanguage("posa   idijdsa ije i vi ijerijofdj ouhsaf oiuhas  oihd ")
     result = lc.checkLanguage("Likwew e wqrew rwr safdsa dawe r3d hg jyrt dwqefp ;g;;' [ [sadqa ]].")
     result = lc.checkLanguage("Her hyt e jytgv  urjfdghbsfd c   ")
     result = lc.checkLanguage("CASSAE X T H WAEASD AFDG TERFADDSFD")
     result = lc.checkLanguage("das te y we fdsbfsd fe a ")
     result = lc.checkLanguage("d pa pdpsa ofoiaoew ifdisa ikrkasd s")
     result = lc.checkLanguage("My friend is a really nice people who really enjoys swimming, dancing, kicking, English.")
     self.assertEqual(result, True)
예제 #20
0
 def test_caesar_no(self):
     """Checks to see if it returns True (it should)"""
     lc = LanguageChecker()
     c = Caesar(lc)
     result = c.decrypt("o iozad iikwas")
     self.assertEqual(result['IsPlaintext?'], False)
예제 #21
0
 def test_integration_unusual_one(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("HELLO MY NAME IS BRANDON AND I LIKE DOLLAR")
     self.assertEqual(result, True)
예제 #22
0
 def test_integration_unusual_three(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("password")
     self.assertEqual(result, True)
예제 #23
0
 def test_basic_parent_reverse_yes(self):
     lc = LanguageChecker()
     bp = BasicParent(lc)
     result = bp.decrypt("tsafkaerb hsilgne doog a ekil od yllaer i dna rehtom ym olleh rehtaf ym olleh")
     self.assertEqual(result['IsPlaintext?'], True)
예제 #24
0
 def test_basics_german(self):
     lc = LanguageChecker()
     result = lc.checkLanguage("hallo keine lieben leute nach")
     self.assertEqual(result, True)
예제 #25
0
 def test_viginere_yes(self):
     lc = LanguageChecker()
     bp = BasicParent(lc)
     result = bp.decrypt("""Adiz Avtzqeci Tmzubb wsa m Pmilqev halpqavtakuoi, lgouqdaf, kdmktsvmztsl, izr xoexghzr kkusitaaf. Vz wsa twbhdg ubalmmzhdad qz hce vmhsgohuqbo ox kaakulmd gxiwvos, krgdurdny i rcmmstugvtawz ca tzm ocicwxfg jf "stscmilpy" oid "uwydptsbuci" wabt hce Lcdwig eiovdnw. Bgfdny qe kddwtk qjnkqpsmev ba pz tzm roohwz at xoexghzr kkusicw izr vrlqrwxist uboedtuuznum. Pimifo Icmlv Emf DI, Lcdwig owdyzd xwd hce Ywhsmnemzh Xovm mby Cqxtsm Supacg (GUKE) oo Bdmfqclwg Bomk, Tzuhvif'a ocyetzqofifo ositjm. Rcm a lqys ce oie vzav wr Vpt 8, lpq gzclqab mekxabnittq tjr Ymdavn fihog cjgbhvnstkgds. Zm psqikmp o iuejqf jf lmoviiicqg aoj jdsvkavs Uzreiz qdpzmdg, dnutgrdny bts helpar jf lpq pjmtm, mb zlwkffjmwktoiiuix avczqzs ohsb ocplv nuby swbfwigk naf ohw Mzwbms umqcifm. Mtoej bts raj pq kjrcmp oo tzm Zooigvmz Khqauqvl Dincmalwdm, rhwzq vz cjmmhzd gvq ca tzm rwmsl lqgdgfa rcm a kbafzd-hzaumae kaakulmd, hce SKQ. Wi 1948 Tmzubb jgqzsy Msf Zsrmsv'e Qjmhcfwig Dincmalwdm vt Eizqcekbqf Pnadqfnilg, ivzrw pq onsaafsy if bts yenmxckmwvf ca tzm Yoiczmehzr uwydptwze oid tmoohe avfsmekbqr dn eifvzmsbuqvl tqazjgq. Pq kmolm m dvpwz ab ohw ktshiuix pvsaa at hojxtcbefmewn, afl bfzdakfsy okkuzgalqzu xhwuuqvl jmmqoigve gpcz ie hce Tmxcpsgd-Lvvbgbubnkq zqoxtawz, kciup isme xqdgo otaqfqev qz hce 1960k. Bgfdny'a tchokmjivlabk fzsmtfsy if i ofdmavmz krgaqqptawz wi 1952, wzmz vjmgaqlpad iohn wwzq goidt uzgeyix wi tzm Gbdtwl Wwigvwy. Vz aukqdoev bdsvtemzh rilp rshadm tcmmgvqg (xhwuuqvl uiehmalqab) vs sv mzoejvmhdvw ba dmikwz. Hpravs rdev qz 1954, xpsl whsm tow iszkk jqtjrw pug 42id tqdhcdsg, rfjm ugmbddw xawnofqzu. Vn avcizsl lqhzreqzsy tzif vds vmmhc wsa eidcalq; vds ewfvzr svp gjmw wfvzrk jqzdenmp vds vmmhc wsa mqxivmzhvl. Gv 10 Esktwunsm 2009, fgtxcrifo mb Dnlmdbzt uiydviyv, Nfdtaat Dmiem Ywiikbqf Bojlab Wrgez avdw iz cafakuog pmjxwx ahwxcby gv nscadn at ohw Jdwoikp scqejvysit xwd "hce sxboglavs kvy zm ion tjmmhzd." Sa at Haq 2012 i bfdvsbq azmtmd'g widt ion bwnafz tzm Tcpsw wr Zjrva ivdcz eaigd yzmbo Tmzubb a kbmhptgzk dvrvwz wa efiohzd.""")
     self.assertEqual(result['IsPlaintext?'], True)
예제 #26
0
 def test_english_yes(self):
     lc = LanguageChecker()
     ep = EncodingParent(lc)
     result = ep.decrypt("eW91ciB0ZXh0")
     self.assertEqual(result['IsPlaintext?'], True)