LoginSignup
132
42

More than 5 years have passed since last update.

☠️†卍️ 兵庫県警に補導される難解スクリプト️ ️卍†☠️

Last updated at Posted at 2019-03-06

スクリプト

※以下を実行すると無限アラートになります。

見えづらかったので、文字を小さくしたスクショを追記↓
Screen Shot 2019-03-07 at 12.59.49.png

script.js

                                                                                                                                                                                                                                        [][                            
                                                                                                  (![]                                                                        +[]                                                     )[+[]]+(                         
                                                                                                 [![]]+                                                                       [][[                                                   ]])[+!+[]                         
                                                                                                +[+[]]]+                                                                     (![]+[]                                                 )[!+[]+!+[                        
                                                                                                ]]+(!![]+                                                                   [])[+[]]+                                                (!![]+[])[                        
                                                                                                !+[]+!+[]                                                                   +!+[]]+(!                                                ![]+[])[+!                        
                                                                                                +[]]][([                                                                   ][(![]+[])                                                 [+[]]+([!                        
                                                                                                []]+[][[                                                                   ]])[+!+[]+[                                                +[]]]+(![                        
                                                                                                ]+[])[!+                                                                  []+!+[]]+(!!                                                []+[])[+[                        
                                          ]]+(!![]+[])[!+                                       []+!+[]+                                                                 !+[]]+(!![]+                                                 [])[+!+[]                        
      ]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]                                      +[][[]])                                                                [+!+[]+[+[]]                                                   ]+(![]+[                        
     ])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]                                      ]+(!![]+                                                                [])[+!+[]]]                                                    )[+!+[]+                        
     [+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!!                                     []+[])[+                                                               []]+(!![]+[]                                                    )[+!+[]]+                       
     ([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]                                    +[+[]]]+                                                              (![]+[])[!+[                                                     ]+!+[]]+(                       
     !![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]                                    ]]+[])[!                                                              +[]+!+[]+!+                                                      []]+(!![]+                      
     [])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+                                    []]]+(![                                                             ]+[])[!+[]+                                                       !+[]]+(!![]     +[])[+[]]+      
     (!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]                                   ]+(!![]+                                                            [])[+!+[]]](                                                       (+(!+[]+!+[]+!+[]+[!+[]+!+      
     []]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[                                   ]])[+!+[]                                                           +[+[]]]+(![]                                                        +[])[!+[]+!+[]]+(!![]+[])[+     
     []]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]                                   +[+[]]]+(+!                                                         []+([]+[])[(                                       [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+     
     (![]+[])[!+[]+!+[]]+(!![]+[])[+[]]     +(!![]+[])[!+[                ]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(                                   !![]+[][(![]                                       +[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])     
     [!+[]+!+[]]+(!![]+[])[+[]]+(!!         []+[])[!+[]+!+               []+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+                                  !+[]]+(![]+[                                       ])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!     
                            +[]]+([         ][[]]+[])[+[]               ]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])                                [!+[]+!+[]]+                                        (!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]     
                            +[])[+!         +[]]]+[])[!+                []+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![                               ]]+[][[]])[+                                         !+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]     
                            +(!![]+        [])[!+[]+!+[                 ]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]                              ])[+!+[]+[+[                                           ]]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[]     
                            [[]])[+!      +[]+[+[]]]+([                 ][[]]+[])[+!+[]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+(                             [![]]+[][[]]                                            )[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]          
                           +[])[+[]]     +(!![]+[])[!+                  []+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![                            ]+[][(![]+[]                                             )[+[]]+([![]]+[][[]])[+!+[]+[+[]]]                
                           +(![]+[])     [!+[]+!+[]]+                   (!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]                            ]])[+!+[]+[+                                              []]]+([][[]]+[])[+!+[]]+(![]+[])                 
                           [!+[]+!+[]   +!+[]]+(!![]                    +[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])                           [+[]]+([![]]                                                                    +[][[]])[+!                 
                           +[]+[+[]]]  +(![]+[])[!+                     []+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+                          [])[+!+[]]]+                                                                      [])[!+[]+!                 
                           +[]+!+[]]+(!![]+[])[+[]]                      +(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!                          []+[])[!+[]+                                                                        !+[]]+(!!                 
                           []+[])[+[]]+(!![]+[])[!                                            +[]+!+[]+!+                                               []]+(!![]+[]                                                                         )[+!+[]]])                
                           [+!+[]+[+[]]]+(!![]+[]                                              )[+!+[]]]                                                )[!+[]+!+[]                                                                          +[+[]]]](!+               
                           []+!+[]+!+[]+[!+[]+!+                                                []+!+[]]                                               )+(+(+!+[]+[                                                                           +[]]+[+!+[               
                           ]]))[(!![]+[])[+[]]+(                                                !![]+[][                                              (![]+[])[+[]                                                                             ]+([![]]+[              
                           ][[]])[+!+[]+[+[]]]                                    +(!           []+[])[!          +[]                                 +!+[]]+(!![                                                                              ]+[])[+[]]+             
                           (!![]+[])[!+[]+!+[]                                    +!+[          ]]+(!![]         +[])[                                +!+[]]])[+                                                                               !+[]+[+[]]]             
                           +(+![]+([]+[])[([]                                    [(![]+[        ])[+[]]+        ([![]]+                              [][[]])[+!                                                                                 +[]+[+[]]]+            
                           (![]+[])[!+[]+!+[                                     ]]+(!![]+      [])[+[]]       +(!![]+[                              ])[!+[]+!+                                                                                 []+!+[]]+(!!           
                           []+[])[+!+[]]]+[                                     ])[!+[]+!+      []+!+[]]       +(!![]+[]                             [(![]+[])[                                                                                 +[]]+([![]]+[          
                           ][[]])[+!+[]+[+                                      []]]+(![]+      [])[!+[]      +!+[]]+(!![                             ]+[])[+[]]                                                                  +(!![]+[])[!+[]+!+[]+!+[]]+(         
                           !![]+[])[+ !+[                                       ]]])[+!+[]      +[+[]]]+      ([][[]]+[])                             [+!+[]]+(!                                                               []+[])[!+[]+!+[]+!+[]]+(!![]+[])        
                           [+[]]+(!![                                          ]+[])[+!+[]      ]+([][[]      ]+[])[+[]]+(                            [][(![]+[])                                                             [+[]]+([![]]+[][[]])[+!+[]+[+[]]]+       
                           (![]+[])[                                           !+[]+!+[]]       +(!![]+[      ])[+[]]+(!![]                           +[])[!+[]+!+                                                          []+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!      
                           +[]+!+[]]                                          +(!![]+[])[       +[]]+(!!       []+[][(![]+[                            ])[+[]]+([![                                                        ]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!     
                           +[]]+(!![                                          ]+[])[+[]]        +(!![]+[        ])[!+[]+!+[]                            +!+[]]+(!![]                                                      +[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+     
                           []]])[+!+                                         []+[+[]]]+         (!![]+[]         )[+[]]+(!![]                           +[])[+!+[]]+(                                                    [![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+    
                          []]+(+![]                                          +[![]]+([]         +[])[([]         [(![]+[])[+[                            ]]+([![]]+[][                                                   []])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![    
                          ]+[])[+[]                                          ]+(!![]+[]         )[!+[]+!          +[]+!+[]]+(!                            ![]+[])[+!+[]                                                 ]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+     
                          []]+([![]                                         ]+[][[]])[+         !+[]+[+[           ]]]+(![]+[])                            [!+[]+!+[]]+(                                               !![]+[])[+[]]               +(!![]+[])[!+[]     
                          +!+[]+!+                                         []]+(!![]+[          ])[+!+[]           ]])[+!+[]+[+                             []]]+([][[]]+                                              [])[+!+[]]+                    (![]+[])[!+      
                         []+!+[]+!                                         +[]]+(!![]           +[])[+[]            ]+(!![]+[])[                             +!+[]]+([][[]                                             ]+[])[+[]]                       +([][(![       
                        ]+[])[+[]]                                         +([![]]+[]           [[]])[+!             +[]+[+[]]]+                              (![]+[])[!+[]                                            +!+[]]+(!                           ![]+        
                        [])[+[]]+(                                        !![]+[])[!+           []+!+[]+             !+[]]+(!![]+                              [])[+!+[]]]+[                                           ])[!+[]+                                        
                        !+[]+!+[]                                         ]+(!![]+[]            )[+[]]+(              !![]+[][(![                              ]+[])[+[]]+([!                                          []]+[][[                                        
                       ]])[+!+[]+                                        [+[]]]+(![]            +[])[!+[              ]+!+[]]+(!![                               ]+[])[+[]]+(!                                         ![]+[])                                         
                      [!+[]+!+[]+                                        !+[]]+(!![             ]+[])[+!               +[]]])[+!+[                               ]+[+[]]]+(!![                                         ]+[])[+                                         
                      !+[]]])[!+                                        []+!+[]+[+[             ]]]](!+[               ]+!+[]+[+!+                                []])[+!+[]]+(                                        [![]]+[                                         
                     ][[]])[+!+[                                        ]+[+[]]]+(              ![]+[])[                !+[]+!+[]]                                 +(!![]+[])[!+                                       []+!+[]+                                        
                    !+[]]+(![]+                                        [][(![]+[])              [+[]]+([                 ![]]+[][[                                  ]])[+!+[]+[+[                                      ]]]+(![]                                        
                   +[])[!+[]+!+                                        []]+(!![]+               [])[+[]]                 +(!![]+[]                                   )[!+[]+!+[]+!                                     +[]]+(!![                                       
                  ]+[])[+!+[]]                                          ])[!+[]+!               +[]+[+[]                  ]]+[+!                                      +[]]+(!![]+[]                                    [(![]+[])[                                      
                 +[]]+([![]]+[                                           ][[]])[                +!+[]+[+                  []]]+                                        (![]+[])[!+[                                    ]+!+[]]+(!!                                     
                []+[])[+[]]+(                                             !![]+[                ])[!+[]+                   !+[                                         ]+!+[]]+(!![]                                    +[])[+!+[]]                                    
               ])[!+[]+!+[]+                                                [+[                 ]]]+(![]                                                                +[])[+!+[]]+(                                   ![]+[])[!+[]+!+[]]                             
              +(!![]+[])[!+[                                                                    ]+!+[]+!                                                                 +[]]+(!![]+[                                    ])[+!+[]]+(!![]+[])[+[]]+(![]+[][             
             (![]+[])[+[]]+                                                                     ([![]]+[                                                                 ][[]])[+!+[]+                                   [+[]]]+(![]+[])[!+[]+!+[]]+(!![]+             
             [])[+[]]+(!![                                                                      ]+[])[!+                                                                   []+!+[]+!+[]                                   ]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+            
            []]]+(!![]+[]                                                                       [(![]+[]                                                                   )[+[]]+([![]                                    ]+[][[]])[+!+[]+[+[]]]+(![]+[])[            
             !+[]+!+[]]+(                                                                       !![]+[])                                                                    [+[]]+(!![]                                    +[])[!+[]+!+[]+!+[]]+(!![]+[])[+            
             !+[]]])[!+                                                                         []+!+[]+                                                                     [+[]]])()                                       

※兵庫県警は優秀だからきっと難読化されたスクリプトを直すなんてお手のものだから上のコードをみるだけでwhile(1)alert()と等価だとわかっちゃうはず。

せっかくなので作り方

下準備 JSFuckコードの作成

以下のコードをJsFuckにぶち込む.
JSFuck - Write any JavaScript with 6 Characters: !+

script.js
while(1)alert()

すると

script.js
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[
...(5138文字)

になる。

参考: JSFuck - Wikipedia

味付け

味気ないのでコードに味付けする。
適当な画像を用意する。

元となる画像↓
base.jpg

ジェネレータの仕様上、画像の上下左右の空白を削除し縦に伸ばしておくとよい↓
image.jpg

上の画像を以下のコードにぶちこむ。(だいぶ雑なので直したい)

sample.py
import numpy as np
import cv2

src_path = "./script.js"
img_path = "./image.jpg"

# read source file
with open(src_path, 'r') as f:
    source_txt = f.read()

# read image
img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
org_width, org_height = img.shape

# bin search
min_scale = 0.1;
max_scale = 30;
now_scale = 1;

while True:
    img = cv2.resize(img, (int(org_width*now_scale), int(org_height*now_scale) ))
    count_of_black = np.sum(img < 128)

    if len(source_txt) < count_of_black < len(source_txt)+1000:
        break

    if count_of_black < len(source_txt):
        min_scale = now_scale
        now_scale = (max_scale + now_scale) / 2
    else:
        max_scale = now_scale
        now_scale = (min_scale + now_scale) / 2

# resize image
img = cv2.resize(img, (int(org_width*now_scale), int(org_height*now_scale) )) < 128

# create output text
out_text = ""
pointer = 0

for y in range(img.shape[0]):
    for x in range(img.shape[1]):
        add_char = " "
        if img[y,x]:
            if pointer < len(source_txt):
                add_char = source_txt[pointer]
                pointer += 1
        out_text += add_char
    out_text += "\n"

# output
with open("out.txt", 'w') as f:
    f.write(out_text)

盛り付け

以下のコードをどっかのウェブサーバに置いておく。

ahokusa.html
<script>
{ 上記のアホくさコード }
</script>

完成

ウェブサーバに置いたリンクをどこかの掲示板に貼る。
どこかの警察から補導されるまで待ちましょう。

※以上の記事の内容はすべてフィクションです。

132
42
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
132
42