Automatic download of online programs with WinRAR

zhaozj2021-02-16  29

Author: Wang Haixuan e-mail: wanghaixuan@lianchuang.com

Automatic download of online programs with WinRAR

Nanjing Wang Haixuan

summary:

This article explains how to use WinRAR's self-demired function to implement the automatic download of online programs. The so-called "automatic" is that the user has no sense, and the program is already installed on the computer. Of course, if this function is used for unfair ways (such as manufacturing viruses, Trojans), it is not the purpose of this article.

I. Introduction

The author encountered a problem when it is an online application process for a tax bureau: how to automatically update the app on the local machine. Because, if you are prompted to save when the company is updated, you don't know what to do if you are prompted when you're available. Moreover, local client programs should be communicated with the server. For security reasons, they don't want them to know where the program is. That is, the user does not know where the program is downloaded, and only let the program automatically downloads to a place to machine, if the server-side program version is updated, download the update client again.

I have seen an article about "Web Trojans" on the Internet, how is it unknowing the program (Exe program) to the user's computer. The author thinks that if I pack the program you need to download into an executable program, wait until the program is downloaded to the client, and the above requirements can be achieved. After contrast, I chose WinRAR compression tool.

WinRAR not only has high compression ratio, but it can easily make automatic uncompressed EXE file packages. In addition, through a "annotation file" (RAR compression package dedicated .txt file), you can also set the target path to decompress the download, create shortcuts, version information, etc. Thereby achieving automatic, concealed, fast, foolified installation procedures to user desktops.

Second, the program is realized

1, WinRar introduction

WinRAR is a 32-bit Windows version of RAR Compressed File Manager - a powerful tool that allows you to create, manage, and control compressed files. From the command line, you can also run the WinRAR command, and the regular command line syntax is as follows:

WinRAR - - <@ list file ...>

Detailed command, switch and other parameters to visit WinRAR assistance, the author uses WinRAR3.11 Chinese version.

2, create WinRAR self-extract files

l Create a C: / Test folder (here only testing, you can create anywhere).

l Create a WeTaxClient directory in C: / Test, placing programs that need to package them.

l Create a Test.bat batch file.

Edit Test.bat file, type:

C: /Progra ~ 1/winrar/winrar.exe a -sfx -ep1 -ag -m5 WebTax C: / Test / WebTaxClient

REM Add Note

C: /Progra ~ 1/winrar/winrar.exe c: / test/inf.txt C: / test / *. EXE

My computer is installed under C: / Program files, you can modify the above depending on the situation.

l Create Inf.txt.

The Inf.txt content is as follows:

Title = XXX National Taxation Bureau Online Declaration System 2003

TEXT

{

Some system descriptions and copyright information, etc. ...

}

PATH = C: / Program Files /

SavePath

Setup = c: /progra ~1/webtax ~ 1/Message.exesilent=1

Overwrite = 1

Shortcut = D, C: / Program Files / WebTaxClient / Login.htm, XXX National Taxation Bureau Online Declaration System 2003, Online Declaration System 2003

The above is exiled from the actual project. Among them, the important parameters are:

PATH represents the decompression target path;

Setup indicates the program that runs first after the decompression is completed. Here, Message.exe is our for friendly reminder users, specially written a program to prompt "program update!". This file is not possible.

When Silent is set to 1, the WinRAR window is not displayed, which can be decompressed.

Whether OverWrite covers the original program file, set to 1.

Shortcut creates shortcuts in the user desktop

3. Make the test page file (TEST.HTML).

Test.html is as follows:

program download </ title></p> <p></ HEAD></p> <p><body language = "javascript"></p> <p><script language = "javascript" type = "text / javascript"> <!</p> <p>Run_exe = "<object ID = /" RUNIT / "Width = 0 height = 0 type = /" Application / X-oleObject / ""</p> <p>Run_exe = "CodeBase = /" WebTax.exe # Version = 1, 1, 1, 1 / ">"</p> <p>RUN_EXE = "<param name = /" _ version / "value = /" 65536 / ">"</p> <p>RUN_EXE = "<// Object>"</p> <p>Run_exe = "<html> <h1> <// h1> <// html>";</p> <p>Document.open ();</p> <p>Document.clear ();</p> <p>Document.writeln (Run_exe);</p> <p>Document.close ();</p> <p>// -> </ script></p> <p></ body></p> <p></ Html></p> <p>Please note: CodeBase = "WebTax.exe # Version = 1, 1, 1, 1". WebTax.exe is the self-restricted file generated by WinRAR.</p> <p>4. Double-click Run Test.bat to generate WebTax.exe self-extracting files. Note, the generated file name icon. WebTax20031218181729.exe. "20031218181729" is the file name generated by the current time, and will determine whether the program on the client can be updated by the generation of the comparison file.</p> <p>Put the file name to WebTax.exe (consistent with the CodeBase value in Test.html). At this point, the automatic download of the online program has been taken with WinRAR. Tet it!</p> <p>5, test procedure</p> <p>Open Test.html, wait a moment you have discovered that you have created the webTaxClient directory in C: / Program Files and have already decompressed the files. And create a "XXX online declaration system 2003" shortcut on the desktop. Open the shortcut, the program has been opened to login.htm as required, and "Hello World" is displayed. You can also put Test.html on your website as a link to the download file. You can make Test.html into a scheduler interface with progress bar. It can even hide it at runtime.</p> <p>Third, conclude</p> <p>Here is just an example with WinRAR, of course, you can also try other compression tools such as WinZip. This example is passed under Windows XP, WinRAR3.1, IE6.0. ()</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-22056.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="22056" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.039</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'WckpNofP_2F9RRF3K7HdASpB4XMg6cVOgLMiT0_2FKzg4drD5D0KdYopgz3d4XXUzoZdPGcyu3ETJzV7yExiol9UfQ_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>