3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xor_encrypt($in) { $key = '<censored>'; $text = $in; $outText = ''; // Iterate through each character for($i=0;$i<strlen($text);$i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } function loadData($def) { global $_COOKIE; $mydata = $def; if(array_key_exists("data", $_COOKIE)) { $tempdata = json_decode(xor_encrypt(base64_decode($_COOKIE["data"])), true); if(is_array($tempdata) && array_key_exists("showpassword", $tempdata) && array_key_exists("bgcolor", $tempdata)) { if (preg_match('/^#(?:[a-f\d]{6})$/i', $tempdata['bgcolor'])) { $mydata['showpassword'] = $tempdata['showpassword']; $mydata['bgcolor'] = $tempdata['bgcolor']; } } } return $mydata; } function saveData($d) { setcookie("data", base64_encode(xor_encrypt(json_encode($d)))); } //INput should be this: $_COOKIE["data"] //data=ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV5%2FRBFeaAw%3D function decrypt_to_string($d){ echo "\nDECRYPT $d 2 Strangggg\n"; $tempdata = json_decode(xor_encrypt(base64_decode($d)), true); echo "Var Dumping tempdata!\n"; var_dump( $tempdata ); echo "\n"; echo "BEFOREJSON\n".xor_encrypt(base64_decode($d))."\n"; } //////////////////////////////////////////////////////////////////////////////// $defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff"); $data = loadData($defaultdata); if(array_key_exists("bgcolor",$_REQUEST)) { if (preg_match('/^#(?:[a-f\d]{6})$/i', $_REQUEST['bgcolor'])) { $data['bgcolor'] = $_REQUEST['bgcolor']; } } saveData($data); $kai = "ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV5%2FRBFeaAw%3D"; $kai = urldecode($kai); decrypt_to_string($kai); $defaultdataX = array( "showpassword"=>"yes", "bgcolor"=>"#ffffff"); $j_enc = json_encode($defaultdataX); $xored = xor_encrypt(json_encode($defaultdataX)); $pimping = base64_encode(xor_encrypt(json_encode($defaultdataX))); echo "\n~ ~ ~~ ~ ~~ \n"; echo $pimping; echo "\n~ ~ ~~ ~ ~~ \n"; echo $j_enc; echo "\n~ ~ ~~ ~ ~~ \n"; echo $xored; echo "\n~ ~ ~~ ~ ~~ \n"; //////////////////////////////////////////////////////////////////////////////// echo "\n\n!!!";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 19
filename:       /in/Iig3o
function name:  (null)
number of ops:  61
compiled vars:  !0 = $defaultdata, !1 = $data, !2 = $kai, !3 = $defaultdataX, !4 = $j_enc, !5 = $xored, !6 = $pimping
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   ASSIGN                                                   !0, <array>
   57     1        INIT_FCALL                                               'loaddata'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $8      
          4        ASSIGN                                                   !1, $8
   59     5        FETCH_R                      global              ~10     '_REQUEST'
          6        ARRAY_KEY_EXISTS                                         'bgcolor', ~10
          7      > JMPZ                                                     ~11, ->19
   60     8    >   INIT_FCALL                                               'preg_match'
          9        SEND_VAL                                                 '%2F%5E%23%28%3F%3A%5Ba-f%5Cd%5D%7B6%7D%29%24%2Fi'
         10        FETCH_R                      global              ~12     '_REQUEST'
         11        FETCH_DIM_R                                      ~13     ~12, 'bgcolor'
         12        SEND_VAL                                                 ~13
         13        DO_ICALL                                         $14     
         14      > JMPZ                                                     $14, ->19
   61    15    >   FETCH_R                      global              ~16     '_REQUEST'
         16        FETCH_DIM_R                                      ~17     ~16, 'bgcolor'
         17        ASSIGN_DIM                                               !1, 'bgcolor'
         18        OP_DATA                                                  ~17
   64    19    >   INIT_FCALL                                               'savedata'
         20        SEND_VAR                                                 !1
         21        DO_FCALL                                      0          
   66    22        ASSIGN                                                   !2, 'ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV5%252FRBFeaAw%253D'
   67    23        INIT_FCALL                                               'urldecode'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $20     
         26        ASSIGN                                                   !2, $20
   68    27        INIT_FCALL                                               'decrypt_to_string'
         28        SEND_VAR                                                 !2
         29        DO_FCALL                                      0          
   70    30        ASSIGN                                                   !3, <array>
   71    31        INIT_FCALL                                               'json_encode'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                         $24     
         34        ASSIGN                                                   !4, $24
   72    35        INIT_FCALL                                               'xor_encrypt'
         36        INIT_FCALL                                               'json_encode'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                         $26     
         39        SEND_VAR                                                 $26
         40        DO_FCALL                                      0  $27     
         41        ASSIGN                                                   !5, $27
   73    42        INIT_FCALL                                               'base64_encode'
         43        INIT_FCALL                                               'xor_encrypt'
         44        INIT_FCALL                                               'json_encode'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                         $29     
         47        SEND_VAR                                                 $29
         48        DO_FCALL                                      0  $30     
         49        SEND_VAR                                                 $30
         50        DO_ICALL                                         $31     
         51        ASSIGN                                                   !6, $31
   74    52        ECHO                                                     '%0A%7E+%7E+%7E%7E+%7E+%7E%7E+%0A'
   75    53        ECHO                                                     !6
   76    54        ECHO                                                     '%0A%7E+%7E+%7E%7E+%7E+%7E%7E+%0A'
   77    55        ECHO                                                     !4
   78    56        ECHO                                                     '%0A%7E+%7E+%7E%7E+%7E+%7E%7E+%0A'
   79    57        ECHO                                                     !5
   80    58        ECHO                                                     '%0A%7E+%7E+%7E%7E+%7E+%7E%7E+%0A'
   84    59        ECHO                                                     '%0A%0A%21%21%21'
         60      > RETURN                                                   1

Function xor_encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 6
Branch analysis from position: 16
Branch analysis from position: 6
filename:       /in/Iig3o
function name:  xor_encrypt
number of ops:  18
compiled vars:  !0 = $in, !1 = $key, !2 = $text, !3 = $outText, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '%3Ccensored%3E'
    6     2        ASSIGN                                                   !2, !0
    7     3        ASSIGN                                                   !3, ''
   10     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->13
   11     6    >   FETCH_DIM_R                                      ~9      !2, !4
          7        STRLEN                                           ~10     !1
          8        MOD                                              ~11     !4, ~10
          9        FETCH_DIM_R                                      ~12     !1, ~11
         10        BW_XOR                                           ~13     ~9, ~12
         11        ASSIGN_OP                                     8          !3, ~13
   10    12        PRE_INC                                                  !4
         13    >   STRLEN                                           ~16     !2
         14        IS_SMALLER                                               !4, ~16
         15      > JMPNZ                                                    ~17, ->6
   14    16    > > RETURN                                                   !3
   15    17*     > RETURN                                                   null

End of function xor_encrypt

Function loaddata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 41
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 41
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 41
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 41
Branch analysis from position: 28
Branch analysis from position: 25
Branch analysis from position: 41
filename:       /in/Iig3o
function name:  loadData
number of ops:  43
compiled vars:  !0 = $def, !1 = $mydata, !2 = $tempdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        FETCH_W                      global lock         $3      '_COOKIE'
          2        FETCH_W                      global              $4      '_COOKIE'
          3        ASSIGN_REF                                               $4, $3
   20     4        ASSIGN                                                   !1, !0
   21     5        FETCH_R                      global              ~6      '_COOKIE'
          6        ARRAY_KEY_EXISTS                                         'data', ~6
          7      > JMPZ                                                     ~7, ->41
   22     8    >   INIT_FCALL                                               'json_decode'
          9        INIT_FCALL                                               'xor_encrypt'
         10        INIT_FCALL                                               'base64_decode'
         11        FETCH_R                      global              ~8      '_COOKIE'
         12        FETCH_DIM_R                                      ~9      ~8, 'data'
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
   23    21        TYPE_CHECK                                  128  ~14     !2
         22      > JMPZ_EX                                          ~14     ~14, ->25
         23    >   ARRAY_KEY_EXISTS                                 ~15     'showpassword', !2
         24        BOOL                                             ~14     ~15
         25    > > JMPZ_EX                                          ~14     ~14, ->28
         26    >   ARRAY_KEY_EXISTS                                 ~16     'bgcolor', !2
         27        BOOL                                             ~14     ~16
         28    > > JMPZ                                                     ~14, ->41
   24    29    >   INIT_FCALL                                               'preg_match'
         30        SEND_VAL                                                 '%2F%5E%23%28%3F%3A%5Ba-f%5Cd%5D%7B6%7D%29%24%2Fi'
         31        FETCH_DIM_R                                      ~17     !2, 'bgcolor'
         32        SEND_VAL                                                 ~17
         33        DO_ICALL                                         $18     
         34      > JMPZ                                                     $18, ->41
   25    35    >   FETCH_DIM_R                                      ~20     !2, 'showpassword'
         36        ASSIGN_DIM                                               !1, 'showpassword'
         37        OP_DATA                                                  ~20
   26    38        FETCH_DIM_R                                      ~22     !2, 'bgcolor'
         39        ASSIGN_DIM                                               !1, 'bgcolor'
         40        OP_DATA                                                  ~22
   30    41    > > RETURN                                                   !1
   31    42*     > RETURN                                                   null

End of function loaddata

Function savedata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iig3o
function name:  saveData
number of ops:  15
compiled vars:  !0 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_FCALL                                               'setcookie'
          2        SEND_VAL                                                 'data'
          3        INIT_FCALL                                               'base64_encode'
          4        INIT_FCALL                                               'xor_encrypt'
          5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $1      
          8        SEND_VAR                                                 $1
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                                 
   35    14      > RETURN                                                   null

End of function savedata

Function decrypt_to_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iig3o
function name:  decrypt_to_string
number of ops:  31
compiled vars:  !0 = $d, !1 = $tempdata
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
   42     1        ROPE_INIT                                     3  ~3      '%0ADECRYPT+'
          2        ROPE_ADD                                      1  ~3      ~3, !0
          3        ROPE_END                                      2  ~2      ~3, '+2+Strangggg%0A'
          4        ECHO                                                     ~2
   44     5        INIT_FCALL                                               'json_decode'
          6        INIT_FCALL                                               'xor_encrypt'
          7        INIT_FCALL                                               'base64_decode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !1, $7
   46    16        ECHO                                                     'Var+Dumping+tempdata%21%0A'
   47    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   48    20        ECHO                                                     '%0A'
   50    21        INIT_FCALL                                               'xor_encrypt'
         22        INIT_FCALL                                               'base64_decode'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                         $10     
         25        SEND_VAR                                                 $10
         26        DO_FCALL                                      0  $11     
         27        CONCAT                                           ~12     'BEFOREJSON%0A', $11
         28        CONCAT                                           ~13     ~12, '%0A'
         29        ECHO                                                     ~13
   51    30      > RETURN                                                   null

End of function decrypt_to_string

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
197.33 ms | 1415 KiB | 38 Q