Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * s=(rot13)%{if num}[SALT](rot5){else}(rot13)[EXPLODER](rot13)%{if num}[SALT](rot5){else}(rot13) ...
- **/
- class obfuscation
- {
- private $request;
- private $equal;
- private $int_salt;
- private $exploder;
- private $debugging;
- public function __construct()
- {
- if(isset($_GET['s']))
- $this->request = $_GET['s'];
- else
- $this->request = "";
- $this->equal = md5("hahaha");
- $this->int_salt = "999999";
- $this->exploder = "gghztfjafdsg";
- $this->debugging = array();
- }
- public function getDebuginfo(){
- $ret = "";
- foreach($this->debugging as $x){
- $ret .= $x;
- }
- return $ret;
- }
- // buggy
- private function rot5($str, $n=5){
- $replace = [];
- for($i=0;$i<26;$i++){
- $replace[chr(65+$i)] = chr(65+(($i+$n)%26));
- $replace[chr(97+$i)] = chr(97+(($i+$n)%26));
- }
- return strtr($str, $replace);
- }
- public function encode($link)
- {
- $e = explode('?', $link);
- $f = $e[0];
- $p = explode('&', $e[1]);
- unset($e);
- $arr = array();
- foreach($p as $part){
- $e = explode('=', $part);
- $param = $e[0];
- $value = $e[1];
- unset($e);
- if(is_numeric($value))
- $nval = "" . $this->int_salt . "" . self::rot5($value) . "";
- else
- $nval = str_rot13($value);
- $arr[] = "" . str_rot13($param) . "" . $this->equal . "" . $nval . "";
- }
- $crypted = implode($this->exploder, $arr);
- $out = $f . "?s=" . $crypted . "";
- return $out;
- }
- public function decode($debug = false)
- {
- $e = explode($this->exploder, $this->request);
- foreach($e as $p){
- $c = explode($this->equal, $p);
- $pa = str_rot13($c[0]);
- if(is_numeric($c[1])){
- $re = "";
- $va = str_replace($this->int_salt, $re, $c[1]);
- $va = self::rot5($va);
- }else{
- $va = str_rot13($c[1]);
- }
- $_GET[$pa] = $va;
- if($debug)
- $this->debugging[] = " " . $pa . " => " . $va . ",<br>";
- //array_push($_GET,array($pa => $va));
- }
- return $_GET;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement