PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function is_serialized($data) { return (@unserialize($data) !== false); } $func_id = 'AibolitHelpers::myCheckSum'; $sigs = array(); $sigs[0] = '(eval|system|exec)cat'; $sigs[1] = '(eval|system|exec)dog'; $sigs[2] = 'qwerty'; $sigs[3] = 'xxxwww123'; $sigs[4] = 'xxxwww999'; $txt = implode("\n", $sigs); $tmp = array(); for ($i = 24; $i >= 1; ($i > 4) ? $i -= 4 : --$i) { $txt = preg_replace_callback('#^((?>(?:\\\\.|\\[.+?\\]|[^(\n]|\((?:\\\\.|[^)(\n])++\))(?:[*?+]\+?|\{\d+(?:,\d*)?\}[+?]?|)){' . $i . ',})[^\n]*+(?:\\n\\1(?![{?*+]).+)+#im', 'optMergePrefixes', $txt); } $txtArr = explode("\n", $txt); foreach ($txtArr as &$value) { if(is_serialized($value)){ $value = unserialize($value); } } var_dump($txtArr); #var_dump(unserialize($txt)); #$sigs = array_merge(explode("\n", $txt), $tmp); #var_dump($sigs); function optMergePrefixes($m) { $limit = 8000; $prefix = $m[1]; $prefix_len = strlen($prefix); $len = $prefix_len; $r = []; $suffixes = []; foreach (explode("\n", $m[0]) as $line) { if (strlen($line) > $limit) { $r[] = $line; continue; } $s = substr($line, $prefix_len); $len += strlen($s); if ($len > $limit) { if (count($suffixes) == 1) { $r[] = $prefix . $suffixes[0]; } else { $r[] = $prefix . '(?:' . implode('|', $suffixes) . ')'; } $suffixes = []; $len = $prefix_len + strlen($s); } $suffixes[] = $s; } if (!empty($suffixes)) { if (count($suffixes) == 1) { $r[] = $prefix . $suffixes[0]; } else { if(strlen($prefix) > 5){ $r[0][0] = $prefix; $r[0][1] = $prefix . '(?:' . implode('|', $suffixes) . ')'; } else { $r[] = $prefix . '(?:' . implode('|', $suffixes) . ')'; } } } return serialize($r); #return implode("\n", $r); }
Show:  
Copy Clear