CoolShell decrypts the game's WriteUp

Source: Internet
Author: User

CoolShell decrypts the game's WriteUp
Game address: http://fun.coolshell.cn/

A very interesting little game, and I am also eager to talk about it.

0-Fuck your brain

Address: http://fun.coolshell.cn/first.html

After going in, I found some messy things. The following line prompts: My brain has been fucked. I learned through BaiDu that this is a programming language, it's called Brain Fuck (I won't say that when I see this really sweaty), and then find the compiler on the Internet

Compiler code

 

 
#include <stdio.h>int  p, r, q;char a[5000], f[5000], b, o, *s=f;void interpret(char *c){    char *d;    r++;    while( *c ) {        switch(o=1,*c++) {            case '<': p--;        break;             case '>': p++;        break;            case '+': a[p]++;     break;            case '-': a[p]--;     break;            case '.': putchar(a[p]); fflush(stdout); break;            case ',': a[p]=getchar();fflush(stdout); break;            case '[':                for( b=1,d=c; b && *c; c++ )                b+=*c=='[', b-=*c==']';                if(!b) {                    c[-1]=0;                    while( a[p] )                    interpret(d);                    c[-1]=']';                    break;                }            case ']':                puts("UNBALANCED BRACKETS"), exit(0);            case '#':  if(q>2)                printf("- - - - - - - - - -/n%*s/n",*a,a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],3*p+2,"^");                break;            default: o=0;        } if( p100)            puts("RANGE ERROR"), exit(0);    }    r--;}main(int argc,char *argv[]){    FILE *z;    q=argc;    if(z=fopen(argv[1],"r")) { while( (b=getc(z)) > 0 )            *s++=b;        *s=0;        interpret(f);    }}

 

Save the compiler code as test. c.

Then compile

gcc test.c -o test

The resulting test is the language compiler. There are two warnings during compilation. Sorry, I ignored this Warning...

Then save the Brain Fuck code as test. bf.

Run the command in shell to get the answer.

./test test.bf

To obtain the first-level address.

1-Multiply

Address: http://fun.coolshell.cn/welcome.html

First, we can see a sequence.

2,3,6,18,108,? 

Then the algorithm X * Y is given above. after observing the sequence, we can know that the last digit is the product of the first two numbers, so we can get it? Location: 18*108 = 1944

Open hosts

Find another number and see another prompt.

What is the meaning of life, the universe and everything?

Go to Google and find a prompt in the Wiki.

According to Douglas Adams's novel "Galaxy roaming Guide", 42 is "the ultimate answer to life, the universe, and everything ". Therefore, 42 is often used to pay tribute to this work, for example:

If you enter the answer to life, the universe, and everything on Google, Google will directly answer 42-and still calculate it using Google's calculator.

You can obtain Y = 42.

Enter http://fun.coolshell.cn/42.htmlto verify the token, and thenX\*Y=1944\*42=81648

You have to close the address 81648.html

2-Keyboard

Address: http://fun.coolshell.cn/81648.html

First, there is a huge keyboard, but it seems to be a problem. Some keys on the keyboard and the current qwerty keyboard are somewhat different. There is a hyperlink on the figure, I learned that this type of keyboard is called a Dvorak keyboard, which is designed to increase the typing speed faster, it is usually because of the high usage rate of programmers and typewriters (the two occupations are almost the same ....)

First, replace the layout of the Dvorak keyboard with the layout of QWERTY,

Black: Dvorak layout; Red: QWERTY Layout

Display the prompt in QWERTY layout.

This Code

// This is the code macb ()? Lpcbyu (& gbcq/_ \ 021% ocq \ 012 \ 0 _ = w (gbcq)/_ dak. _ =} _ ugb _ [0q60) s +

This Code

// This is the code main () {printf (& unix ["\ 021% six \ 012 \ 0"], (unix) in the QWERTY layout) ["have"] + "fun"-0x60 );}

Compile the code and get a program. Run the unix Command to return the result,

3-QR Code

Address: http://fun.coolshell.cn/unix.html

First, a QR code is displayed. You can use the QR code identification tool to obtain the following code table,

The character conversion table is

[abcdefghijklmnopqrstuvwxyz] <=> [pvwdgazxubqfsnrhocitlkeymj]

Then, convert the characters and use the python language. The source code is

