US-ASCII encryption is to convert 7bit to 8bit
Original code
Program code:
Program code
<HTML>
<Title> sprite's blog </title>
<SCRIPT> alert ('Hello World') </SCRIPT>
<Body>
<A href = "http://www.spr1t3.com"> http://www.spr1t3.com </a>
</Body>
</Html>
Encrypted code
Program code:
Program code
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = US-ASCII"/>
<Title> ie </title>
</Head> <body>
These two problems are as follows: are you sure you want?
</Body> Encryption and decryption program
Program code:
Program code
# Include <stdio. h>
Int main (INT argc, char ** argv)
{
File * FP;
Char ch;
Printf ("\ n -- bypassing of Web filters by using ASCII exploit by cooldiyer -- \ n ");
If (argc <2 ){
Printf ("\ nusage: \ n \ t % s srcfile> destfile \ n", argv [0]);
Return-1;
}
If (FP = fopen (argv [1], "R") = NULL ){
Printf ("file % s open error", argv [1]);
Return-1;
} // Specifies that encoding is required for the US-ASCII
Printf ("\ n <HTML> \ n While (CH = fgetc (FP ))! = EOF ){
Ch | = 0x80; // convert 7-bit to 8-bit. This statement is the core and ch & = 0x7f is used for decryption.
Printf ("% C", CH );
};
Fclose (FP );
Printf ("\ n </body> Return-1;
}
For decryption, you only need to set the height of each byte to 0. Another simpler method is to change "Western Europe (Windows)" to "simplified gb2312" in the language option when saving the webpage as "Save as", and then save it locally.
Before unicode encoding
Program code:
Program code
<HTML>
<Title> 7jdg's blog </title>
<SCRIPT> alert ('Hello World') </SCRIPT>
<Body>
<A href = "http://1v1.name"> http://1v1.name </a>
</Body>
</Html>
Unicode encoded form
Program code:
Program code
<HTML>
<Title> 7jdg's blog </title>
<SCRIPT> alert ('Hello World') </SCRIPT>
<Body>
<A href = "http://1v1.name"> http://1v1.name </a>
</Body>
</Html>
Encryption program
Program code:
Program code
<?
$ Text = "http://1v1.name ";
Preg_match_all ("/[\ X80-\ xFF]?. /", $ Text, $ AR );
Foreach ($ ar [0] as $ V)
Echo "". utf8_unicode (iconv ("gb2312", "UTF-8", $ V )).";";
?>
<?
// Utf8-> Unicode
Function utf8_unicode ($ c ){
Switch (strlen ($ C )){
Case 1:
Return ord ($ C );
Case 2:
$ N = (ord ($ C [0]) & 0x3f) <6;
$ N + = ord ($ C [1]) & 0x3f;
Return $ N;
Case 3:
$ N = (ord ($ C [0]) & 0x1f) <12;
$ N + = (ord ($ C [1]) & 0x3f) <6;
$ N + = ord ($ C [2]) & 0x3f;
Return $ N;
Case 4:
$ N = (ord ($ C [0]) & 0x0f) <18;
$ N + = (ord ($ C [1]) & 0x3f) <12;
$ N + = (ord ($ C [2]) & 0x3f) <6;
$ N + = ord ($ C [3]) & 0x3f;
Return $ N;
}
}
?>
Such unicode encoding can also be saved as decryption.
Or
Program code:
Program code
<? PHP
$ STR = "http://1v1.name ";
$ STR = preg_replace ("| ([0-9] {1, 5}); |", "\". u2utf82gb (\ 1). \ "", $ Str );
$ STR = "\ $ STR = \" $ STR \";";
Eval ($ Str );
Echo $ STR;
Function u2utf82gb ($ c ){
$ STR = "";
If ($ C <0x80 ){
$ Str. = $ C;
} Else if ($ C <0x800 ){
$ Str. = CHR (0xc0 | $ C> 6 );
$ Str. = CHR (0x80 | $ C & 0x3f );
} Else if ($ C <0x10000 ){
$ Str. = CHR (0xe0 | $ C> 12 );
$ Str. = CHR (0x80 | $ C> 6 & 0x3f );
$ Str. = CHR (0x80 | $ C & 0x3f );
} Else if ($ C <0x200000 ){
$ Str. = CHR (0xf0 | $ C> 18 );
$ Str. = CHR (0x80 | $ C> 12 & 0x3f );
$ Str. = CHR (0x80 | $ C> 6 & 0x3f );
$ Str. = CHR (0x80 | $ C & 0x3f );
}
Return iconv ('utf-8', 'gb2312 ', $ Str );
}
?>