Skip to content

Instantly share code, notes, and snippets.

@hubs
Created December 19, 2018 02:03
Show Gist options
  • Save hubs/56d9ff10b8cbdab2478a4a8e6aabb941 to your computer and use it in GitHub Desktop.
Save hubs/56d9ff10b8cbdab2478a4a8e6aabb941 to your computer and use it in GitHub Desktop.
Free Online PHP encryption, decryption, confused source tools -toolfk online Programmer toolbox
      This paper to recommend \[ToolFk\] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports   [BarCode Barcode generated online ](https://www.toolfk.com/tool-generator-barcode "BarCode Barcode generated online"),  [QueryList collector ](https://www.toolfk.com/tool-run-reptile "QueryList collector"),  [PHP code is run online ](https://www.toolfk.com/tool-online-runphp "PHP code online operation"),  [PHP confusion, encryption, decryption ](https://www.toolfk.com/tool-convert-php "PHP confusion, encryption, decryption"),  [Python code is run online ](https://www.toolfk.com/tool-online-runpython "Python code runs online"), [JavaScript online operation ](https://www.toolfk.com/tool-online-runjs "JavaScript online operation"),[YAML formatting tools](https://www.toolfk.com/tool-format-yaml "YAML formatting tools") , [HTTP simulation query tool ](https://www.toolfk.com/tool-online-http "HTTP query tool simulation"), [HTML online toolbox ](https://www.toolfk.com/tool-format-html "HTML Online Toolbox"), [JavaScript online Toolbox ](https://www.toolfk.com/tool-format-javascript "JavaScript toolkit online"),[CSS online toolbox ](https://www.toolfk.com/tool-format-css "CSS Online Toolbox"), [JSON online toolbox ](https://www.toolfk.com/tool-format-json "JSON Online Toolbox"), [unixtime timestamp conversion ](https://www.toolfk.com/tool-convert-unixtime "Unixtime timestamp conversion"), [Base64 / the URL of / native2ascii conversion ](https://www.toolfk.com/tool-encdec-transform "Base64 / URL / Native2Ascii conversion"), [CSV conversion kit ](https://www.toolfk.com/tool-convert-csv "CSV Converter Toolkit"), [XML online toolbox ](https://www.toolfk.com/tool-format-xml "XML Online Toolbox"), [the WebSocket online tools ](https://www.toolfk.com/tool-online-runwebsocket "WebSocket online tools"), [Markdown online toolbox ](https://www.toolfk.com/tool-convert-markdown "Markdown Online Toolbox"), [Htaccess2nginx conversion](https://www.toolfk.com/tool-convert-htaccess2nginx "Htaccess2nginx conversion"), [Hex conversion online ](https://www.toolfk.com/tool-convert-hexadecimal "Online hex conversion"), [online encryption toolkit ](https://www.toolfk.com/tool-convert-encryption "Online Encryption Toolkit"),[online pseudo-original tools ](https://www.toolfk.com/tool-convert-text "Online pseudo-original tool"), [online APK decompile ](https://www.toolfk.com/tool-decompile-apk "Online APK decompile"), [online web screenshot tool ](https://www.toolfk.com/tool-screen-captures "Online web screenshot tool"), [online random password generation ](https://www.toolfk.com/tool-password-generator "Online Random Password Generator"), [online generate two-dimensional code qrcode ](https://www.toolfk.com/tool-generate-qrcode "Online generated two-dimensional code Qrcode"), [online Crontab Expression Builder ](https://www.toolfk.com/tool-generate-crontab "Online Crontab Expression Builder"),[the online short URL Generator ](https://www.toolfk.com/tool-short-url "Online Short URL Generator"), [Online calculator tool ](https://www.toolfk.com/tool-game-calculator "Online calculator tool"). And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
Site name: ToolFk
website links: [https://www.toolfk.com/](https://www.toolfk.com/)
Tools link: [https://www.toolfk.com/tool-convert-php](https://www.toolfk.com/tool-convert-php)
 Teaching Code
--------------
This code \[online PHP encryption, decryption, confused source tools\] CSDN rely on a friend's code base? Since long before the draw over. So not remember his blog link. In this sorry. PHP code to achieve the following
STEP 1
[![](https://4.bp.blogspot.com/-ud4RNcY95fQ/XA8trK8VRMI/AAAAAAAAAF8/WTCVuyq3b3ABA7teu7zkWRtigo9pRPcTgCEwYBhgL/s1600/confusion.png)](https://4.bp.blogspot.com/-ud4RNcY95fQ/XA8trK8VRMI/AAAAAAAAAF8/WTCVuyq3b3ABA7teu7zkWRtigo9pRPcTgCEwYBhgL/s1600/confusion.png)
STEP 2
?? IS DEPENDENT ON THE PHP CLASS. USE A NEW DIRECT OBJECT, CALL ITS METHODS ON THE LINE.THANKS AGAIN FOR THE AUTHOR'S FREELY AVAILABLE.
```
class PhpEncode
{
function is_cli ()
{
return php_sapi_name () == 'cli' 1:? 0;
}
function rstr () // Random String Function
{
$ Len = rand (3, 6);
$ Chr = '';
for ($ i = 1; $ i <= $ len; $ i ++) {
. $ Chr = rand (0, 1) chr (rand (65, 90)):? Chr (rand (97, 122));
}
return $ chr;
}
function enjumble ($ data) // Custom Encoding + Base64 + gzinflate ()
{
for ($ i = 0; $ i <strlen ($ data); $ i ++) {
$ Data [$ i] = chr (ord ($ data [$ i]) + 1);
}
return base64_encode (gzdeflate ($ data, 9));
}
function striptag ($ in) // Remove '<? php' from initial code
{
$ Pos = strpos ($ in, "? <Php"); // to do: add support for short_tags
if (is_numeric ($ pos)) {
for ($ i = $ pos; $ i <= $ pos + 4 && strlen ($ in)> = 5; $ i ++) {
$ In [$ i] = '';
}
return $ in;
} Else {
return $ in;
}
}
function makeoutfile ($ str)
{
$ Funcname = $ this-> rstr ();
. $ Varname = '$' $ this-> rstr ();
$ Template = "<? Php function". $ Funcname. "($ Varname)
{
$ Varname = gzinflate (base64_decode ($ varname));
for (\ $ i = 0; \ $ i <strlen ($ varname); \ $ i ++)
{
". $ Varname." [\ $ I] = chr (ord ([\ $ i]) - 1 "$ varname..");
}
return $ varname;
} Eval ($ funcname (\ "";
$ Str = $ this-> enjumble ($ str);
$ Template = $ template $ str "\"));..?> ";
return $ template;
}
function confound ($ input)
{
return $ this-> makeoutfile ($ this-> striptag ($ input));
}
// ===== encode 2
private $ c = ''; // store ciphertext
private $ s = '', $ q1, $ q2, $ q3, $ q4, $ q5, $ q6; // store the generated encrypted content file
// If you do not set a value, isset means that there will be;
private $ file = ''; // read file path
private $ source = '', $ target = '';
// constructor calls an initialization global variable instantiation;
public function __construct () {
// Initialize global variables
$ This-> initialVar ();
// echo "hello \ n";
}
/ *
* @ Input $ property_name, $ value
* @ Output
* Magic method, set values ​​of variables; may be treated according to the needs. If removed directly determines if any value is represented by the set of properties, including properties not present;
* /
public function __set ($ property_name, $ value) {
// define variables off;
if (isset ($ this -> $ property_name)) {
$ This -> $ property_name = $ value;
} Else {
// exception handling, processing undeclared variable assignment; it can be processed according to the needs.
throw new Exception ( "property does not exist");
}
}
// remove the magic value of the variable method;
public function __get ($ property_name) {
if (isset ($ this -> $ property_name)) {
return $ this -> $ property_name;
} Else {
// throw new Exception ( "property does not exist");
return NULL;
}
}
// get random order
private function RandAbc ($ length = "") {// retrieve random ordering
$ Str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
return str_shuffle ($ str);
}
// encrypt the plaintext content
private function ciphertext ($ input) {
//$filename='index.php ';
$ T_k1 = $ this-> RandAbc ();
$ T_k2 = $ this-> RandAbc ();
$ V1 = base64_encode ($ input);
$ C = strtr ($ v1, $ T_k1, $ T_k2);
.. $ This-> c = $ T_k1 $ T_k2 $ c;
return $ this;
}
//Initialize variables
private function initialVar () {
$ This-> q1 = "O00O0O"; // base64_decode
$ This-> q2 = "O0O000"; // $ c (ciphertext through the description strtr replaced by the replacement character object character + + the base64_encode ( 'original language') constituted)
$ This-> q3 = "O0OO00"; // strtr
$ This-> q4 = "OO0O00"; // substr
$ This-> q5 = "OO0000"; // 52
$ This-> q6 = "O00OO0"; // urldecode parsed string (n1zb / ma5 \ vt0i28-pxuqy * 6% 6Crkdg9_ehcswo4 + f37j)
}
// generate a template (complex version) encrypted;
private function model () {
// $ c = $ this-> c;
// $ this-> initialVar ();
$ This-> s = '<? Php $'. $ This-> q6. '= Urldecode ( "% 6E1% 7A% 62% 2F% 6D% 615% 5C% 76% 740% 6928% 2D% 70% 78 % 75% 71% 79% 2A6% 6C% 72% 6B% 64% 679% 5F% 65% 68% 63% 73% 77% 6F4% 2B% 6637% 6A "); $ '.
$ This-> q1. '= $'. $ This-> q6. '{3}. $'. $ This-> q6. '{6}. $'. $ This-> q6. '{33}. $ '. $ this-> q6.' {30}; $ '.. $ this-> q3' = $ '. $ this-> q6.' {33} $ '$ this-> q6..' {. 10}. $ '
.. $ This-> q6 '. {24} $' $ this-> q6 '{10} $.' $ This-> q6..... '{24}; $' $ this-> q4 '. = $ '. $ this-> q3.' {0}. $ '. $ this-> q6.' {18}. $ '. $ this-> q6.' {3}. $ '. $ this-> q3. '{0}
.. $ '.. $ This-> q3' {1} $ '$ this-> q6..' {24}; '. $ This-> q5.' $ = $ '$ This-> q6..' . {7} $ '. $ this-> q6.' {13}; $ = $ '$ this-> q6..' {22} $ '$ this-' $ this-> q1.. '... > q6. '{36}
. $ '. $ This-> q6.' {29}. $ '. $ This-> q6.' {26}. $ '. $ This-> q6.' {30}. $ '. $ This-> .. q6 '. {32} $' $ this-> q6 '{35} $.' $ this-> q6 '{26} $.' $ this-> q6 '{30}.....;
eval ($ '.. $ this-> q1' ( " '. base64_encode (' $ '$ this-> q2..' =" " '$ this-> c..';
eval (\ '?> \'. $ '. $ this-> q1.' ($ '. $ this-> q3.' ($ '. $ this-> q4.' ($ '. $ this-> q2 . ', $'. $ this-> q5. '* 2), $'. $ this-> q4. '($'. $ this-> q2. ', $'. $ this-> q5. ', $ '. $ this-> q5.'),
$ '.. $ This-> q4' ($ '.. $ This-> q2', 0, $ '. $ This-> q5.')))); ').' "));?> ' ;
return $ this;
}
// Create an encrypted file
private function build ($ target) {
//$this->encodes("./index.php ");
// $ this-> model ();
$ Fpp1 = fopen ($ target, 'w');
fwrite ($ fpp1, $ this-> s) or die ( 'write failure!');
fclose ($ fpp1);
return $ this;
}
// operations encryption process consistent
public function encode ($ input) {
// $ file = "index.php";
// coherent operation is actually using the function itself returns after treatment
return $ this-> ciphertext ($ input) -> model () -> s;
}
// decryption
public function decode ($ out) {
// read the file you want to decrypt
try {
return @ $ this-> decodeMode ($ out) -> s;
} Catch (FatalThrowableError $ e) {
return "decode error";
}
}
// decryption template to obtain the decrypted text
private function decodeMode ($ fpp1) {
// mark as taken in eval array, replace the first part of the ciphertext function name out of the second half ciphertext
$ M = explode ( 'eval', $ fpp1);
// replacement portion of system functions for execution, the system variables to give
$ VarStr = substr ($ m [0], strpos ($ m [0], '$'));
// After the execution, the subsequent use of the system can replace the function name
eval ($ varStr);
// determine whether ciphertext
if (! isset ($ m [1])) {
return $ this;
}
// ciphertext taken {$ this-> q4} substr
$ Star = strripos ($ m [1], '(');
$ End = strpos ($ m [1], ')');
$ Str = $ {$ this-> q4} ($ m [1], $ star, $ end);
// decrypt a ciphertext {$ this-> q1} base64_decode
$ Str = $ {$ this-> q1} ($ str);
// core taken out of the decrypted ciphertext
$ Evallen = strpos ($ str, 'eval');
$ Str = substr ($ str, 0, $ evallen);
// execute the ciphertext core system variable is assigned a value $ O0O000
eval ($ str);
// can not package the following section, because $ {$ this-> qn} and can not function at full
$ This-> s = $ {$ this-> q1} (
$ {$ This-> q3} (
$ {$ This-> q4} (
$ {$ This-> q2}, $ {$ this-> q5} * 2
),
$ {$ This-> q4} (
$ {$ This-> q2}, $ {$ this-> q5}, $ {$ this-> q5}
),
$ {$ This-> q4} (
$ {$ This-> q2}, 0, $ {$ this-> q5}
)
)
);
return $ this;
}
// recursive read and create the target directory structure
private function targetDir ($ target) {
if (! empty ($ target)) {
if (! file_exists ($ target)) {
mkdir ($ target, 0777, true);
} Else {
chmod ($ target, 0777);
}
}
}
// recursive decryption under the specified folder php file decryption
public function decodeDir ($ source, $ target = "") {
if (is_dir ($ source)) {
$ This-> targetDir ($ target);
$ Dir = opendir ($ source);
while (false! = $ file = readdir ($ dir))
{
// list all the files and remove the '.' And '..' is used here as an example thinkphp framework, so the default rule out in Thinkphp directory, users can set their own needs
if ($ file! = '.' && $ file! = '..' && $ file! = 'ThinkPHP')
{
. $ Path = $ target.DIRECTORY_SEPARATOR $ file;
. $ SourcePath = $ source.DIRECTORY_SEPARATOR $ file;
$ This-> decodeDir ($ sourcePath, $ path);
}
}
} Else if (is_file ($ source)) {
$ Extension = substr ( '.' $ Source, strrpos ($ source,) + 1);
if (strtolower ($ extension) == 'php') {
$ This-> decode ($ source, $ target);
} Else {
// not a php file does not deal with
copy ($ source, $ target);
}
// return;
}
}
Php // recursive encryption of files in the specified folder encryption
public function encodeDir ($ source, $ target) {
if (is_dir ($ source)) {
$ This-> targetDir ($ target);
$ Dir = opendir ($ source);
while (false! = $ file = readdir ($ dir))
{
// list of all files and remove and '.' '..'
if ($ file! = '.' && $ file! = '..' && $ file! = 'ThinkPHP')
{
. $ Path = $ target.DIRECTORY_SEPARATOR $ file;
. $ SourcePath = $ source.DIRECTORY_SEPARATOR $ file;
$ This-> encodeDir ($ sourcePath, $ path);
}
}
} Else if (is_file ($ source)) {
$ Extension = substr ( '.' $ Source, strrpos ($ source,) + 1);
if (strtolower ($ extension) == 'php') {
$ This-> encode ($ source, $ target);
} Else {
copy ($ source, $ target);
}
}
}
}
```
It is worth a try for three reasons:
------------------------------------
1. Integrate various programmers often used in development and testing tools.
2. Simple and beautiful atmosphere of the site pages
3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
4. Also recommend its sister network  [www.videofk.com](http://www.videofk.com/)  video download Toolbox 
> This link: [http://www.hihubs.com/article/360](http://www.hihubs.com/article/360)
### 標籤
[confused](https://toolfk.blogspot.com/search/label/confused) [decryption](https://toolfk.blogspot.com/search/label/decryption) [online Programmer toolbox](https://toolfk.blogspot.com/search/label/online%20Programmer%20toolbox) [PHP encryption](https://toolfk.blogspot.com/search/label/PHP%20encryption) [toolfk online tools](https://toolfk.blogspot.com/search/label/toolfk%20online%20tools)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment