?轉(zhuǎn)載:二少's?Blog
US-ASCII加密,就是把7bit轉(zhuǎn)換為8bit
原始的代碼
程序代碼:
程序代碼
< 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 >
加密后的代碼
程序代碼:
程序代碼
< html >
< head >
< meta? http-equiv ="Content-Type" ?content ="text/html;?charset=US-ASCII" ? />
< title > IE </ title >
</ head >< body >
艱繇煬娂糸綮寰箴蜷翦犅祜緙軫戾緤儉瀘軻艟犰弳舁屐祜犠矧熹З集筱蜷痿緺娂怙澌緤堅(jiān)犺蟈娼㈣趑鷙鼢鱒箴蟣舫鐲⒕梏麴函鼢痱?yàn)l鈔泔砑緤集怙澌緤集梏盱?
</ body ></ html >
加密解密程序
程序代碼:
#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;
}//指定編碼為US-ASCII是必須的
printf("\n < html > \n < head > \n < meta? http-equiv =\"Content-Type\"? content =\"text/html;? charset =US-ASCII\"? /> \n < title > Bypassing?of?web?filters?by?using?ASCII?Exploit?By?CoolDiyer </ title > \n </ head >< body > \n");
while((ch=fgetc(fp))!=EOF){
ch|=0x80;?//把7位變成8位,這句話是核心,解密時(shí)用?ch&=0x7f
printf("%c",ch);
};
fclose(fp);
printf("\n </ body ></ html > \n");
return?-1;
}
解密只要把每個(gè)字節(jié)的高位置0即可。還有一個(gè)更簡(jiǎn)單的方法,網(wǎng)頁(yè)“另存為”保存的時(shí)候,在語(yǔ)言選項(xiàng)將“西歐(windows)”改成“簡(jiǎn)體GB2312”,然后保存在本地。
unicode編碼前
程序代碼:
程序代碼
< html >
< title > 7jdg's?Blog </ title >
< script > alert('Hello?World') </ script >
< body >
< a? href ="http://1v1.name" > http://1v1.name </ a >
</ body >
</ html >
unicode編碼以后的形式
程序代碼:
程序代碼
< html >
< title > 7jdg's?Blog </ title >
< script > alert('Hello?World') </ script >
< body >
< a? href ="http://1v1.name" > http://1v1.name </ a >
</ body >
</ html >
加密程序
US-ASCII加密,就是把7bit轉(zhuǎn)換為8bit
原始的代碼
程序代碼:
程序代碼
< 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 >
加密后的代碼
程序代碼:
程序代碼
< html >
< head >
< meta? http-equiv ="Content-Type" ?content ="text/html;?charset=US-ASCII" ? />
< title > IE </ title >
</ head >< body >
艱繇煬娂糸綮寰箴蜷翦犅祜緙軫戾緤儉瀘軻艟犰弳舁屐祜犠矧熹З集筱蜷痿緺娂怙澌緤堅(jiān)犺蟈娼㈣趑鷙鼢鱒箴蟣舫鐲⒕梏麴函鼢痱?yàn)l鈔泔砑緤集怙澌緤集梏盱?
</ body ></ html >
加密解密程序
程序代碼:
#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;
}//指定編碼為US-ASCII是必須的
printf("\n < html > \n < head > \n < meta? http-equiv =\"Content-Type\"? content =\"text/html;? charset =US-ASCII\"? /> \n < title > Bypassing?of?web?filters?by?using?ASCII?Exploit?By?CoolDiyer </ title > \n </ head >< body > \n");
while((ch=fgetc(fp))!=EOF){
ch|=0x80;?//把7位變成8位,這句話是核心,解密時(shí)用?ch&=0x7f
printf("%c",ch);
};
fclose(fp);
printf("\n </ body ></ html > \n");
return?-1;
}
解密只要把每個(gè)字節(jié)的高位置0即可。還有一個(gè)更簡(jiǎn)單的方法,網(wǎng)頁(yè)“另存為”保存的時(shí)候,在語(yǔ)言選項(xiàng)將“西歐(windows)”改成“簡(jiǎn)體GB2312”,然后保存在本地。
unicode編碼前
程序代碼:
程序代碼
< html >
< title > 7jdg's?Blog </ title >
< script > alert('Hello?World') </ script >
< body >
< a? href ="http://1v1.name" > http://1v1.name </ a >
</ body >
</ html >
unicode編碼以后的形式
程序代碼:
程序代碼
< html >
< title > 7jdg's?Blog </ title >
< script > alert('Hello?World') </ script >
< body >
< a? href ="http://1v1.name" > http://1v1.name </ a >
</ body >
</ html >
加密程序
程序代碼:
程序代碼
<?
$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;
}
}
?>
這樣的unicode編碼,也可以通過(guò)另存為解密
或者是
程序代碼:
程序代碼
<?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);
}
?>
程序代碼
<?
$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;
}
}
?>
這樣的unicode編碼,也可以通過(guò)另存為解密
或者是
程序代碼:
程序代碼
<?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);
}
?>