#Thanks For Code by Mutaliskcontent_de = '''Wxgcg txgcg ui p ixgff, txgcg ui p epm. I gyhgwt mrl lig txg ixgff wrsspnd tr irfkg txui \hcrvfgs, nre, hfgpig tcm liunz txg crt13 ra "ixgff" tr gntgc ngyt fgkgf.'''.lower()content = ''keychr_de = 'pvwdgazxubqfsnrhocitlkeymj'keychr = 'abcdefghijklmnopqrstuvwxyz'for s_chr in content_de:    if s_chr in keychr_de:        content = content + keychr[keychr_de.index(s_chr)]    else:        content = content + s_chrprint content

After conversion

The conversion result is: Where there is a shell, there is a way. I recommend CT you use the shell command to solve this problem, now, please try using the rot13 of "shell" to enter next level.

As long as there is a shell, there will be a solution. I hope you can use the shell command to solve this problem. Now, please use the rot13 tool.

Then open the url: http://fun.coolshell.cn/shell.html

Get a new prompt: You really are close, but the "shell" is not the final answer.

But shell is not the final answer.

Then use rot13 to encrypt the shell to get the string, furyy, pass

echo 'shell'|tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
4-cat

Address: http://fun.coolshell.cn/furyy.html

First read the prompt, prompting that the answer is at the bottom of the source code and pulled to the bottom, stunned by the TAT

What is this TM...

Then I took a closer look at the title Palindrome and some on the left. We can see that this is based on the background, and I wrote a regular expression for me.

(\[A-Z])([0-9])[a-z\](\2)(\1)|(\[0-9])([A-Z])[a-z\](\6)(\5) 

Then, pull the comments in html to http://tool.oschina.net/regex, and the result is displayed.

Get these replies

A total of nine matches are found:

E1v1E4FaF49XrX9O3i3O0MaM04GbG4M5l5M0WeW0Y0s0Y

Then, observe the background of the webpage subject, and you can see that cat is concatenated from the string in the center of the background. Then, the matching intermediate character is spliced into key: variables.

5-variables

Address: http://fun.coolshell.cn/variables.html

This page prompts you to continue running. You will find the expected result.

Click the image to enter a url.

I used Seraph to write a small program and ran it in seconds.

dim afunction main    start = "2014"    a = GetHTTP("http://fun.coolshell.cn/n/"&start)    Print(a)    for ForCount = 1 to 999999        CStr(a)        a = GetHTTP("http://fun.coolshell.cn/n/"& a )        Print(a)    nextend function

And the key is tree.

6-tree

Address: http://fun.coolshell.cn/tree.html

We can see from the figure that this is a binary tree ....

It took three hours to restore the tree. The source image is as follows:

Let's talk about it. This complicated tree is the rhythm of death.

With the tree structure, you can obtain the Pre-order ):

Z, W, B, T, g, h, H, V, 3, o, P, p, 8, L, F, G, u, A, f, n, 0, 1, r, m, w, x, J, 7, e, I, Q, Y, Z, 2, 5, v, K, q, k, 9, y, C, B, N, D, U, 4, l, c, M, I, E, a, j, 6, S, R, o, X, s, d

The deepest path of the binary tree is z, W, p, 8, L, G, n, 0, 1, w, x, J, and 7.

Then, use the deepest path as the pass to bring openssl to decrypt the base64 string to obtain the plaintext.

echo U2FsdGVkX1+gxunKbemS2193vhGGQ1Y8pc5gPegMAcg=|openssl enc -aes-128-cbc -a -d -pass pass:zWp8LGn01wxJ7 

The obtained plaintext is nqueens.

7-N Queen

Address: http://fun.coolshell.cn/nqueens.html

The famous N queen problem in history, the example given is eight queens, ask 9 queens, the code is from right to left, the Queen in turn in the ordinate order

I found a copy of the N queen's algorithm code on the Internet and got 352 solutions to the 9 Queen's problem. Then I modified the code to generate the required code and get 352 codes.

/*** N queen question * date: 2010-3-12 * author: lee * change: LinE * change date: 2014-8-4 */# include <stdio. h> # include <stdlib. h> # include <math. h> # define QUEEN 9 // the number of the queen # define INITIAL-10000 // defines the initial value of the board // containerint a [QUEEN]; // check if the queen can be placed on the positionint valid (int row, int col); // initialize the boardvoid clear (); // print the resultvoid p Rint (); // run the n-queen program void queen (); int main (void) {clear (); queen (); return 0;} void clear () {int * p; for (p = a; p <a + QUEEN; ++ p) {* p = INITIAL ;}} void print () {int I, j, l; for (I = 0; I <QUEEN; ++ I) {for (j = 0; j <QUEEN; ++ j) {if (a [I]! = J) {// printf ("% c ",'. ') ;}else {l = j + 1; printf ("% d", l); // printf ("% c ",'#');}}} printf ("\ n"); // printf ("---------------------------------------------- \ n");} int valid (int row, int col) {int I; for (I = 0; I <QUEEN; ++ I) {if (a [I] = col | abs (I-row) = abs (a [I]-col )) return 0;} return 1;} void queen () {int n = 0; int I = 0, j = 0; while (I <QUEEN) {while (j <QUEEN) {if (valid (I, j) {// test if the queen can be placed on the position a [I] = j; // place the queen on the next line j = 0; break;} else {// if not, check the next position ++ j ;}} if (a [I] = INITIAL) {// if the current queen can't find its place if (I = 0) // and this is the first line, then program end break; else {// else backtrack -- I; j = a [I] + 1; a [I] = INITIAL; continue ;}} if (I = QUEEN-1) {// already got a solution, print the result // printf ("answer % d: \ n", ++ n ); print (); // _ sleep (600); j = a [I] + 1; a [I] = INITIAL; continue;} ++ I; // go on to place the queen on the next line if has any more }}

