Use JavaScript to get the Web page js, CSS, Flash and other documents _ typical special effects

Source: Internet
Author: User
Tags transparent color tagname
Author: Ma Jian
Email: stronghorse@tom.com
Home: Http://stronghorse.yeah.net
Version: 1.01
Initial release Date: 2005.08.29
Date Last updated: 2005.09.28

Directory
First, the preface
Ii. general steps for obtaining files from e-book or Web pages
Third, from e-book or Web page to get the link in the CSS file
Four, from e-book or Web page to get links in the JS file
V. Get flash files from e-book or Web page
Get background music files from e-book or Web page
Get image files from e book
Eight, enter the frame page
Ix. Other issues

First, the preface

Recently, I heard someone complain about using Minikillebook to decompile e-books, only to get HTML pages, can not get the E book js, CSS, Flash, background music and other documents. In fact, as long as you have a knowledge of JavaScript code, even if only with the published ctrln, it is not difficult to get these documents in E book.

Prior declaration:
1, all of the following methods are based on JavaScript, so may give people around the feeling, the effect can not be directly called IE Non-public interface iecracker, Killebook compared. But this is just the balance: for a good scholar who intends to learn from others by decompile, using JavaScript itself is a practicing process, and this method is difficult to be used in batch decompile, so people who do the book do not have to worry too much. Goose that lays things I do not do, haha ...
2, in order to facilitate the use of the following given by the JavaScript is very stupid, all URL analysis work to the code to complete, you will press CTRL + C, CTRL + V button on the good. But automation has its limits, and for most Web pages, this code should work, but if you run into a page that's not working, you'll need to analyze the HTML code manually. If you encounter encrypted Web pages during analysis, you can decode the encrypted HTML using the Ctrln HTML fragment function. When you look up links in your source code, you can quickly locate them by using the search feature.
3, now based on the IE kernel of e-books basically through the custom Protocol plug-in implementation, the JavaScript protocol plug-in support varies, so if the code in some e-books error, please do not be surprised.
4, in addition to the use of reverse-compiling e-book, the code in peacetime browsing the normal Web page is also useful, such as to capture the Web page falsh files.
5, all the code under the Windows XP SP2 test Pass, other environment I did not try, but the estimated IE version can not be less than 6.0.
6, All the code is my original, individual can be free to use, website reprint, commercial profit, please first get my authorization .

Ii. general steps for obtaining files from e-book or Web pages

The steps to get files from e-books or regular web pages are basically the same, except for the JavaScript code you need to enter:

    1. Start Ctrln. This is to prevent an ebook or Web page from disabling shortcut keys. If you confirm that the shortcut key is not banned, you can omit this step and press CTRL + N in step 3rd.
    2. Open an ebook or IE, into a reference to the need to crawl the CSS, JS, flash and other documents page. Note that this must be a real page, not a frame. We'll talk about how to judge frame and how to enter the frame page.
    3. Set CTRLN shortcut behavior to pop-up new window. Then use the mouse on the Web page to crawl, and then press CTRL + N key, pop-up new IE window, which shows the content and want to crawl the content of the page, the address bar shows the URL of the page.
    4. In the IE window that pops up, copy, paste, and then press ENTER as necessary for the corresponding JavaScript code (which will be given later) to the address bar.

For IE 6, the first time you run JavaScript code may pop a yellow bar under the address bar, prompting the code to be blocked from running, clicking on the yellow bar, selecting "Allow Blocked Content", and then repeating steps 3 and 4 to see the result.

Third, from e-book or Web page to get the link in the CSS file

JavaScript itself provides an interface to get the contents of an external CSS file, so in step 4 of the preceding general step, copy, Paste, and then press ENTER to see the contents of the following:

Javascript:str= '; c=document.stylesheets;for (i=0;i<c.length;i++) {o=c[i];if (o.href== ') continue;str+= ' = = = = = str+=o.href;str+= ' <br><xmp>\n '; str+=o.csstext;str+= ' </xmp><br><br>\n '; document.write (str);

If the current HTML page is not linked to an external CSS file, then step 4 does not respond or displays an empty page, you can check the page's HTML source code to confirm. If the current page links to more than one CSS file, all CSS file content will be displayed, the format after IE layout may be different from the original CSS code, but the effect is absolutely the same. If you only show the file name of the CSS file, there is no content, then the e book does not pack this CSS.

For some e-books, you can also try the following code:

Javascript:str= '

This code automatically checks the Web page, if the Web page embedded in the CSS file, then automatically show the CSS file download link, otherwise show an empty page or no response. Click the right mouse button on the link and select the Save target as menu to save the file to your hard disk. If you cannot save, you can copy the URL of the JS file to the Address bar, and then press ENTER to try. However, if you have an open, edit, etc subkey under the registry key Hkey_classes_root\cssfile\shell, the resulting CSS code opens directly in the program specified by the open or edit subkey instead of the prompt disk. This method of application is far less than the previous direct display method, not all e-books can be used, but as long as it can be used, get the absolute original CSS code.

Four, from e-book or Web page to get links in the JS file

JavaScript does not provide an interface to get the contents of the JS file, so you first need to retrofit the registry: Run regedit, navigate to Hkey_classes_root\.js, and add two string-type values below it:
Content Type=application/x-javascript
Perceivedtype=text
If you are not comfortable with the changes, you can refer to the default settings for Hkey_classes_root\.css, which are only different values for the content type. Registry transformation is a one-time work, the change is done without moving.

After the transformation is completed, the steps to crawl the JS file with CTRLN are the same as the usual steps, in step 4, copy, paste, and then press ENTER to see the contents:

Javascript:str= '
This code automatically checks the Web page, if the Web page embedded JS file, then automatically show the JS file download link, otherwise show an empty page or no response. Click the right mouse button on the link to select the "Save Target as" menu, or direct point link, you can save the file to the hard disk. If you cannot save it, make sure you have set the registry as described above, and if not, copy the URL of the JS file to the Address bar, and then press ENTER to try.

More bizarre is the use of ebook workshop e-book (page URL to ada99: The beginning), in the Address bar, typing js file on the URL and then enter, will directly show the content of the JS file and its implementation results, need to point "view-> source file" menu to get the original JS file code. But this kind of book generally uses Unebookworkshop to decompile?

V. Get flash files from e-book or Web page

For flash this embedded object file, direct download can be, so in the above general steps in step 4, copy, paste the following content to the address bar, and then press ENTER to see the content:

Javascript:str= '

This code automatically checks the Web page, if the Web page embedded in the Flash object, then automatically display the SWF file download link, otherwise show an empty page or no response. Click the right mouse button on the link and select Save target as to save the file to your hard disk. If you click on the link directly, you will see the flash screen.

I often see someone ask: "How to crawl the beautiful flash on the page?" ", in fact, the answer is so simple, usually on the internet I often use this code to catch flash, but need to note: If the page embedded in the frame, you need to break through the frame into the real page to use this piece of code. In addition, this code uses the Createdocumentfragment method and can only run on IE 6.

There is also a very extreme ebook: The entire book has only one page, which embeds a flash file as a directory, click on the link in Flash, then into other flash files, that is, the real content in a heap of flash files. For this ebook, with the above code can only catch a flash, need to gradually point in order to grasp the whole, and some even to use Flasm to compile the captured Flash file run script, Then find the file name of the other Flash file that it links to in the script (I search for it in a despicable way), and then turn the file name into an absolute URL to generate the download link. For example, if the absolute URL of a flash file is known as http://ebook/pic.swf, you can download the file separately with the following code:

Javascript:document.write (' <a href= ' http://ebook/pic.swf ' > Right key Save as </a> ');

This method will change the URL every time, of course, than the previous method trouble, but sometimes only in this way. Incidentally, Flasm is a really good thing. Some flash files restrict the file from being played on the network, not playing from the local hard disk, or using it to remove the restriction.

Get background music files from e-book or Web page

The background music file can be downloaded directly like Flash, so in step 4 of the preceding general step, copy, Paste, and then press ENTER to see the contents in the Address bar:

Javascript:str= '

This code automatically checks the Web page, if the background music embedded, then automatically show the background music download link, otherwise show an empty page or no response. Click the right mouse button on the link and select Save target as to save the file to your hard disk.

Note that background music is generally hidden in a frame (otherwise a change in the page music is interrupted), if the pop-up page contains frame, and not really contains the background music link page, you will not be able to catch. You also need to enter the page in the frame by following the steps that follow.

In addition to some e-books in order to avoid monotonous, will be packaged in a few MIDI files, each run randomly select one as background music. For such e-book, the above code can only catch the current background music. If you want to catch all, you can only analyze the source code of the Web page, combine the URL of all the background music, then enter the JavaScript code to generate the download link on the Address bar and return to the download one at a time. Note on the download link can also point to the right button after the "target save as", can not directly point links. If you really do not have the ability to analyze the source code of the Web, can only run a few more, catch a few back, is the so-called "backward will be beaten." Example: When the absolute URL of a music file is known to be Http://ebook/1.mid, the code to generate the download link is:
Javascript:document.write (' <a href= ' http://ebook/1.mid ' > Right key Save as </a> ');

Get image files from e book

In step 4 of the preceding general step, copy, Paste, and then press ENTER to see the contents of the following:

Javascript:z=1;strurl= '; str= '; function getimg () {if (strurl!= ') {str+= (z++); str+= '. <br><br>\n ';};}; C=document.images;for (i=0;i<c.length;i++) {o=c[i];strurl=o.src;getimg ();}; Strurl=document.body.background;getimg (); C=document.all;for (i=0;i<c.length;i++) {o=c[i];if (o.tagName== ' TABLE ' | | o.tagname== ' TD ') {strurl=o.background;getimg ();}; if (o.tagname== ' area ') {strurl=o.href;getimg ();};}; document.write (str);

The above code shows the entire sequence of images that can be found in the Web page. If you feel that the picture is too much to look inconvenient, or some small picture can not see clearly, but also use the following code to display the picture link, click on the link to show the picture:

Javascript:z=1;strurl= '; str= '; function getimg () {if (strurl!= ') {str+= (z++); str+= '. <a href= '; str+=strurl;str + = ' > '; str+=strurl;str+= ' </a><br>\n ';}; C=document.images;for (i=0;i<c.length;i++) {o=c[i];strurl=o.src;getimg ();}; Strurl=document.body.background;getimg (); C=document.all;for (i=0;i<c.length;i++) {o=c[i];if (o.tagName== ' TABLE ' | | o.tagname== ' TD ') {strurl=o.background;getimg ();}; if (o.tagname== ' area ') {strurl=o.href;getimg ();};}; document.write (str);

Because of code restrictions, hidden in the page JS, CSS code in the picture with the above two pieces of code can not crawl, at this time can only hand to the HTML code analysis, the address bar directly input the absolute URL of the picture and then enter, can also show the picture.

In addition, due to the ability of JavaScript protocol Plug-ins, the above two pieces of code do not eliminate duplicate links, so if you use these two pieces of code to grasp the map on the BBS page, see a lot of the same picture, please do not be surprised.

When a picture or link is displayed, only a handful of the pictures in E book can be saved directly as the original format, most can only get decoded into the bitmap after the picture, the method is: in the picture (note is the picture, not the link, link must point to show the picture) on the right, select the "Picture Save as" menu, You can save the picture as a BMP file, the file name defaults to "Untitled. bmp", which requires a manual renaming. If the file specified in the URL is not bmp, but JPG, GIF, or PNG, you will also need to use software such as ACDSee to convert the saved BMP to the required format. JPG Fortunately, GIF, PNG transparent color needs manual processing, animated GIF simply don't think of.

Note: If you only change the file name, do not convert the file format, in IE will not show the picture.

Usually when surfing the Internet, you can also use the above code to crawl the background image of the Web page, this time choose "Picture Save as", generally can be saved into the original format.

From the above description can be seen, in the case of not using IE internal interface, the capture picture may be the most troublesome, but the worst effect of a bitter errand. Remember when I was so rage began to bite the bullet analysis of IE kernel source code, fortunately finally got a return. Do not know that after reading the above instructions, will someone bloody Dafa, also embark on my path? Hey hehe ...

Eight, enter the frame page

All of the JavaScript code given above is for the current page, that is to say, only the current page really contains music files, flash files, in order to catch the required files. If it is a frame, you must enter the page in the frame to crawl.

The easiest way to detect whether the current page is a frame is to follow the usual steps, and then in step 4, copy, paste, and then press ENTER on the address bar:

Javascript:str= '

This code automatically checks the Web page, if the frame (including the IFRAME) is embedded, automatically displays the page link in the frame, otherwise displaying an empty page or no response. Click on the link directly, you can enter the appropriate page.

In order to ensure versatility, the above code only checks the first layer frame, which is not a problem for IFRAME, because few normal people will play nested IFRAME, but for ordinary frame, the possibility of nesting is still very large, The code above needs a layer of layers to see the nested frame, which is a bit of a hassle. The solution is: If the above code shows all frame, no iframe, you can use the following code to display all nested frame:

Javascript:str= '; function GetFrame (c,i,j) {for (i=0;i<c.length;i++) {o=c[i];for (k=0;k<j;k++) str+= '; str+= ' <a href= "'; str+=o.location;str+= '" > "; if (o.name!= ') str+=o.name;else str+=o.location;str+= ' </a><br >\n '; no=o.document.frames;if (no.length>0) getframe (no,0,j+1)}; GetFrame (document.frames,0,0);d ocument.write (str);

This code automatically checks the Web page to show links and nesting relationships for all pages in the nested frame, and no frame displays an empty page or no response. Click on the link directly, you can enter the appropriate page. Note If the page contains an IFRAME, the above code may be wrong, so you have to use the first piece of code to check for an IFRAME.

If the Web page uses the JS code to detect the frame, resulting in the Web page can not be separated from the frame to run, in order to obtain the embedded frame page content, you can use the above code to display the Frame page link, directly in the page link point right Select "target Save As", Save the HTML code and then manually edit or use tools such as textforever to assist in editing.

Minikillebook v1.04 Previous version There was an oversight: I thought of dealing with frame, forgetting to handle the IFRAME, so it began to circulate in some people that the Web page is embedded in an IFRAME to avoid being Minikillebook decompile. After the v1.04 came out, this statement really can only become a legend.

Ix. Other issues

Q: If you press CTRL + N key, the pop-up IE window does not have a menu, address bar, how to do?
A: Starting with Ctrln ver 1.03, provide a "high-level interface" that can be turned on/off, and through the "script command" feature, you can push the JavaScript code you want to execute directly into the IE window without having to enter the address bar again.

Q: If E book up after the ban on Windows copy, Paste function, the above JS code is very long, do not want a character to knock, how to do?
A: Starting with the CTRLN ver 1.03, provide a "high-level interface" that can be turned on/off, through the "script command" feature, which can be pushed directly into the IE window by the JavaScript code or URL to be executed, without having to enter the address bar again. If you write your own JavaScript code, you can also add it to a CTRLN.SPT file (a plain text file) so that you can select it directly in the Script command Selection window later.

Appendix Version Update record

Version 1.01
Follow the new features of Ctrln ver 1.03 to revise the document.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.