[原创]把程序放在相册中

      我家里的网络不好,只能上baidu,sina,126...此类的大门户,有的时候想上传点程序到网上,也没有共用的空间,也没有可以共享的网络硬盘,可是我发现baidu还是有100M的相册可用,改个程序的扩展名到jpg,发现也不能上传.
     "安全性做得不错呀",我再看看baidu的修行,进行如下操作:jpg + exe = jpg ,哈哈,可以上传了.我的程序也上传了.可是一般却不知道如何 jpg - jpg = exe ,看来只好写一段脚本来完成这样的任务了.(为什么写脚本?因为别的程序也没有地方上传呀,脚本可以复制,粘贴,保存成js呀,哈哈)
      先看一下使用方法:
      1. jpg + exe = jpg
          [Win] + [R], cmd ,输入:
          jpgexe.js jpg1.jpg + exe1.exe jpgout.jpg
          程序exe1已经到图片jpgout.jpg 中了.看一下图片,正常呀,上传到baidu试试(记得选原始大小)也可以了吧.
      2. jpg - jpg = exe 
         [Win] + [R], cmd ,输入:
         jpgexe.js jpgout.jpg  exe2.exe
         程序exe2已经出来了,试一下,还是你的exe1吧.
 
      好了, 看一下脚本:
      
/*
    程序:evlon(阿牛)
    邮箱:evlon@126.com
    QQ  :273352165 
*/
function existsArg(args,argValue)
{
    
for(var i = 0;i<args.length; ++i)
    {
        
if(args.item(i) == argValue)
        {
            
return true;
        }
    }
    
    
return false;
}

Number.prototype.toBytes 
= function()
{
    
var n = this;
    
var s = new ActiveXObject("adodb.stream");
    s.Charset 
= "ASCII";
    s.Type 
= 2;
    s.Open();
    s.Position 
= 0;
    
    s.WriteText(String.fromCharCode(n 
& 0xff));
    s.WriteText(String.fromCharCode((n 
>> 8& 0xff));
    s.WriteText(String.fromCharCode((n 
>> 16& 0xff));
    s.WriteText(String.fromCharCode((n 
>> 24& 0xff));
    s.Position 
= 0;
    s.Type 
= 1;
    
var buf = s.Read(4);
    
    s.Close();
    
return buf;    
}

Number.fromBytes 
= function(buf)
{
    
var s = new ActiveXObject("adodb.stream");
    s.Type 
= 1;
    s.Open();
    s.Write(buf);
    
if(s.Size != 4)
        
throw 'Number.fromByte函数中,buf长度不对';
    s.Position 
= 0;
    s.Type 
= 2;
    s.Charset 
= "ASCII";

    
var str = s.ReadText(4);
    
var n = str.charCodeAt(0);    
    n 
|= (str.charCodeAt(1<< 8);
    n 
|= (str.charCodeAt(2<< 16);
    n 
|= (str.charCodeAt(3<< 24);
    s.Close();
    
    
return n;
}

function bindFile(picFile,exeFile,outFile)
{
    
var streamPic = new ActiveXObject("adodb.stream");
    streamPic.Type 
= 1;
    streamPic.Open();
    streamPic.LoadFromFile(picFile);
    streamPic.Position 
= streamPic.Size;
    
    
var streamExe = new ActiveXObject("adodb.stream");
    streamExe.Type 
= 1;
    streamExe.Open();
    streamExe.LoadFromFile(exeFile);
    streamExe.Position 
= 0;
    streamExe.CopyTo(streamPic,streamExe.Size);
    streamPic.Write(streamExe.Size.toBytes());
    streamExe.Close();
    streamPic.SaveToFile(outFile);
    streamPic.Close();

}

function exportExe(picFile,outFile)
{
    
var bRet = false;
    
var s = new ActiveXObject("adodb.stream");
    s.Type 
= 1;
    s.Open();
    s.LoadFromFile(picFile);
    s.Position 
= s.Size - 4;
    
var buf = s.Read(4);
    
var size = Number.fromBytes(buf);
    
if(size > 0)
    {
        
var pos =  s.Size - 4 - size;
        
if(pos >= 0)
        {
            s.Position 
= pos;
            
var exeData = s.Read(size);
            s.Close();
            s.Open();
            s.Write(exeData);
            s.SaveToFile(outFile);
            bRet 
= true;
        }
    }
    
    s.Close();
    
    
return bRet;
}

function main(args)
{
    
if(existsArg(args,"+"))
    {
        
var picFile = args.item(0).toString();
        
var exeFile = args.item(2).toString();
        
var outFile = args.item(3).toString();
        bindFile(picFile,exeFile,outFile);
    }
    
else
    {
        
var picFile = args.item(0).toString();
        
var outFile = args.item(1).toString();
        exportExe(picFile, outFile);
        
    }
}

main(WScript.Arguments);
    最好,祝大家愉快
posted @ 2006-11-06 09:34  阿牛  阅读(518)  评论(2编辑  收藏  举报