. Httrack then goes off and does your bidding.
For example:
httrack www.all.net/bob/
This will use the 'defaults' (those selections from
the help page marked with '*' in the listing above) to image the web
site. Specifically, the defauls are:
w *mirror web sites
%f *use proxy for ftp (f0 don't use)
cN number of multiple connections (*c8)
RN number of retries, in case of timeout or non-fatal errors (*R1)
%P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)
NN name conversion type (0 *original structure, 1+: see below)
LN long names (L1 *long names / L0 8-3 conversion)
K keep original links (e.g. http://www.adr/link) (K0 *relative link)
o *generate output html file in case of error (404..) (o0 don't generate)
X *purge old files after update (X0 keep delete)
bN accept cookies in cookies.txt (0=do not accept,* 1=accept)
u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always)
j *parse Java Classes (j0 don't parse)
sN follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always)
C create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before)
f *log file mode
I *make an index (I0 don't make)
pN priority mode: (* p3) *3 save all files
D *can only go down into subdirs
a *stay on the same address
--mirror *make a mirror of site(s) (default)
Here's what all of that means:
w *mirror web sites
Automatically go though each URL you download and look
for links to other URLs inside it, dowloading them as well.
%f *use proxy for ftp (f0 don't use)
If there are and links to ftp URLs (URLs using the
file transfer protocol (FTP) rather than the hypertext transfer protocol
HTTP), go through an ftp proxy server to get them.
cN number of multiple connections (*c8)
Use up to 8 simultaneous downloads so that at any
gioven time, up to 8 URLs may be underway.
RN number of retries, in case of timeout or non-fatal errors (*R1)
Retry once if anything goes wrong with a download.
%P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)
Try to parse all URLs - even if they are in
Javascript, Java, tags of unknown types, or anywhere else the program
can find things.
NN name conversion type (0 *original structure, 1+: see below)
Use the original directory and file structure of the
web site in your mirror image of the site.
LN long names (L1 *long names / L0 8-3 conversion)
If filenames do not follow the old DOS conventions,
store them with the same names used on the web site.
K keep original links (e.g. http://www.adr/link) (K0 *relative link)
Use relative rather than the original links so that
URLs within this web site are adjusted to point to the files in the
mirror.
o *generate output html file in case of error (404..) (o0 don't generate)
IF there are errors in downloading, create a file that
indicates that the URL was not found. This makes browsing go a lot
smoother.
X *purge old files after update (X0 keep delete)
Files not found on the web site that were previously
there get deleted so that you have an accurate snapshot of the site as
it is today - losing historical data.
bN accept cookies in cookies.txt (0=do not accept,* 1=accept)
Accept all cokkies sent to you and return them if
requested. This is required for many sites to function. These cookies
are only kept relative to the specific site, so you don't have to worry
about your browser retaining them.
u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always)
This causes different document types to be analyzed
differently.
j *parse Java Classes (j0 don't parse)
This causes Java class files to be parsed looking for
URLs.
sN follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always)
This tells the program to follow the wishes of the
site owner with respect to limiting where robots like this one search.
C create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before)
If you are downloading a site you have a previous copy
of, supplemental parameters are transmitted to the server, for example
the 'If-Modified-Since:' field will be used to see if files are newer
than the last copy you have. If they are newer, they will be
downloaded, otherwise, they will not.
f *log file mode
This retains a detailed log of any important events
that took place.
I *make an index (I0 don't make)
This makes a top-level index.html file so that if you
image a set of sites, you can have one place to start reviewing the set
of sites.
pN priority mode: (* p3) *3 save all files
This will cause all downloaded files to be saved.
D *can only go down into subdirs
This prevents the program from going to higher level
directories than the initial subdirectory, but allows lower-level
subdirectories of the starting directory to be investigated.
a *stay on the same address
This indicates that only the web site(s) where the
search started are to be collected. Other sites they point to are not
to be imaged.
--mirror *make a mirror of site(s) (default)
This indicates that the program should try to make a
copy of the site as well as it can.
Now that's a lot of options for the default - but of
course there are a lot more options to go. For the most part, the rest
of the options represent variations on these themes. For example,
instead of saving all files, we might only want to save html files, or
instead of 8 simultaneous sessions, we might want only 4.
If we wanted to make one of these changes, we would
specify the option on the command line. For example:
httrack www.all.net/bob/ -c4 -B
This would restrict httrack to only use 4
siumultaneous sessions but allow it to go up the directory structure
(for example to www.all.net/joe/) as well as down it (for example to
www.all.net/bob/deeper/).
You can add a lot of options to a command line!
A Thorough Going Over
Now that you have an introduction, it's time for a
more though coverage. This is where I go through each of the options
and describe it in detail with examples... Actually, I won't quite do
that. But I will get close.
Options tend to come in groups. Each group tends to
be interrelated, so it's easier and more useful to go through them a
group at a time with some baseline project in mind. In my case, the
project is to collect all of the information on the Internet about some
given subject. We will assume that, through a previous process, I have
gotten a list of URLs of interest to me. Typically there will be
hundreds of these URLs, and they will be a mixed bag of sites that are
full of desired information, pages with lists of pointers to other
sites, URLs of portions of a web site that are of interest (like Bob's
home pages and subdirectories), and so forth. Let us say that for today
we are looking for the definitive colleciton of Internet information on
shoe sizes from around the world.
General Options
General options:
O path for mirror/logfiles+cache (-O path_mirror[,path_cache_and_logfiles])
For this project, I will want to keep all of the
information I gather in one place, so I will specify that output area of
the project as /tmp/shoesizes by adding '-O
/tmp/shoesizes' to every command line I use.. for example:
httrack http://www.shoesizes.com -O /tmp/shoesizes
The action options tell httrack how to operate at the
larger level.
Action Options
Action options:
w *mirror web sites
W mirror web sites, semi-automatic (asks questions)
g just get files (saved in the current directory)
i continue an interrupted mirror using the cache
Y mirror ALL links located in the first level pages (mirror links)
If I want httrack to ask me questions - such as what
options to use, what sites to mirror, etc. I can tell it to ask these
questions as follows:
httrack http://www.shoesizes.com -O /tmp/shoesizes -W
I can also do:
httrack
OR
httrack -W
OR
httrack -w
The '-W' options asks whether the or not a site has to
be mirrored, while the '-w' option does not ask this question but asks
the remainder of the questions required to mirror the site.
The -g option allows you to get the files exactly as
they are and store them in the currant directory. This is handy for a
relatively small collection of information where organization isn't
important. With this option, the html files will not even be parsed to
look for other URLs. This option is useful for getting isolated files
(e.g., httrack -g www.mydrivers.com/drivers/windrv32.exe).
If I start a collection process and it fails for ome
reason or another - such as me interrupting it because I am running out
of disk space - or a network outage - then I can restart the process by
using the -i option:
httrack http://www.shoesizes.com -O /tmp/shoesizes -i
Finally, I can mirror all links in the first level
pages of the URLs I specify. A good example of where to use whis would
be in a case where I have a page that points to a lot of other sites and
I want to get the initial information on those sites before mirroring
them:
httrack http://www.shoesizes.com/othersites.html -O /tmp/shoesizes -Y
Proxy Options
Many users use a proxy for many of their functions.
This is a key component in many firewalls, but it is also commonly used
for anonymizing access and for exploiting higher speed communications at
a remote server.
Proxy options:
P proxy use (-P proxy:port or -P user:pass@proxy:port)
%f *use proxy for ftp (f0 don't use)
If you are using a standard proxy that doesn't require
a user ID and password, you would do something like this:
httrack http://www.shoesizes.com -O /tmp/shoesizes -P proxy.www.all.net:8080
In this case, we have asusmed that proxy.www.all.net is
the host that does the proxy service and that it uses port 8080 for this
service. In some cases you will have to ask your network or firewall
administrator for these details, however, in most cases they should be
the same as the options used in your web browser.
In some cases, a user ID and password are required for
the proxy server. This is common in corporate environments where only
authorized users may access the Internet.
httrack http://www.shoesizes.com -O /tmp/shoesizes -P fc:password@proxy.www.all.net:8080
In this case, the user ID 'fc' and the password
'password' are used on proxy.www.all.net port 8080. Again, your network or
firewall administrator can be most helpful in addressing the specifics
for your environment.
FTP normally operates through a proxy server, but for systems
that have direct connections to the Internet, the following option should help:
httrack ftp://ftp.shoesizes.com -O /tmp/shoesizes -%f0
Limits Options
Limits options:
rN set the mirror depth to N
mN maximum file length for a non-html file
mN,N' for non html (N) and html (N')
MN maximum overall size that can be uploaded/scanned
EN maximum mirror time in seconds (60=1 minute, 3600=1 hour)
AN maximum transfer rate in bytes/seconds (1000=1kb/s max)
GN pause transfer if N bytes reached, and wait until lock file is deleted
%eN set the external links depth to N (* %e0) (--ext-depth[=N])
%cN maximum number of connections/seconds (*%c10)
Setting limits provides the means by which you can
avoid running out of disk space, CPU time, and so forth. This may be
particularly helpful for those who accidentally try to image the whole
Internet.
httrack http://www.shoesizes.com -O /tmp/shoesizes -r50
In this example, we limit the directlry depth to 50
levels deep. As a general rule, web sites don't go much deeper than 20
levels or so, and if you think about it, if there are only 2
subdirectories per directory level, a directory structure 50 deep would
have about 10 trillion directories. Of course many sites have a small
number of files many levels deep in a directory structure for various
reasons. In some cases, a symbolic link will cause an infinite
recursion of directory levels as well, so placing a limit may be
advisable.
httrack http://www.shoesizes.com -O /tmp/shoesizes -m50000000
This example sets the maximum file length for non-HTML
files to 50 megabytes. This is not an unusual length for things like
tar files, and in some cases - for example when there are images of
CD-ROMs to fetch from sites, you might want a limit more like 750
megabytes.
httrack http://www.shoesizes.com -O /tmp/shoesizes -m50000000,100000
In this example, we have set a limit for html files
as well - at 100,000 bytes. HTML files are rarely larger than this,
however, in some cases larger sizes may be needed.
httrack http://www.shoesizes.com -O /tmp/shoesizes -M1000000000
This option sets the maximum total size - in bytes -
that can be uploaded from a site - in this case to 1 gigabyte.
Depending on how much disk space you have, such an option may be
worthwhile.
httrack http://www.shoesizes.com -O /tmp/shoesizes -E3600
This sets the maximum runtime for the download
process. Of course depending on the speed of your connection it may
take longer or shorter runtimes to get the same job done, and network
traffic is also a factor. 3600 seconds corresponds to one hour.
httrack http://www.shoesizes.com -O /tmp/shoesizes A100000000
This option specifies the largest number of bytes per
second that should be used for transfers. For example, you might want
to go slow for some servers that are heavily loaded in the middle of the
day, or to download slowly so that the servers at the other end are less
likely to identify you as mirroring their site. The setting above
limits my bandwidth to 100 million bytes per second - slow I know, but I
wouldn't want to stress the rest of the Internet.
httrack http://www.shoesizes.com -O /tmp/shoesizes -G100000000
In this case, the G option is used to 'pause' a
download after the first gigabyte is downloaded pending manual removal
of the lockfile. This is handy of you want to download some portion of
the data, move it to secondary storage, and then continue - or if you
want to only download overnight and want to stop before daylight and
continue the next evening. You could even combine this option with a
cron job to remove the lock file so that the job automatically restarts
at 7PM every night and gets another gigabyte.
httrack http://www.shoesizes.com -O /tmp/shoesizes %e5
In this case, httrack will only go to depth 5 for external links,
thus not imaging the entire web, but only yhose links within 5 links of these web pages.
Also note that the interaction of these options may
cause unintended consequences. For example, limiting bandwidth and
download time conspire to limit the total amount of data that can
be downloaded.
Flow Control Options
Flow control:
cN number of multiple connections (*c8)
%cN maximum number of connections/seconds (*%c10)
TN timeout, number of seconds after a non-responding link is shutdown
RN number of retries, in case of timeout or non-fatal errors (*R1)
JN traffic jam control, minimum transfert rate (bytes/seconds) tolerated for a link
HN host is abandonned if: 0=never, 1=timeout, 2=slow, 3=timeout or slow
This example allows up to 128 simultaneous downloads.
Note that this is likely to crash remote web servers - or at least fail
to download many of the files - because of limits on the number of
simultaneous sessions at many sites. At busy times of day, you might
want to lower this to 1 or 2, especially at sites that limit the number
of simultaneous users. Otherwise you will not get all of the downloads.
httrack http://www.shoesizes.com -O /tmp/shoesizes -c128
Many operating systems have a limit of 64 file
handles, including internet connections and all other files that can be
opened. Therefore, in many cases, more that 48 connections might cause
a "socket error" because the OS can not handle that many sockets. This
is also true for many servers. As an example, a test with 48 sockets on
a cgi-based web server (Pentium 166,80Meg RAM) overloaded the machine
and stopped other services from running correctly. Some servers will
ban users that try to brutally download the website. 8 sockets is
generally good, but when I'm getting large files (e.g., from a a site
with large graphical images) 1 or 2 sockets is a better selection. Here
are some other figures from one sample set of runs:
Tests: on a 10/100Mbps network, 30MB website, 99 files (70 images (some are
little, other are big (few MB)), 23 HTML)
With 8 sockets: 1,24MB/s
With 48 sockets: 1,30MB/s
With 128 sockets: 0,93MB/s
The timeout option causes downloads to time out after
a non-response from a download attempt. 30 seconds is pretty reasonable
for many sites. You might want to increase the number of retries as
well so that you try again and again after such timeouts.
httrack http://www.shoesizes.com -O /tmp/shoesizes -%c20
This limits the number of connections per second. It
is similar to the above option but allows the pace to be controlled
rather than the simultanaety. It is particulsrly useful for long-term
pulls at low rates that allow little impact on remote infrastructure.
The default is 10 connections per second.
httrack http://www.shoesizes.com -O /tmp/shoesizes -T30
This example increases the number of retries to 5.
This means that if a download fails 5 times, httrack will give up on it.
For relatively unreliable sites - or for busy times of day, this number
should be higher.
httrack http://www.shoesizes.com -O /tmp/shoesizes -R5
This is an interesting option. It says that in a
traffic jam - where downloads are excessively slow - we might decide to
back off the download. In this case, we have limited downloads to stop
bothering once we reach 10 bytes per second.
httrack http://www.shoesizes.com -O /tmp/shoesizes -J10
These three options will cause the download from a
host to be abandoned if (respectively) (0) never, (1) a timeout is
reached, (2) slow traffic is detected, (or) (3) a timeout is reached OR
slow traffic is detected.
httrack http://www.shoesizes.com -O /tmp/shoesizes -H0
httrack http://www.shoesizes.com -O /tmp/shoesizes -H1
httrack http://www.shoesizes.com -O /tmp/shoesizes -H2
httrack http://www.shoesizes.com -O /tmp/shoesizes -H3
Of course these options can be combined to provide a
powerful set of criteria for when to continue a download and when to
give it up, how hard to push other sites. and how much to stress
infrastructures.
Link Following Options
Links options:
%P *extended parsing, attempt to parse all links, even in unknown tags or Javascript (%P0 don't use)
n get non-html files 'near' an html file (ex: an image located outside)
t test all URLs (even forbidden ones)
%L add all URL located in this text file (one URL per line)
The links options allow you to control what links are
followed and what links are not as well as to provide long lists of
links to investigate. Any setting other than the default for this
option forces the engine to use less reliable and more complex parsing.
'Dirty' parsing means that links like 'xsgfd syaze="foo.gif"' will cause
HTTrack to download foo.gif, even if HTTrack don't know what the "xsgfd
syaze=" tag actually means! This option is powerful because some links
might otherwise be missed, but it can cause errors in HTML or javascript.
This will direct the program to NOT search Javascript
for unknown tag fields (e.g., it will find things like
foo.location="bar.html"; but will not find things like bar="foo.gif";).
While I have never had a reason to use this, some users may decide that
they want to be more conservative in their searches. As a note,
javascript imported files (.js) are not currently searched for URLs.
httrack http://www.shoesizes.com -O /tmp/shoesizes '%P0'
Now here is a classic bit of cleaverness that 'does
the right thing' for some cases. In this instance, we are asking
httrack to get images - like gif and jpeg files that are used by a web
page in its display, even though we would not normally get them. For
example, if we were only getting a portion of a web site (e.g.,
everything under the 'bob directory') we might want to get graphics from
the rest of the web sote - or the rest of the web - that are used in
those pages as well so that our mirror will look right.
httrack http://www.shoesizes.com -O /tmp/shoesizes -n
Here, we limit the collection to bob's area of the
server - except that we get images and other such things that are used
by bob in his area of the server.
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -n
This option 'tests' all links - even those forbidden
(by the robot exclusion protocol) - by using the 'HEAD' protocol to test
for the presence of a file.
httrack http://www.shoesizes.com/ -O /tmp/shoesizes -t
In this case, we use a file to list the URLs we wish
to mirror. This is particularly useful when we have a lot to do and
don't want to tirelessly type in URLs on command line after command line.
It's also useful - for example - if you update a set of mirrored sites
evey evening. You can set up a command like this to run automatically
from your cron file.
httrack -%L linkfile -O /tmp/shoesizes
This will update the mirror of your list of sites
whenever it is run.
httrack -%L linkfile -O /tmp/shoesizes -B --update
The link file is also useful for things like this
example where, after a binary image of a hard disk was analyzed (image)
URLs found on that disk were collected by httrack:
strings image | grep "http://" > list;
httrack -%L list -O /tmp/shoesizes
Mirror Build Options
Build options:
NN name conversion type (0 *original structure, 1+: see below)
N user defined structure (-N "%h%p/%n%q.%t")
LN long names (L1 *long names / L0 8-3 conversion)
K keep original links (e.g. http://www.adr/link) (K0 *relative link)
x replace external html links by error pages
o *generate output html file in case of error (404..) (o0 don't generate)
X *purge old files after update (X0 keep delete)
%x do not include any password for external password protected websites (%x0 include) (--no-passwords)
%q *include query string for local files (information only) (%q0 don't include) (--include-query-string)
The user can define naming conventions for building
the mirror of a site by using these options. For example, to retain the
original structure, the default is used. This only modifies the
structure to the extent that select characters (e.g., ~, :, <, >, \, and
@) are replaced by _ in all pathnames.
httrack http://www.shoesizes.com -O /tmp/shoesizes -N0
OR
httrack http://www.shoesizes.com -O /tmp/shoesizes
In either case, the mirror will build with the same
directory hierarchy and name structure as the original site. For cases
when you want to define your own structure, you use a string like this:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -N "%h%p/%n.%t"
In this case, %h, %p, $n, and %t stand for the href
element (e.g., http://www.shoesizes.com or ftp://ftp.shoesizes.com), %p
stands for the pathname (e.g., /bob/), %n stands for the name of the
file, and %t stands for type (file extension). The full list of these
options follows:
%n Name of file without file type (ex: image)
%N Name of file, including file type (ex: image.gif)
%t File type (ex: gif)
%p Path [without ending /] (ex: /someimages)
%h Host name (ex: www.all.net)
%M URL MD5 (128 bits, 32 ascii bytes)
%Q query string MD5 (128 bits, 32 ascii bytes)
%q small query string MD5 (16 bits, 4 ascii bytes)
%s? Short name version (ex: %sN)
Other 'N' options include:
Details: Option N
N0 Site-structure (default)
N1 HTML in web/, images/other files in web/images/
N2 HTML in web/HTML, images/other in web/images
N3 HTML in web/, images/other in web/
N4 HTML in web/, images/other in web/xxx, where xxx is the file extension
(all gif will be placed onto web/gif, for example)
N5 Images/other in web/xxx and HTML in web/HTML
N99 All files in web/, with random names (gadget !)
N100 Site-structure, without www.domain.xxx/
N101 Identical to N1 exept that "web" is replaced by the site's name
N102 Identical to N2 exept that "web" is replaced by the site's name
N103 Identical to N3 exept that "web" is replaced by the site's name
N104 Identical to N4 exept that "web" is replaced by the site's name
N105 Identical to N5 exept that "web" is replaced by the site's name
N199 Identical to N99 exept that "web" is replaced by the site's name
N1001 Identical to N1 exept that there is no "web" directory
N1002 Identical to N2 exept that there is no "web" directory
N1003 Identical to N3 exept that there is no "web" directory (option set for g option)
N1004 Identical to N4 exept that there is no "web" directory
N1005 Identical to N5 exept that there is no "web" directory
N1099 Identical to N99 exept that there is no "web" directory
Long names are normally used (the -L0
option) but if you are imaging to a DOS file system or want
accessibility from older versions of DOS and Windows, you can use the
-L1 option to generate these filename sizes.
httrack http://www.shoesizes.com -O /tmp/shoesizes -L1
With the 'K' option, you can keep the original links
in files. While this is less useful in being able to view a web site
froim the mirrored copy, it is vitally important if you want an accurate
copy of exactly what was on the web site in the first place. In a
forensic image, for example, you might want to use this option to
prevent the program from modifying the data as it is collected.
httrack http://www.shoesizes.com -O /tmp/shoesizes -K
In this case, instead of leaving external links (URLs
that point to sites not being mirrored) in the pages, these links are
replaced by pages that leave messages indicating that they could not be
found. This is useful for local mirrors not on the Internet or mirrors
that are on the Internet but that are not supposed to lead users to
external sites. A really good use for this is that 'bugging' devices
placed in web pages to track who is using them and from where will be
deactivated byt his process.
httrack http://www.shoesizes.com -O /tmp/shoesizes -x
This option prevents the generation of '404' error
files to replace files that were not found even though there were URLs
pointing to them. It is useful for saving space as well as eliminating
unnecessary files in operations where a working web site is not the
desired result.
httrack http://www.shoesizes.com -O /tmp/shoesizes -o0
This option prevents the authoatic purging of files
from the mirror site that were not found in the original web site after
an 'update' is done. If you want to retain old data and old names for
files that were renamed, this option should be used. If you want an
up-to-date reflection of the current web site, you should not use this option.
httrack http://www.shoesizes.com -O /tmp/shoesizes -X0
These options can be combined as desired to produce a
wide range of different arrangements, from collections of only graphical
files stored in a graphics area, to files identified by their MD5
checksums only, all stored in the same directory.
httrack http://www.shoesizes.com -O /tmp/shoesizes %x0 include
This will not include passwords for web sites. If you
mirror http://smith_john:foobar@www.privatefoo.com/smith/, and exclude
using filters some links, these links will be by default rewritten with
password data. For example, "bar.html" will be renamed into
http://smith_john:foobar@www.privatefoo.com/smith/bar.html This can be a
problem if you don't want to disclose the username/password! The %x
option tell the engine not to include username/password data in
rewritten URLs.
httrack http://www.shoesizes.com -O /tmp/shoesizes %q
This option is not very useful, because parameters are
useless, as pages are not dynamic anymore when mirrored. But some
javascript code may use the query string, and it can give useful
information. For example: catalog4FB8.html?page=computer-science is
clearer than catalog4FB8.html Therefore, this option is activated by
default.
Spider Options
These options provide for automation with regard to
the remote server. For example, some sites require that cookies be
accepted and sent back in order to allow access.
Spider options:
bN accept cookies in cookies.txt (0=do not accept,* 1=accept)
u check document type if unknown (cgi,asp..) (u0 don't check, * u1 check but /, u2 check always)
j *parse Java Classes (j0 don't parse)
sN follow robots.txt and meta robots tags (0=never,1=sometimes,* 2=always)
%h force HTTP/1.0 requests (reduce update features, only for old servers or proxies)
%B tolerant requests (accept bogus responses on some servers, but not standard!)
%s update hacks: various hacks to limit re-transfers when updating
%A assume that a type (cgi,asp..) is always linked with a mime type (-%A php3=text/html) (--assume )
By default, cookies are universally accepted and
returned. This makes for more effective collection of data, but allows
the site to be identified with its collection of data more easily. To
disable cookies, use this option:
httrack http://www.shoesizes.com -O /tmp/shoesizes -b0
Some documents have known extension types (e.g.,
html), while others have unknown types (e.g., iuh87Zs) and others may
have misleading types (e.g., an html file with a 'gif' file extension.
These options provide for (0) not checking file types, (1) checking all
file types except directories, and (2) checking all file types including
directories. Choose from these options:
httrack http://www.shoesizes.com -O /tmp/shoesizes -u0
httrack http://www.shoesizes.com -O /tmp/shoesizes -u1
httrack http://www.shoesizes.com -O /tmp/shoesizes -u2
Meta tags or 'robots.txt' files on a web site are used
to indicate what files should and should not be visited by automatic
programs when collectiong data. The polite and prudent move for normal
data collection (and the default) is to follow this indication:
httrack http://www.shoesizes.com -O /tmp/shoesizes -s2
This follows the robots protocol and meta-tags EXCEPT
in cases where the filters disagree with the robots protocols or
meta-tags.
httrack http://www.shoesizes.com -O /tmp/shoesizes -s1
In this next case, we ignore meta-tags and robots.txt
files completely and just take whatever we can get from the site. The
danger of this includes the fact that automated programs - like games or
search engines may generate an unlimited number of nearly identical or
identical outputs that will put us in an infinite loop collecting
useless data under different names. The benefit is that we will get all
the data there is to get.
httrack http://www.shoesizes.com -O /tmp/shoesizes -s0
This next option uses strict HTTP/1.0 protocol. This
means the program will use HTTP/1.0 headers (as in RFC1945.TXT) and NOT
extended 1.1 features described in RFC2616.TXT. For example, reget
(complete a partially downloaded file) is a HTTP/1.1 feature. The Etag
feature is also a HTTP/1.1 feature (Etag is a special identifier that
allow to easily detect file changes).
httrack http://www.shoesizes.com -O /tmp/shoesizes -%h
Some servers give responses not strictly within the
requirements of the official http protocol. These 'Bogus' responses can
be accepted by using this option. For example, when requesting foo.gif
(5132 bytes), the server can, optionally, add:
Content-length: 5132
This helps the client by allowing it to reserve a
block of memory, instead of collecting each byte and re-reserving memory
each time data is being received. But some servers are bogus, and send
a wrong filesize. When HTtrack detects the end of file (connection
broken), there are three cases:
1- The connection has been closed by the server, and we
have received all data (we have received the number of bytes incicated
by the server). This is fine because we have successfully received the
file.
2- The connection has been closed by the server, BUT
the filesize received is different from the server's headers: the
connection has been suddenly closed, due to network problems, so we
reget the file
3- The connetion has been closed by the server, the
filesize received is different from the server's headers, BUT the file
is complete, because the server gave us a WRONG information! In this
case, we use the bogus server option:
httrack http://www.shoesizes.com -O /tmp/shoesizes -%B
These options can be combined for the particular needs
of the situaiton and are often adapted as a result of site-specific
experiences.
httrack http://www.shoesizes.com -O /tmp/shoesizes -%s
This is a collection of "tricks" which are not really
"RFC compliant" but which can save bandwidth by trying not to retransfer
data in several cases.
httrack http://www.shoesizes.com -O /tmp/shoesizes -%A asp=text/html
The most important new feature for some people, maybe.
This option tells the engine that if a link is en countered, with a
specific type (.cgi, .asp, or .php3 for example), it MUST assume that
this link has always the same MIME type, for example the "text/html"
MIME type. This is VERY important to speed up many mirrors.
We have done tests on big HTML files (approx. 150 MB,
150,000,000 bytes!) with 100,000 links inside. Such files are being
parsed in approx. 20 seconds on my own PC by the latest optimized
releases of HTTra ck. But these tests have been done with links of
known types, that is, html, gif, and so on.. If you have, say, 10,000
links of unknown type, such as ".asp", this will cause the engine to
test ALL t hese files, and this will SLOOOOW down the parser. In this
example, the parser will take hours, instead of 20 seconds! In this
case, it would be great to tell HTTrack: ".asp pages are in fact HTML
pages" This is possible, using: -%A asp=text/html
The -%A option can be replaced by the alias --assume
asp=text/html which is MUCH more clear. You can use multiple
definitions, separed by ",", or use multiple options. Therefore, these
two lines are identical:
--assume asp=text/html --assume php3=text/html --assume cgi=image/gif
--assume asp=text/html,php3=text/html,cgi=image/gif
The MIME type is the standard well known "MIME" type.
Here are the most important ones:
text/html Html files, parsed by HTTrack
image/gif GIF files
image/jpeg Jpeg files
image/png PNG files
There is also a collection of "non standard" MIME types. Example:
application/x-foo Files with "foo" type
Therefore, you can give to all files terminated by
".mp3" the MIME type: application/x-mp3
This allow you to rename files on a mirror. If you
KNOW that all "dat" files are in fact "zip" files ren amed into "dat",
you can tell httrack:
--assume dat=application/x-zip
You can also "name" a file type, with its original
MIME type, if this type is not known by HTTrack. This will avoid a test
when the link will be reached:
--assume foo=application/foobar
In this case, HTTrack won't check the type, because it
has learned that "foo" is a known type, or MIME type
"application/foobar". Therefore, it will let untouched the "foo" type.
A last remark, you can use complex definitions like:
--assume asp=text/html,php3=text/html,cgi=image/gif,dat=application/x-zip,mpg=application/x-mp3,application/foobar
..and save it on your .httrackrc file:
set assume asp=text/html,php3=text/html,cgi=image/gif,dat=application/x-zip,mpg=application/x-mp3,application/foobar
Browser Options
Browsers commonly leave footprints in web servers - as
web servers leave footprints in the browser.
Browser ID:
F user-agent field (-F "user-agent name")
%F footer string in Html code (-%F "Mirrored [from host %s [file %s [at %s]]]"
%l preffered language (-%l "fr, en, jp, *" (--language )
The user-agent field is used by browsers to determine
what kind of browser you are using as well as other information - such
as your system type and operating system version. The 'User Agent'
field can be set to indicate whatever is desired to the server. In this
case, we are claiming to be a netscape browser (version 1.0) running a
non-exitent Solaris operating system version on a Sun Sparcstation.
httrack http://www.shoesizes.com -O /tmp/shoesizes -F "Mozilla 1.0, Sparc, Solaris 23.54.34"
On the other side, we may wish to mark each page
collected with footer information so that we can see from the page where
it was collected from, when, and under what name it was stored.
httrack http://www.shoesizes.com -O /tmp/shoesizes -%F "Mirrored [from host %s [file %s [at %s]]]"
This makes a modified copy of the file that may be
useful in future identification. While it is not 'pure' in some senses,
it may (or may not) be considered siilar to a camera that adds time and
date stamps from a legal perspective.
httrack http://www.shoesizes.com -O /tmp/shoesizes -%l "fr, en, jp, *"
"I prefer to have pages with french language, then
english, then japanese, then any other language"
Log, Cache, and Index Options
A lot of options are available for log files, indexing
of sites, and cached results:
Log, index, cache
C create/use a cache for updates and retries (C0 no cache,C1 cache is prioritary,* C2 test update before)
k store all files in cache (not useful if files on disk)
%n do not re-download locally erased files
Q log quiet mode (no log)
q quiet mode (no questions)
z extra infos log
Z debug log
v verbose screen mode
%v display on screen filenames downloaded (in realtime) (--display)
f log file mode
f2 one single log file (--single-log)
I *make an index (I0 don't make)
%I make an searchable index for this mirror (* %I0 don't make) (--search-index)
A cache memory area is used for updates and retries to
make the process far more efficient than it would otherwise be. You can
choose to (0) go without a cache, (1) do not check remotly if the file
has been updated or not, just load the cache content, or (2) see what
works best and use it (the default). Here is the no cache example.
httrack http://www.shoesizes.com -O /tmp/shoesizes -C0
The cache can be used to store all files - if desired
- but if files are being stored on disk anyway (the normal process for a
mirroring operation), this is not helpful.
httrack http://www.shoesizes.com -O /tmp/shoesizes -k
In some cases, a file from a mirror site is erased
locally. For example, if a file contains inappropriate content, it may
be erased from the mirror site but remain on the remote site. This
option allows you to leave deleted files permanently deleted when you
do a site update.
httrack http://www.shoesizes.com -O /tmp/shoesizes -update '%n'
If no log is desired, the following option should be
added.
httrack http://www.shoesizes.com -O /tmp/shoesizes -Q
If no questions should be asked of the user (in a mode
that would otherwise ask questions), the following option should be
added.
httrack http://www.shoesizes.com -O /tmp/shoesizes -q
By adding these options, you get (-z) extra log
information or (-Z) debugging information, and (-v) verbose screen
output.
httrack http://www.shoesizes.com -O /tmp/shoesizes -z -Z -v
Multiple log files can be created, but by default,
this option is used to put all logs into a single log file.
httrack http://www.shoesizes.com -O /tmp/shoesizes -f2
Finally, an index is normally made of the sites
mirrored (a pointer to the first page found from each specified URL) in
an index.html file in the project directory. This can be prevented
through the use of this option:
httrack http://www.shoesizes.com -O /tmp/shoesizes -I0
httrack http://www.shoesizes.com -O /tmp/shoesizes %v
Animated information when using consol-based version,
example:
17/95: localhost/manual/handler.html (6387 bytes) - OK
httrack http://www.shoesizes.com -O /tmp/shoesizes f2
Do not split error and information log (hts-log.txt
and hts-err.txt) - use only one file (hts-log.txt)
httrack http://www.shoesizes.com -O /tmp/shoesizes -%I linux.localdomain
Still in testing, this option asks the engine to
generate an index.txt, useable by third-party programs or scripts, to
index all words contained in html files. The above example will produce
index.txt:
..
abridged
1 linux/manual/misc/API.html
=1
(0)
absence
3 linux/manual/mod/core.html
2 linux/manual/mod/mod_imap.html
1 linux/manual/misc/nopgp.html
1 linux/manual/mod/mod_proxy.html
1 linux/manual/new_features_1_3.html
=8
(0)
absolute
3 linux/manual/mod/mod_auth_digest.html
1 linux/manual/mod/mod_so.html
=4
(0)
..
Expert User Options
For expert users, the following options provide further
options.
Expert options:
pN priority mode: (* p3)
0 just scan, don't save anything (for checking links)
1 save only html files
2 save only non html files
*3 save all files
7 get html files before, then treat other files
S stay on the same directory
D *can only go down into subdirs
U can only go to upper directories
B can both go up&down into the directory structure
a *stay on the same address
d stay on the same principal domain
l stay on the same location (.com, etc.)
e go everywhere on the web
%H debug HTTP headers in logfile
One interesting application allows the mirror utility
to check for valid and invalid links on a site. This is commonly used
in site tests to look for missing pages or other html errors. I often
run such programs against my web sites to verify that nothing is missing.
httrack http://www.shoesizes.com -O /tmp/shoesizes -p0
To check for valid links outside of a site, the '-t'
option can be used:
httrack http://www.shoesizes.com -O /tmp/shoesizes -t
These options can be combined, for example, to provide
a service that checks sites for validity of links and reports back a
list of missing files and statistics.
Other options allow the retention of select files -
for example - (1) only html files, (2) only non-html files, (3) all
files, and (7) get all html files first, then get other files. This
last option provides a fast way to get the web pointers so that, for
example, a time limited collection process will tend to get the most
important content first.
In many cases, we only want the files froma given
directory. In this case, we specify this option:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -S
This option allows the mirror to go only into
subdirectories of the initial directory on the remote host. You might
want to combine it with the -n option to get all
non-html files linked from the pages you find.
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -D -n
If you only want to work your way up the directory
structure from the specified URL (don't ask me why you might want to do
this), the following command line is for you:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -U
If you want to go both up and down the directory
structure (i.e., anywhere on on this site that the requested page leads
you to), this option will be best:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -B
The default is to remain on the same IP address - or
host name. This option specifes this explicitly:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -a
If you want to restrict yourself only to the same
principal domain (e.g., include sites liks ftp.shoesizes.com), you would
use this option.
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -d
To restrict yourself to the same major portion of the
Internet (e.g., .com, .net, .edu, etc.) try this option:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -l
Finally, if you want to mirror the whole Internet - at
least every place on the internet that is ever led to - either directly
or indirectly - from the starting point, use this one... Please note
that this will almost always run you out of resources unless you use
other options - like limiting the depth of search.
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -e
Last but not least, you can include debugging
informaiton on all headers from a collection process by using this
option:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -'%H'
The options S, D, U, B, a, d, l, and e can be replaces
with filter options approximately as follows:
S -www.foo.com/* +www.foo.com/bar/*[file]
D (default)
U +www.foo.com/bar/* -www.foo.com/*[name]/*
B +www.foo.com/bar/*
a (default)
d +*[name].foo.com/*
l +*[name].com/*
e +* (this is crazy unless a depth limit is used!)
Guru Options - DO NOT USE!!!
This is a new section, for all "not very well
documented options". You can use them, in fact, do not believe what is
written above!
#0 Filter test (-#0 '*.gif' 'www.bar.com/foo.gif')
To test the filter system. Example:
$ httrack -#0 'www.*.com/*foo*bar.gif' 'www.mysite.com/test/foo4bar.gif'
www.mysite.com/test/foo4bar.gif does match www.*.com/*foo*bar.gif
#f Always flush log files
Useful if you want the hts-log.txt file to be flushed
regularly (not buffered)
#FN Maximum number of filters
Use if if you want to use more than the maximum
default number of filters, that is, 500 filters: -#F2000 for 2,000 filters
#h Version info
Informations on the version number
#K Scan stdin (debug)
Not useful (debug only)
#L Maximum number of links (-#L1000000)
Use if if you want to use more than the maximum
default number of links, that is, 100,000 links: -#L2000000 for 2,000,000 links
#p Display ugly progress information
Self-explanatory :) I will have to improve this one
#P Catch URL
"Catch URL" feature, allows to setup a temporary proxy
to capture complex URLs, often linked with POST action (when using form
based authentication)
#R Old FTP routines (debug)
Debug..
#T Generate transfer ops. log every minutes
Generate a log file with transfer statistics
#u Wait time
"On hold" option, in seconds
#Z Generate transfer rate statictics every minutes
Generate a log file with transfer statistics
#! Execute a shell command (-#! "echo hello")
Debug..
Command-line Specific Options
Command-line specific options:
V execute system command after each files ($0 is the filename: -V "rm \$0") (--userdef-cmd )
This option is very nice for a wide array of actions
that might be based on file details. For example, a simple log of all
files collected could be generated by using:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes -V "/bin/echo \$0"
%U run the engine with another id when called as root (-%U smith) (--user )
Change the UID of the owner when running as r00t
Details: User-defined option N
%[param] param variable in query string
This new option is important: you can include query-string content when forming the destination filename!
Example: you are mirroring a huge website, with many pages named as:
www.foo.com/catalog.php3?page=engineering
www.foo.com/catalog.php3?page=biology
www.foo.com/catalog.php3?page=computing
..
Then you can use the -N option:
httrack www.foo.com -N "%h%p/%n%[page].%t"
If found, the "page" parameter will be included after
the filename, and the URLs above will be saved as:
/home/mywebsites/foo/www.foo.com/catalogengineering.php3
/home/mywebsites/foo/www.foo.com/catalogbiology.php3
/home/mywebsites/foo/www.foo.com/catalogcomputing.php3
...
Shortcuts
These options provide shortcust to combinations
of other options that are commonly used.
Shortcuts:
--mirror *make a mirror of site(s) (default)
--get get the files indicated, do not seek other URLs (-qg)
--list add all URL located in this text file (-%L)
--mirrorlinks mirror all links in 1st level pages (-Y)
--testlinks test links in pages (-r1p0C0I0t)
--spider spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
--testsite identical to --spider
--skeleton make a mirror, but gets only html files (-p1)
--update update a mirror, without confirmation (-iC2)
--continue continue a mirror, without confirmation (-iC1)
--catchurl create a temporary proxy to capture an URL or a form post URL
--clean erase cache & log files
--http10 force http/1.0 requests (-%h)
Mirror is the default behavior. It is detailed
earlier.
get simply gets the files specified on the command
line.
The list option is useful for including a list of
sites to collect data from.
The mirrorlinks option is ideal for using the result
of a previous search (like a list of pages found in a web search or
somebody's URL collection) to guide the collection of data. With
additional options (such as depth 1) it can be used to collect all of
the pages linked to a given page without going further. Here is an example:
httrack http://www.shoesizes.com/bob/ -O /tmp/shoesizes --mirrorlinks -e -r1
Testing links in pages is useful for automating the
verification that a link from a file is not pointing to a non-existent
page.
The spider option does a site test automatically and
returns errors for broken links.
The skeleton option makes a mirror of html files only.
The update option updates a site to match a remote
mirror.
The continue option continues a previously terminated
mirroring activity. This is useful for all sorts of mirror failures.
The catchurl option is a small application designed to
catch difficult pages, like sites protected via formulas. You can see
at http://httrack.free.fr/HelpHtml/addurl.html a Windows description of
this application. The purpose is to create a temporary proxy, that will
catch the user request to a page, and then store this request to
continue the mirror. For example,
1. browse www.foo.com/bar/ until you have a page with a form
2. fill this
u replaced by the site's name
N103 to ates protfy> Th.foo.c In some casfication that ncluding a lh3>Log, Cache, and Indetes
d then store Inplacedname
N103 to an lid links outside of a site, the '-t'(plic
httrack rs/windrvw.shoes of a site, the '-t'(plic
httrack rs/windrvw.shoes of a site, the '-t'(plic
httrack rs/windrvw.shoes of a site, the '-t'(plic
httrack rs/windrvw.shoes of a site, the '-t'(plic
htack rs/wm>)
seful for thingthis next casefollow roee meta-tags and robots.txt
files completely and just take whatever we can get from the site. The
danger of this includes the fact that automated programs - like games or
search engines may generate an unlimited number of nearly identical or
identical outputs that will putÃhe fectmber of aclud in the
2 check alwan seoptionimitedlas. You cay
danger of=p alig
B, from collervrrly identical or
irs/winough ths.
use all downloaded files to be saved.
use all downloaded files tosaved. ndrvw.swinough ths.
-ablemp;Browsj0ux Imp;Br0I0t)alwan seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely able rylaceysed f (j0ux/mk aeI0t)
--a0t)alwan
seoely alaceysed f (j0u-a0t)a 2 lineI0t)
--rylaceysly able ~oo.ci.cly able rylacey0ux/mkceysly
effacedmirroria(j0ux/pages is use able ry(j0ux/mk aeIalaceyis use alaceyis use
--ro.ci.c 2 lineis canaeIalas use
--ro.ci.c 2 lineis canaeIalas mp/shoesiinuteB
The default is to remain on the same IP address - or
host name. This option specifes this explicitly:
httrack http://www.shoesizes.com/bob/ -O /tm