3v4l.org

run code in 300+ PHP versions simultaneously
<?php $log = "(9143308-9144331):246221357-246222380, (IND):246222381, (9144332-9145355):246222382-246223405, (IND):246223406, (9145356-9146379):246223407-246224430, (IND):246224431, (9146380-9147403):246224432-246225455, (IND):246225456, (9147404-9148427):246225457-246226480, (IND):246226481, (9148428-9149451):246226482-246227505, (IND):246227506, (9149452-9150475):246227507-246228530, (IND):246228531, (9150476-9151499):246228532-246229555, (IND):246229556, (9151500-9152523):246229557-246230580, (IND):246230581, (9152524-9153547):246230582-246231605, (IND):246231606, (9153548-9154571):246231607-246232630, (IND):246232631, (9154572-9155027):246232632-246233087, (9155028-9155595):246233115-246233682, (IND):246233683, (9155596-9156619):246233684-246234707, (IND):246234708, (9156620-9157643):246234709-246235732, (IND):246235733, (9157644-9158667):246235734-246236757, (IND):246236758, (9158668-9159691):246236759-246237782, (IND):246237783, (9159692-9160715):246237784-246238807, (IND):246238808, (9160716-9161739):246238809-246239832, (IND):246239833, (9161740-9162763):246239834-246240857, (IND):246240858, (9162764-9163787):246240859-246241882, (IND):246241883, (9163788-9164811):246241884-246242907, (IND):246242908, (9164812-9165835):246242909-246243932, (IND):246243933, (9165836-9166859):246243934-246244957, (IND):246244958, (9166860-9167883):246244959-246245982, (IND):246245983, (9167884-9168907):246245984-246247007, (IND):246247008, (9168908-9169931):246247009-246248032, (IND):246248033, (9169932-9170955):246248034-246249057, (IND):246249058, (9170956-9171979):246249059-246250082, (IND):246250083, (9171980-9173003):246250084-246251107, (IND):246251108, (9173004-9173414):246251109-246251519, (9173415-9174027):246252034-246252646, (IND):246252647, (9174028-9175039):246252648-246253659 TOTAL: 9184010"; $out = '#!/bin/sh' . PHP_EOL; $matches = array(); if (preg_match_all('/((.*?)-(.*?)):(.*?)-(.*?),/m', $log, $matches)) { foreach ($matches as $match) { $blockSize = $match[1][1] - $match[1][0] + 1; $startingBlock = $match[1][3]; $out .= sprintf('fsgrab -c %s -s %s /dev/sdc2 >> "/media/root/TOSHIBA EXT/blabla"', $blockSize, $startingBlock) . PHP_EOL; } } echo $out;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 30
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 30
filename:       /in/Re24Q
function name:  (null)
number of ops:  32
compiled vars:  !0 = $log, !1 = $out, !2 = $matches, !3 = $match, !4 = $blockSize, !5 = $startingBlock
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%289143308-9144331%29%3A246221357-246222380%2C+%28IND%29%3A246222381%2C+%289144332-9145355%29%3A246222382-246223405%2C+%28IND%29%3A246223406%2C+%289145356-9146379%29%3A246223407-246224430%2C+%28IND%29%3A246224431%2C+%289146380-9147403%29%3A246224432-246225455%2C+%28IND%29%3A246225456%2C+%289147404-9148427%29%3A246225457-246226480%2C+%28IND%29%3A246226481%2C+%289148428-9149451%29%3A246226482-246227505%2C+%28IND%29%3A246227506%2C+%289149452-9150475%29%3A246227507-246228530%2C+%28IND%29%3A246228531%2C+%289150476-9151499%29%3A246228532-246229555%2C+%28IND%29%3A246229556%2C+%289151500-9152523%29%3A246229557-246230580%2C+%28IND%29%3A246230581%2C+%289152524-9153547%29%3A246230582-246231605%2C+%28IND%29%3A246231606%2C+%289153548-9154571%29%3A246231607-246232630%2C+%28IND%29%3A246232631%2C+%289154572-9155027%29%3A246232632-246233087%2C+%289155028-9155595%29%3A246233115-246233682%2C+%28IND%29%3A246233683%2C+%289155596-9156619%29%3A246233684-246234707%2C+%28IND%29%3A246234708%2C+%289156620-9157643%29%3A246234709-246235732%2C+%28IND%29%3A246235733%2C+%289157644-9158667%29%3A246235734-246236757%2C+%28IND%29%3A246236758%2C+%289158668-9159691%29%3A246236759-246237782%2C+%28IND%29%3A246237783%2C+%289159692-9160715%29%3A246237784-246238807%2C+%28IND%29%3A246238808%2C+%289160716-9161739%29%3A246238809-246239832%2C+%28IND%29%3A246239833%2C+%289161740-9162763%29%3A246239834-246240857%2C+%28IND%29%3A246240858%2C+%289162764-9163787%29%3A246240859-246241882%2C+%28IND%29%3A246241883%2C+%289163788-9164811%29%3A246241884-246242907%2C+%28IND%29%3A246242908%2C+%289164812-9165835%29%3A246242909-246243932%2C+%28IND%29%3A246243933%2C+%289165836-9166859%29%3A246243934-246244957%2C+%28IND%29%3A246244958%2C+%289166860-9167883%29%3A246244959-246245982%2C+%28IND%29%3A246245983%2C+%289167884-9168907%29%3A246245984-246247007%2C+%28IND%29%3A246247008%2C+%289168908-9169931%29%3A246247009-246248032%2C+%28IND%29%3A246248033%2C+%289169932-9170955%29%3A246248034-246249057%2C+%28IND%29%3A246249058%2C+%289170956-9171979%29%3A246249059-246250082%2C+%28IND%29%3A246250083%2C+%289171980-9173003%29%3A246250084-246251107%2C+%28IND%29%3A246251108%2C+%289173004-9173414%29%3A246251109-246251519%2C+%289173415-9174027%29%3A246252034-246252646%2C+%28IND%29%3A246252647%2C+%289174028-9175039%29%3A246252648-246253659%0ATOTAL%3A+9184010'
    5     1        ASSIGN                                                   !1, '%23%21%2Fbin%2Fsh%0A'
    6     2        ASSIGN                                                   !2, <array>
    8     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%28%28.%2A%3F%29-%28.%2A%3F%29%29%3A%28.%2A%3F%29-%28.%2A%3F%29%2C%2Fm'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $9      
          8      > JMPZ                                                     $9, ->30
   10     9    > > FE_RESET_R                                       $10     !2, ->29
         10    > > FE_FETCH_R                                               $10, !3, ->29
   11    11    >   FETCH_DIM_R                                      ~11     !3, 1
         12        FETCH_DIM_R                                      ~12     ~11, 1
         13        FETCH_DIM_R                                      ~13     !3, 1
         14        FETCH_DIM_R                                      ~14     ~13, 0
         15        SUB                                              ~15     ~12, ~14
         16        ADD                                              ~16     ~15, 1
         17        ASSIGN                                                   !4, ~16
   12    18        FETCH_DIM_R                                      ~18     !3, 1
         19        FETCH_DIM_R                                      ~19     ~18, 3
         20        ASSIGN                                                   !5, ~19
   13    21        INIT_FCALL                                               'sprintf'
         22        SEND_VAL                                                 'fsgrab+-c+%25s+-s+%25s+%2Fdev%2Fsdc2+%3E%3E+%22%2Fmedia%2Froot%2FTOSHIBA+EXT%2Fblabla%22'
         23        SEND_VAR                                                 !4
         24        SEND_VAR                                                 !5
         25        DO_ICALL                                         $21     
         26        CONCAT                                           ~22     $21, '%0A'
         27        ASSIGN_OP                                     8          !1, ~22
   10    28      > JMP                                                      ->10
         29    >   FE_FREE                                                  $10
   18    30    >   ECHO                                                     !1
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.17 ms | 1392 KiB | 17 Q