# homepage:misc:100pts  
Hmm wasnt the homepage logo rainbow before? I wonder how it works...  
[https://downunderctf.com](https://downunderctf.com/)  
Hint  
01101000 01100001 01110110 01100101 00100000 01111001 01101111 01110101
00100000 01100011 01101111 01101110 01110011 01101001 01100100 01100101
01110010 01100101 01100100 00100000 01100010 01101001 01101110 01100001
01110010 01111001 00111111

# Solution  
トップページが問題のようだ。  
DownUnderCTF  
[site1.png](site/site1.png)  
マウスオーバーによってロゴの色が変わる。  
[site2.png](site/site2.png)  
ソースを見るとsplash.jsなるファイルがあった。  
中に以下のような記述がある。  
```JavaScript  
~~~  
function reset(elem) {  
return function() {  
elem.style.fill = "";  
}  
}  
const lol =
"00101000000010000010111101100001101001011101000101101110100001100011111101101010"
+  
"1010001111000111101000110010000001000000010010001000011111011101001111101001110111101010"
+  
"0110011110010111100011011110001010000010001100110110000101011001110101010001011101001001"
+  
"0110000011011110001010110011001011111001110010011101100011110000110111111001000011010101"
+  
"0100000000101000111110101000111001111100111000010001000100110";

document.querySelectorAll("#logo circle").forEach(function (c, k) {  
c.addEventListener("mouseover", function (e) {  
e.target.style.fill = lol[k] === "0" ? "#005248" : "#C3FCF1";  
})  
});  
~~~  
```  
そのままASCIIには変換できないようだ。  
というのも、ロゴの点はこのビット順に着色されているが、cxとxyで座標が指定されている。  
以下のdot.pyで座標順にビットを並び替える。  
ファイルlogo.txtにはhtmlのロゴ部分を抜き出して記述した。  
```python:dot.py  
import re  
from operator import itemgetter

lol =
"00101000000010000010111101100001101001011101000101101110100001100011111101101010"\  
"1010001111000111101000110010000001000000010010001000011111011101001111101001110111101010"\  
"0110011110010111100011011110001010000010001100110110000101011001110101010001011101001001"\  
"0110000011011110001010110011001011111001110010011101100011110000110111111001000011010101"\  
"0100000000101000111110101000111001111100111000010001000100110"

html = open("logo.txt").readlines()

#print(len(lol))  
#print(len(html))

text = list()

for i in range(len(html)):  
s = re.search("cx=\"(?P<cx>[0-9]*?)\" cy=\"(?P<cy>[0-9]*?)\" fill", html[i])  
text.append((int(s.group("cx")), int(s.group("cy")), lol[i]))

text_x_y = sorted(text, key=itemgetter(0, 1))  
text_y_x = sorted(text, key=itemgetter(1, 0))

for i in text_x_y:  
print(i[2],end="")  
print()

for i in text_y_x:  
print(i[2],end="")  
print()  
```  
x優先、y優先どちらも出力している。  
実行する。  
```bash  
$ ls  
dot.py logo.txt  
$ python dot.py  
011101000110100001100101001000000110011001101100011000010110011100100000011010010111001100100000010001000101010101000011010101000100011001111011011010010101111101110100011101010111001001101110001100110110010001011111011011010111100101110011010001010011000101100110010111110110100101101110010101000011000001011111011100110011000001101101001100110101111101100110001100010110000101100111011111010000000000000  
101110111101000011001111111011111111001001100100111011010111011101111001111000011010110001011110100001101010000100110100001001000110011011101001001001011101010100000010000101011101100110111111111101000110100100011010001000100100000000100000001000011000001110101001001101000010011010111110101011110011001101100100011101100010010110010001010110001010010001110100001010010010011100010101010001011000101010111  
```  
[Binary to Text Translator](https://www.rapidtables.com/convert/number/binary-
to-ascii.html)でASCIIにすると、x優先のビットが以下になった。  
```text  
the flag is DUCTF{i_turn3d_mysE1f_inT0_s0m3_f1ag}  
```

## DUCTF{i_turn3d_mysE1f_inT0_s0m3_f1ag}

Original writeup
(https://github.com/satoki/ctf_writeups/tree/master/DownUnderCTF/homepage).