After compiling the program, the execution result is redirected to code.txt for the next step.

gcc queen.c -o queen./queen>code.txt

Then write a php script to crack the resulting solution.

<? Php $ f = fopen ("/root/Desktop/test/code.txt", "r"); $ passwd = "zWp8LGn01wxJ7"; $ hash = "break"; while (! Feof ($ f) {$ code = fgets ($ f); if (sha1 ($ passwd. $ code) ===$ hash) {// because fgets comes with a line break, you do not need to add "\ n" echo $ code ;}} fclose ($ f)?>

8-Excel Column

Address: http://fun.coolshell.cn/953172864.html

I feel that this question has little to do with Excel, and it is mainly a power operation. This operation is similar to hexadecimal. It can be regarded as a 26-hexadecimal to 10-hexadecimal, first, find the position of each letter in the alphabet.

C—-3  O—-15  L—-12  S—-19  H—-8  E—-5  

Then list the algorithms and calculate the numbers of the COOLSHELL and SHELL in decimal format.

For more information about the algorithm, see http://www.cnblogs.com/lavezhang/archive/2012/05/14/2499000.html.

COOLSHELL = 3*26^8+15*26^7+15*26^6+12*26^5+19*26^4+8*26^3+5*26^2+12*26^1+12*26^0 = 751743486376    SHELL = 19*26^4+8*26^3+5*26^2+12*26^1+12*26^0 = 8826856

I wrote a small C language program and found that the value was too large to overflow. After changing the size of the program, I had to overflow the TAT. Later, my friend asked me to drop the formula into Google. The omnipotent Google helped me calculate the answer.

Direct settlement result

COOLSHELL / SHELL = 85165  

Then calculate the remainder of the divisor for this number loop. Each step takes only the integer part, and the answer is immediately displayed.

// Single-digit calculation 85165/26 = 327585165% 26 = 15 // O // 10-digit calculation 3275/26 = 125 3275% 26 = 25 // Y // 125/26-bit calculation 125% = 4 26 = 21 // U // 4/26 = 0 4% 26 = 4 // D

The final result is DUYO. Later, I wrote a python applet to implement this process.

import mathCOOLSHELL = 3*26**8+15*26**7+15*26**6+12*26**5+19*26**4+8*26**3+5*26**2+12*26**1+12*26**0SHELL = 19*26**4+8*26**3+5*26**2+15*26**1+15*26**0print 'COOLSHELL=',COOLSHELLprint 'SHELL=',SHELLNUM = int(COOLSHELL / SHELL) + 1print 'COOLSHELL / SHELL=',NUMtemp = NUMa = temp / 26b = temp % 26c4 = chr( b + 64)print 'a=',aprint 'b=',bprint c4temp = aa = temp / 26b = temp % 26c3 = chr( b + 64)print 'a=',aprint 'b=',bprint c3temp = aa = temp / 26b = temp % 26c2 = chr( b + 64)print 'a=',aprint 'b=',bprint c2temp = aa = temp / 26b = temp % 26c1 = chr( b + 64)print 'a=',aprint 'b=',bprint c1print 'Pass is :',c1+c2+c3+c4
9-Fraternal Organisation

Address: http://fun.coolshell.cn/DUYO.html

First, read the prompt, indicating that if you can find the relationship between the above images, it will be very easy

Then let the picture DOWN. pigpens is on the left and Freemasonry is on the right)

Search for these two keywords to get an associated word, pigsty password, and then translate the text into plain text based on the translation diagram of Pigsty password.

This figure shows the ry password ciphertext table

In comparison to the above question, we can quickly translate the plaintext of the password to helloworld.

After that, the game stops and passes the customs clearance.

Customs clearance certificate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.