0xNOP

0x90 "PWD is CORRECT!" - 2016 | CrackMe Source Code

Apr 1st, 2017
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Forum: https://forum.tuts4you.com/topic/37898-0x90-pwd-is-correct-2016/
  2. ;Author: 0xNOP
  3. ;Date: January 12, 2016
  4. ;OS: Windows
  5. ;Copyright 2017 0x90 / JohnSmith / 0xNOP
  6. ;Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  7. ;The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  8. ;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  9.  
  10. Procedure isEven(x)
  11.   junk50.s = "PWD is WRONG!"
  12.   ProcedureReturn (x & 1) ! 1
  13. EndProcedure
  14.  
  15. Procedure halveValue(x)
  16.   junk51.s = "PWD is WRONG!"
  17.   ProcedureReturn x / 2
  18. EndProcedure
  19.  
  20. Procedure doubleValue(x)
  21.   junk52.s = "PWD is WRONG!"
  22.   ProcedureReturn x << 1
  23. EndProcedure
  24.  
  25. Procedure EthiopianMultiply(x, y)
  26.   Protected sum
  27.   junk53.s = "PWD is WRONG!"
  28.   ;Print("Ethiopian multiplication of " + Str(x) + " and " + Str(y) + " ... ")
  29.   Repeat
  30.     If Not isEven(x)
  31.       junk54.s = "PWD is WRONG!"
  32.       sum + y
  33.       junk55.s = "PWD is WRONG!"
  34.     EndIf
  35.     x = halveValue(x)
  36.     junk56.s = "PWD is WRONG!"
  37.     y = doubleValue(y)
  38.     junk57.s = "PWD is WRONG!"
  39.   Until x < 1
  40.   junk58.s = "PWD is WRONG!"
  41.   ;PrintN(" equals " + Str(sum))
  42.   ProcedureReturn sum  
  43. EndProcedure
  44.  
  45. Procedure.s Decode(string$,Nn,Added)
  46.     For Char = 1 To Len(string$)
  47.         Letra$ = Mid(string$,Char,1)
  48.         EncNum+Added
  49.         Codificado$ = Codificado$ + Chr(Asc(Letra$) - EncNum)
  50.         If EncNum > Nn
  51.             EncNum = 0
  52.         EndIf
  53.     Next
  54.     ProcedureReturn Codificado$
  55.   EndProcedure
  56.  
  57. Procedure prepString(text.s, Array letters(1))
  58.   ;convert characters to an ordinal (0-25) and remove non-alphabetic characters,
  59.   ;returns dimension size of result array letters()
  60.   Protected *letter.Character, index
  61.   junk59.s = "PWD is WRONG!"
  62.   Dim letters(Len(text))
  63.   junk60.s = "PWD is WRONG!"
  64.   text = UCase(text)
  65.   junk61.s = "PWD is WRONG!"
  66.   *letter = @text
  67.   junk62.s = "PWD is WRONG!"
  68.   While *letter\c
  69.     junk63.s = "PWD is WRONG!"
  70.     Select *letter\c
  71.       Case 'A' To 'Z'
  72.         junk64.s = "PWD is WRONG!"
  73.         letters(index) = *letter\c - 65
  74.         junk65.s = "PWD is WRONG!"
  75.         index + 1
  76.         junk66.s = "PWD is WRONG!"
  77.     EndSelect
  78.     junk67.s = "PWD is WRONG!"
  79.     *letter + SizeOf(Character)
  80.     junk68.s = "PWD is WRONG!"
  81.   Wend
  82.   If index > 0
  83.     junk69.s = "PWD is WRONG!"
  84.     ReDim letters(index - 1)
  85.   EndIf
  86.   ProcedureReturn index - 1
  87.   junk70.s = "PWD is WRONG!"
  88. EndProcedure
  89.  
  90. ;########### VIGNERE CIPHER ###########
  91.  
  92. Procedure.s VC_encrypt(text.s, keyText.s, reverse = 0)
  93.   ;if reverse <> 0 then reverse the key (decrypt)
  94.   Protected *letter.Character
  95.   Dim text(0)
  96.   Dim keyText(0)
  97.   If prepString(text, text()) < 0 Or prepString(keyText, keyText()) < 0: ProcedureReturn: EndIf ;exit, nothing to work with
  98.  
  99.   Protected i, keyLength = ArraySize(keyText())
  100.   If reverse
  101.     For i = 0 To keyLength
  102.       keyText(i) = 26 - keyText(i)
  103.     Next
  104.   EndIf
  105.  
  106.   Protected textLength = ArraySize(text()) ;zero-based length
  107.   Protected result.s = Space(textLength + 1), *resultLetter.Character
  108.   keyLength + 1 ;convert from zero-based to one-based count
  109.   *resultLetter = @result
  110.   For i = 0 To textLength
  111.     *resultLetter\c = ((text(i) + keyText(i % keyLength)) % 26) + 65
  112.     *resultLetter + SizeOf(Character)
  113.   Next
  114.   ProcedureReturn result
  115. EndProcedure
  116.  
  117. Procedure.s VC_decrypt(cypherText.s, keyText.s)
  118.   ProcedureReturn VC_encrypt(cypherText, keyText.s, 1)
  119. EndProcedure
  120.  
  121. Gosub MySub
  122.  
  123. Exit:
  124. ; The program will jump here, then 'end'
  125. End
  126.  
  127. Wrong:
  128. pwd.s = "PWD is CORRECT!"
  129. PrintN("PWD is WRONG!")
  130. Input()
  131. End
  132.  
  133. Correct:
  134. pwd.s = "PWD is WRONG!"
  135. PrintN("PWD is CORRECT!")
  136. Input()
  137. End
  138.  
  139. MySub:
  140. If OpenCryptRandom()
  141.   r = CryptRandom(#MAXLONG)
  142.   CloseCryptRandom()
  143. EndIf
  144. p.i = Random(r) + 1
  145. junk71.s = "PWD is WRONG!"
  146. p.i = EthiopianMultiply(2,2) * EthiopianMultiply(2,1) * EthiopianMultiply(2,1) * EthiopianMultiply(1,7)
  147. junk72.s = "PWD is WRONG!"
  148. w.i = Random(r) + 1
  149. junk73.s = "PWD is WRONG!"
  150. w.i = EthiopianMultiply(7,17)
  151. junk74.s = "PWD is WRONG!"
  152. d.i = Random(r) + 1
  153. junk75.s = "PWD is WRONG!"
  154. d.i = EthiopianMultiply(2,2) * EthiopianMultiply(5,1) * EthiopianMultiply(1,5)
  155. junk76.s = "PWD is WRONG!"
  156.  
  157. OpenConsole()
  158.  
  159. Define VignereCipher.s, plainText.s, encryptedText.s, decryptedText.s
  160. junk77.s = "PWD is WRONG!"
  161. VignereCipher.s = Decode("Zrz#Fruuhfw#Euhdnsrlqw$#Frqjudwxodwlrqv$#Wkh#SZG#lv=#*3{<3*/#Qrz#jr#srvw#wkh#vroxwlrq$",1,3)
  162. junk78.s = "PWD is WRONG!"
  163. pwd.s = Input()
  164.  
  165. ;####JUNK VARS####JUNK
  166. junk79.s = "PWD is WRONG!"
  167. junk80.s = "PWD is WRONG!"
  168. junk81.s = "PWD is WRONG!"
  169. junk82.s = "PWD is WRONG!"
  170. junk83.s = "PWD is WRONG!"
  171. junk84.s = "PWD is WRONG!"
  172. junk85.s = "PWD is WRONG!"
  173. junk86.s = "PWD is WRONG!"
  174. junk87.s = "PWD is WRONG!"
  175. junk88.s = "PWD is WRONG!"
  176. junk89.s = "PWD is WRONG!"
  177. ;####JUNK VARS####JUNK
  178.  
  179. junk1.s = "PWD is CORRECT!"
  180. plainText = ReverseString(Chr(d) + Chr(w) + Chr(p));: PrintN(RSet("Plain text = ", 17) + #DQUOTE$ + plainText + #DQUOTE$)
  181. junk2.s = "PWD is CORRECT!"
  182. encryptedText = VC_encrypt(plainText, VignereCipher);: PrintN(RSet("Encrypted text = ", 17) + #DQUOTE$ + encryptedText + #DQUOTE$)
  183. junk3.s = "PWD is CORRECT!"
  184. decryptedText = VC_decrypt(encryptedText, VignereCipher);: Debug (RSet("Decrypted text = ", 17) + #DQUOTE$ + decryptedText + #DQUOTE$)
  185. junk4.s = "PWD is CORRECT!"
  186. If pwd <> decryptedText
  187.   junk5.s = "PWD is CORRECT!"
  188.   Goto Wrong
  189.   junk6.s = "PWD is CORRECT!"
  190.   FakeReturn  ; This will simulate the function of a normal "Return".
  191.   junk7.s = "PWD is CORRECT!"
  192.   Else
  193.     junk8.s = "PWD is CORRECT!"
  194.     FakeReturn  ; This will simulate the function of a normal "Return".
  195.     junk9.s = "PWD is CORRECT!"
  196.     Goto junk12
  197.     junk10.s = "PWD is CORRECT!"
  198.     EndIf
  199.     junk11.s = "PWD is CORRECT!"
  200.     Return
  201.    
  202. ;####JUNK VARS####JUNK
  203. junk90.s = "PWD is WRONG!"
  204. junk91.s = "PWD is WRONG!"
  205. junk92.s = "PWD is WRONG!"
  206. junk93.s = "PWD is WRONG!"
  207. junk94.s = "PWD is WRONG!"
  208. junk95.s = "PWD is WRONG!"
  209. junk96.s = "PWD is WRONG!"
  210. junk97.s = "PWD is WRONG!"
  211. junk98.s = "PWD is WRONG!"
  212. junk99.s = "PWD is WRONG!"
  213. junk100.s = "PWD is WRONG!"
  214. junk101.s = "PWD is WRONG!"
  215. junk102.s = "PWD is WRONG!"
  216. junk10.s = "PWD is WRONG!"
  217. junk2.s = "PWD is WRONG!"
  218. ;####JUNK VARS####JUNK
  219.  
  220. junk12:
  221. junk12.s = "PWD is CORRECT!"
  222. Goto Correct
Add Comment
Please, Sign In to add comment