开发需求:比如有时下载个东西,上面的地址是flashget地址,你用迅雷就无法下载,那么就要进行地址转换。
要想开发这个必须知道迅雷,快车及旋风的加密方式,经过参考网上很多的此类似工具转换得出以下:
【注:转载此文请注明转载地址或加上我的博客地址http://www.ajaxcn.net/archives/1013】
迅雷的加密的方式:
thunder://"+使用base64转换加密("AA"+下载地址+"ZZ");
代码="thunder://"+Base64.encode("AA"+txtresult.text+"ZZ");
快车的加密的方式:
flashget://"+使用base64转换加密("[FLASHGET]"+下载地址+"[FLASHGET]")+"&111";//&后可随意
旋风加密的方式:
"qqdl://"+使用base64转换加密(下载地址);
以上是加密,解密的话就是反向求出上面的下载地址
比如迅雷:先要去掉thunder:// 就是要截断去掉前10个字,然后通过base64转换解密再去掉
"AA"和"ZZ"字母,在flex中代码大致如下:
url=url.substr(10,url.length-10);
str=Base64.decode(url);
str=str.substr(2,str.length-4);
另外说明:上面 Base64.encode,Base64.decode,Base64在flex中并没有内置函数,需要引用一个as3base64.swc,
并且需要引用 import com.dynamicflash.util.Base64;具体使用不明白请参考:http://www.dynamicflash.com/goodies/base64
其它快车和旋风解密类似,具体看代码吧!
演示地址:http://www.ajaxcn.net/tools/httpconvert/httpconvert.html
源码下载地址:
httpconver (23.8 KiB, 1 hits)
全部flex mxml文件如下:
代码
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" >
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.dynamicflash.util.Base64;
import mx.controls.Alert;
import mx.utils.ArrayUtil;
protected function btnC_clickHandler(event:MouseEvent):void
{
if(txtresult.text=='')
{
mx.controls.Alert.show("请输入链接地址");
return;
}
var str:String ='';
str+="迅雷加密后:\n";
str+="thunder://"+Base64.encode("AA"+txtresult.text+"ZZ");
str+="\n";
str+="快车加密后:\n";
str+="flashget://"+Base64.encode("[FLASHGET]"+txtresult.text+"[FLASHGET]")+"&www.ajaxcn.net";
str+="\n";
str+="旋风加密后:\n";
str+="qqdl://"+Base64.encode(txtresult.text);
str+="\n";
lblresult.text=str;
}
protected function btnR_clickHandler(event:MouseEvent):void
{
var url:String=new String();
url=txtresult.text;
var str:String="";
if(url.toLowerCase().indexOf("thunder")>-1)
{
url=url.substr(10,url.length-10);
str=Base64.decode(url);
str=str.substr(2,str.length-4);
str="迅雷解密后:"+str;
lblresult.text=str;
}
else if(url.toLowerCase().indexOf("flashget")>-1)
{
url=url.substr(11,(url.length-11-(url.length-url.indexOf("&"))));
str=Base64.decode(url);
str=str.substr(10,str.length-20);
str="快车解密后:"+str;
lblresult.text=str;
}
else if(url.toLowerCase().indexOf("qqdl")>-1)
{
url=url.substr(7,url.length-7);
str=Base64.decode(url);
str="旋风解密后:"+str;
lblresult.text=str;
}
else
{
Alert.show("地址出错");
}
}
protected function btncopy_clickHandler(event:MouseEvent):void
{
System.setClipboard(lblresult.text);
Alert.show("复制成功!");
}
]]>
</fx:Script>
<s:TextInput id="txtresult" x="118" y="108" width="594"/>
<s:Button x="731" y="106" label="加密" id="btnC" click="btnC_clickHandler(event)" />
<s:Button x="809" y="106" label="解密" id="btnR" click="btnR_clickHandler(event)"/>
<s:Label x="61" y="118" text="链接地址:"/>
<s:Label x="75" width="80%" y="168" text="结果:"/>
<s:TextArea id="lblresult" x="118" y="168" width="601"/>
<s:Button toolTip="把结果复制到剪切板" id="btncopy" x="727" y="246" label="复制结果" click="btncopy_clickHandler(event)"/>
<s:Label x="118" y="41" text="欢迎使用云飞扬IT开发的在线迅雷、快车、旋风与页面加解密" fontFamily="中易宋体" fontSize="20" width="663"/>
</s:Application>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" >
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.dynamicflash.util.Base64;
import mx.controls.Alert;
import mx.utils.ArrayUtil;
protected function btnC_clickHandler(event:MouseEvent):void
{
if(txtresult.text=='')
{
mx.controls.Alert.show("请输入链接地址");
return;
}
var str:String ='';
str+="迅雷加密后:\n";
str+="thunder://"+Base64.encode("AA"+txtresult.text+"ZZ");
str+="\n";
str+="快车加密后:\n";
str+="flashget://"+Base64.encode("[FLASHGET]"+txtresult.text+"[FLASHGET]")+"&www.ajaxcn.net";
str+="\n";
str+="旋风加密后:\n";
str+="qqdl://"+Base64.encode(txtresult.text);
str+="\n";
lblresult.text=str;
}
protected function btnR_clickHandler(event:MouseEvent):void
{
var url:String=new String();
url=txtresult.text;
var str:String="";
if(url.toLowerCase().indexOf("thunder")>-1)
{
url=url.substr(10,url.length-10);
str=Base64.decode(url);
str=str.substr(2,str.length-4);
str="迅雷解密后:"+str;
lblresult.text=str;
}
else if(url.toLowerCase().indexOf("flashget")>-1)
{
url=url.substr(11,(url.length-11-(url.length-url.indexOf("&"))));
str=Base64.decode(url);
str=str.substr(10,str.length-20);
str="快车解密后:"+str;
lblresult.text=str;
}
else if(url.toLowerCase().indexOf("qqdl")>-1)
{
url=url.substr(7,url.length-7);
str=Base64.decode(url);
str="旋风解密后:"+str;
lblresult.text=str;
}
else
{
Alert.show("地址出错");
}
}
protected function btncopy_clickHandler(event:MouseEvent):void
{
System.setClipboard(lblresult.text);
Alert.show("复制成功!");
}
]]>
</fx:Script>
<s:TextInput id="txtresult" x="118" y="108" width="594"/>
<s:Button x="731" y="106" label="加密" id="btnC" click="btnC_clickHandler(event)" />
<s:Button x="809" y="106" label="解密" id="btnR" click="btnR_clickHandler(event)"/>
<s:Label x="61" y="118" text="链接地址:"/>
<s:Label x="75" width="80%" y="168" text="结果:"/>
<s:TextArea id="lblresult" x="118" y="168" width="601"/>
<s:Button toolTip="把结果复制到剪切板" id="btncopy" x="727" y="246" label="复制结果" click="btncopy_clickHandler(event)"/>
<s:Label x="118" y="41" text="欢迎使用云飞扬IT开发的在线迅雷、快车、旋风与页面加解密" fontFamily="中易宋体" fontSize="20" width="663"/>
</s:Application>