├── .gitattributes ├── README.md ├── api └── c_api.php ├── functions └── functions.php ├── index.php ├── logout.php ├── obfuscator └── readme.txt ├── panel.php ├── projects └── index.html └── uploads ├── index.html └── obfuscated └── index.html /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # server sided obfuscator base 2 | this is a server sided obfuscator base, where you login, select the options, upload the file to the server and it obfuscates it 3 | 4 | the obfuscator used in this project is ConfuserEx, the authentication service is cauth.me 5 | 6 | please contact me in case of issues :D 7 | 8 | to do -> 9 | ``` 10 | use ajax for the form upload 11 | ``` 12 | done -> 13 | ``` 14 | added support for file dependencies, drop the exe ( must be a single exe ) and the dependencies in a zip file to upload 15 | the confuser ex console output is saved together with the exe in a zip file after the obfuscation (dependencies are added too) 16 | -------------------------------------------------------------------------------- /api/c_api.php: -------------------------------------------------------------------------------- 1 | $c_version, 23 | "api_version" => "3.1b", 24 | "program_key" => $_SESSION["program_key"], 25 | "api_key" => $_SESSION["api_key"] 26 | ]; 27 | 28 | curl_setopt($ch, CURLOPT_POSTFIELDS, $values); 29 | 30 | $result = curl_exec($ch); curl_close($ch); 31 | 32 | switch($result){ 33 | case "program_doesnt_exist": 34 | die("the program doesnt exist"); 35 | break; 36 | 37 | case "invalid_api_key": 38 | die("invalid API Key"); 39 | break; 40 | 41 | case "wrong_version": 42 | die("wrong program version"); 43 | break; 44 | 45 | case "old_api_version": 46 | die("please download the newest api version on the auth's website"); 47 | break; 48 | 49 | default: 50 | break; 51 | } 52 | } 53 | catch(Exception $ex){ 54 | die($ex->getMessage()); 55 | } 56 | } 57 | public static function c_login($c_username, $c_password){ 58 | $ch = curl_init(self::$api_link . "ins_handler.php?type=login"); 59 | curl_setopt($ch, CURLOPT_USERAGENT, self::$user_agent); 60 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 61 | 62 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 63 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 64 | curl_setopt($ch, CURLOPT_PINNEDPUBLICKEY, self::$pub_key); 65 | 66 | $values = [ 67 | "username" => $c_username, 68 | "password" => $c_password, 69 | "program_key" => $_SESSION["program_key"], 70 | "api_key" => $_SESSION["api_key"] 71 | ]; 72 | 73 | curl_setopt($ch, CURLOPT_POSTFIELDS, $values); 74 | 75 | $result = json_decode(curl_exec($ch)); curl_close($ch); 76 | 77 | switch($result->{'result'}){ 78 | case "invalid_username": 79 | c_api::alert("invalid username"); 80 | return false; 81 | 82 | case "invalid_password": 83 | c_api::alert("invalid password"); 84 | return false; 85 | 86 | case "user_is_banned": 87 | c_api::alert("The user is banned"); 88 | return false; 89 | 90 | case "no_sub": 91 | c_api::alert("no sub"); 92 | return false; 93 | 94 | case "logged_in": 95 | $_SESSION["username"] = $result->{'username'}; 96 | $_SESSION["email"] = $result->{'email'}; 97 | $_SESSION["expires"] = $result->{'expires'}; 98 | $_SESSION["rank"] = $result->{'rank'}; 99 | //saved to a session because i cant save the values to a static class 100 | 101 | c_api::alert("logged in"); 102 | return true; 103 | 104 | default: 105 | die($result); 106 | break; 107 | } 108 | } 109 | public static function c_register($c_username, $c_email, $c_password, $c_token){ 110 | $ch = curl_init(self::$api_link . "ins_handler.php?type=register"); 111 | curl_setopt($ch, CURLOPT_USERAGENT, self::$user_agent); 112 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 113 | 114 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 115 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 116 | curl_setopt($ch, CURLOPT_PINNEDPUBLICKEY, self::$pub_key); 117 | 118 | $values = [ 119 | "username" => $c_username, 120 | "email" => $c_email, 121 | "password" => $c_password, 122 | "token" => $c_token, 123 | "program_key" => $_SESSION["program_key"], 124 | "api_key" => $_SESSION["api_key"] 125 | ]; 126 | 127 | curl_setopt($ch, CURLOPT_POSTFIELDS, $values); 128 | 129 | $result = curl_exec($ch); curl_close($ch); 130 | 131 | switch($result){ 132 | case "user_already_exists": 133 | c_api::alert("user already exists"); 134 | return false; 135 | 136 | case "email_already_exists": 137 | c_api::alert("email already exists"); 138 | return false; 139 | 140 | case "invalid_email_format": 141 | c_api::alert("invalid email format"); 142 | return false; 143 | 144 | case "invalid_token": 145 | c_api::alert("invalid token"); 146 | return false; 147 | 148 | case "maximum_users_reached": 149 | c_api::alert("maximum users reached"); 150 | return false; 151 | 152 | case "used_token": 153 | c_api::alert("used token"); 154 | return false; 155 | 156 | case "success": 157 | c_api::alert("success"); 158 | return true; 159 | 160 | default: 161 | die($result); 162 | break; 163 | } 164 | 165 | } 166 | public static function c_activate($c_username, $c_password, $c_token){ 167 | $ch = curl_init(self::$api_link . "ins_handler.php?type=activate"); 168 | curl_setopt($ch, CURLOPT_USERAGENT, self::$user_agent); 169 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 170 | 171 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 172 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 173 | curl_setopt($ch, CURLOPT_PINNEDPUBLICKEY, self::$pub_key); 174 | 175 | $values = [ 176 | "username" => $c_username, 177 | "password" => $c_password, 178 | "token" => $c_token, 179 | "program_key" => $_SESSION["program_key"], 180 | "api_key" => $_SESSION["api_key"] 181 | ]; 182 | 183 | curl_setopt($ch, CURLOPT_POSTFIELDS, $values); 184 | 185 | $result = curl_exec($ch); curl_close($ch); 186 | 187 | switch($result){ 188 | case "invalid_username": 189 | c_api::alert("invalid username"); 190 | return false; 191 | 192 | case "invalid_password": 193 | c_api::alert("invalid password"); 194 | return false; 195 | 196 | case "user_is_banned": 197 | c_api::alert("The user is banned"); 198 | return false; 199 | 200 | case "invalid_token": 201 | c_api::alert("invalid token"); 202 | return false; 203 | 204 | case "used_token": 205 | c_api::alert("used token"); 206 | return false; 207 | 208 | case "success": 209 | c_api::alert("success"); 210 | return true; 211 | 212 | default: 213 | die($result); 214 | break; 215 | } 216 | } 217 | public static function c_all_in_one($c_token){ 218 | if(c_api::c_login($c_token, $c_token)) 219 | return true; 220 | 221 | else if(c_api::c_register($c_token, $c_token . "@gmail.com", $c_token, $c_token)) 222 | return true; 223 | 224 | else return false; 225 | } 226 | //no need for server sided variables here cause php already is server side 227 | public static function c_log($c_message){ 228 | if(empty($_SESSION["username"]) || !isset($_SESSION["username"])) $_SESSION["username"] = "NONE"; 229 | 230 | $ch = curl_init(self::$api_link . "ins_handler.php?type=log"); 231 | curl_setopt($ch, CURLOPT_USERAGENT, self::$user_agent); 232 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 233 | 234 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 235 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 236 | curl_setopt($ch, CURLOPT_PINNEDPUBLICKEY, self::$pub_key); 237 | 238 | $values = [ 239 | "username" => $_SESSION["username"], 240 | "message" => $c_message, 241 | "program_key" => $_SESSION["program_key"], 242 | "api_key" => $_SESSION["api_key"] 243 | ]; 244 | 245 | curl_setopt($ch, CURLOPT_POSTFIELDS, $values); 246 | 247 | curl_exec($ch); curl_close($ch); 248 | } 249 | 250 | public static function alert($string){ 251 | echo ""; 254 | } 255 | private static $api_link = "https://cauth.me/api/"; 256 | private static $user_agent = "Mozilla cAuth"; 257 | private static $pub_key = "sha256//Mk6vhbkCoRzUhXoUryC8tjIxmehtu4uLVhwqGQM9Cmc="; 258 | } 259 | -------------------------------------------------------------------------------- /functions/functions.php: -------------------------------------------------------------------------------- 1 | open($zip_output, ZipArchive::CREATE); //creates a zip file with the exe's name.zip 33 | 34 | $zip->addFile($exe_file, pathinfo($exe_file)['basename']); //add the real exe 35 | 36 | $zip->addFromString("obf_info.txt", $obf_info); //add the cfex output here 37 | 38 | if(!empty($dependencies)) //if there are dependencies 39 | foreach($dependencies as &$deps) //for each dependencies in the dependency array 40 | $zip->addFile($deps, pathinfo($deps)['basename']); //add the dependency to the zip file 41 | 42 | $zip->close(); 43 | 44 | return $zip_output; 45 | } 46 | 47 | function unpack_to_return_the_exe($zip_location){ //CAN ONLY CONTAINS ONE EXE 48 | $zip = new ZipArchive; 49 | $zip->open(realpath($zip_location)); //opens the zip file 50 | 51 | $result_array = array("file_to_obfuscate" => '', "dependencies" => array()); 52 | //defines the array return ^ 53 | 54 | for ($i = 0; $i < $zip->numFiles; $i++) { //get all the files in the zip file 55 | $filename = $zip->getNameIndex($i); //get the name of the current file 56 | $info = pathinfo($filename); //path info of the file 57 | 58 | if($info["extension"] == "exe"){ //in case the file is an exe, gen a random name to it and save it and link the name to the array return 59 | $file_to_obfuscate = "uploads/" . uniqid() . '.' . $info["extension"]; 60 | fwrite(fopen($file_to_obfuscate, "w"), $zip->getFromName($filename)); 61 | $result_array["file_to_obfuscate"] = $file_to_obfuscate; 62 | } 63 | else if($info["extension"] == "dll"){ //add data foreach dll dependency 64 | $dll_dependency = "uploads/" . $filename; 65 | fwrite(fopen($dll_dependency, "w"), $zip->getFromName($filename)); 66 | 67 | array_push($result_array["dependencies"], $dll_dependency); 68 | } 69 | else { 70 | $zip->close(); 71 | 72 | foreach(@$result_array["dependencies"] as &$val) 73 | @unlink(realpath($val)); 74 | //im not sure if the arrays are really defined, so i use @ to not throw exceptions 75 | 76 | @unlink($zip_location); 77 | @unlink($result_array["file_to_obfuscate"]); 78 | @unlink("uploads/" . $filename); 79 | 80 | die("there are files that arent .exe/.dll in the zip"); 81 | } 82 | } 83 | $zip->close(); 84 | unlink($zip_location); 85 | 86 | return $result_array; 87 | } 88 | 89 | //creates a xml project file to be used with confuser ex cli 90 | function create_temp_xml($file_path, $protection_options){ 91 | $path_info = pathinfo($file_path); 92 | $dir_name = realpath($path_info["dirname"]); 93 | 94 | $xml = new SimpleXMLElement(""); 95 | 96 | $xml->addAttribute("outputDir", $dir_name . "\obfuscated"); 97 | $xml->addAttribute("baseDir", $dir_name); 98 | $xml->addAttribute("xmlns", "http://confuser.codeplex.com"); // <- i dont think thats needed 99 | 100 | $rules = $xml->addChild("rule"); 101 | $rules->addAttribute("pattern", "true"); 102 | $rules->addAttribute("inherit", "false"); 103 | 104 | foreach ($protection_options as &$opt) { 105 | $protections = $rules->addChild("protection"); 106 | $protections->addAttribute("id", $opt); 107 | } 108 | 109 | $mdl = $xml->addChild("module"); 110 | $mdl->addAttribute("path", $path_info["basename"]); 111 | 112 | $xml_output_path = "projects/" . uniqid() . ".crproj"; 113 | 114 | $output = fopen($xml_output_path, "w"); 115 | fwrite($output, explode("\n", $xml->asXML(), 2)[1]); 116 | fclose($output); 117 | 118 | return realpath($xml_output_path); 119 | } 120 | 121 | function download_file($filename){ 122 | header("Content-Type: application/octet-stream"); 123 | header("Content-Transfer-Encoding: Binary"); 124 | header("Pragma: public"); 125 | header("Cache-Control: no-cache, must-revalidate"); 126 | header("Content-Disposition: attachment; filename=".basename($filename).";"); 127 | header("Content-Length: ".filesize($filename)); 128 | 129 | @readfile($filename); 130 | } 131 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 16 | 17 |
18 | token :
19 |
20 | 21 |
22 | -------------------------------------------------------------------------------- /logout.php: -------------------------------------------------------------------------------- 1 | 40 | hello 41 |

42 |
43 | options :
44 | anti tamper :
45 | constants :
46 | control flow :

47 | 48 | 49 | select your file : (only zip, exe and dll files are allowed)
50 |

51 | 52 |
53 | 54 | -------------------------------------------------------------------------------- /projects/index.html: -------------------------------------------------------------------------------- 1 | you shouldnt be here -------------------------------------------------------------------------------- /uploads/index.html: -------------------------------------------------------------------------------- 1 | you shouldnt be here -------------------------------------------------------------------------------- /uploads/obfuscated/index.html: -------------------------------------------------------------------------------- 1 | you shouldnt be here --------------------------------------------------------------------------------