文章详情页 您现在的位置是:网站首页>文章详情

扒站神器HTTrack

图片丢失 Jeyrce.Lu 发表于:2020年4月19日 22:31 分类:【服务器 4410次阅读

有时候看到一些中意的网站,但是作者没有开源,短时间也无法联系上作者,这时候扒站神器httrack就有用武之地了,我们可以使用HTTrack克隆整个目标网站的所有页面。但是,一定要注意道德操守和法律法规,不要拿技术拿工具去做一些不符合社会主义核心价值观的事情!

HTTrack的安装

HTTrack支持MacOS、Windows、Linux等主流操作系统,在某些专门做渗透测试、安全攻防的系统下已经内置了这个工具,如

本文则在Deepin-Linux演示此工具的用法。

git clone https://github.com/xroche/httrack.git --recurse

cd httrack

./configure --prefix=$HOME/usr && make -j8 && make install

HTTrack克隆站点演示

通过之前的安装,在命令行输入httr之后table补全,不出意外你已经可以看到httrack这个命令了,他的使用方法也非常简单,本文以我自己的站点为例进行克隆。

jeeyshe@jeeyshe-PC:~$ httrack 

Welcome to HTTrack Website Copier (Offline Browser) 3.48-24
Copyright (C) 1998-2016 Xavier Roche and other contributors
To see the option list, enter a blank line or try httrack --help

# 输入项目名称
Enter project name :ishare

# 输入克隆站点后文件存放位置
Base path (return=/home/jeeyshe/websites/) :

# 要克隆的目标url
Enter URLs (separated by commas or blank spaces) :https://www.lujianxin.com/

# 几种克隆方式,一般选择1或2即可
Action:
(enter)	1	Mirror Web Site(s)
	2	Mirror Web Site(s) with Wizard
	3	Just Get Files Indicated
	4	Mirror ALL links in URLs (Multiple Mirror)
	5	Test Links In URLs (Bookmark Test)
	0	Quit
: 1

# 代理信息,一般不需要
Proxy (return=none) :

# 定义通配符选择需要下载的文件类型,一般无需定义
You can define wildcards, like: -*.gif +www.*.com/*.zip -*img_*.zip
Wildcards (return=none) :

You can define additional options, such as recurse level (-r<number>), separated by blank spaces
To see the option list, type help
Additional options (return=none) :

---> Wizard command line: httrack https://www.lujianxin.com/  -O "/home/jeeyshe/websites/ishare"  -%v  

Ready to launch the mirror? (Y/n) :y

Mirror launched on Sun, 19 Apr 2020 22:04:01 by HTTrack Website Copier/3.48-24 [XR&CO'2014]
mirroring https://www.lujianxin.com/ with the wizard help..

之后根据网站资源多少,会等待一段时间,直到所有页面下载完成,我们已经可以看到在我们~/websites下面已经有了一个ishare目录,当中存储了网站所有页面,直接使用浏览器打开也是可以正常切换页面的。

jeeyshe@jeeyshe-PC:~/websites/ishare$ ll
总用量 36
-rw-r--r-- 1 jeeyshe jeeyshe 4243 4月  19 22:04 backblue.gif
-rw-r--r-- 1 jeeyshe jeeyshe  233 4月  19 22:06 cookies.txt
-rw-r--r-- 1 jeeyshe jeeyshe  828 4月  19 22:04 fade.gif
drwx------ 2 jeeyshe jeeyshe 4096 4月  19 22:06 hts-cache
-rw-r--r-- 1 jeeyshe jeeyshe 1123 4月  19 22:06 hts-log.txt
-rw-r--r-- 1 jeeyshe jeeyshe 5223 4月  19 22:04 index.html
drwxr-xr-x 5 jeeyshe jeeyshe 4096 4月  19 22:04 www.lujianxin.com

如果克隆过程出现了中断,也是没有关系的,httrack支持断点续传,进入对应目录重新下载即可。另外,上面提到的用法是一个交互式shell窗口,httrack也是支持命令模式的,例如以上我们操作的步骤等同于执行命令:

httrack https://www.lujianxin.com/  -O "/home/jeeyshe/websites/ishare"  -%v

此外httrack还提供了一些常用的快捷命令:

Shortcuts:
--mirror      <URLs> *make a mirror of site(s) (default)
--get         <URLs>  get the files indicated, do not seek other URLs (-qg)
--list   <text file>  add all URL located in this text file (-%L)
--mirrorlinks <URLs>  mirror all links in 1st level pages (-Y)
--testlinks   <URLs>  test links in pages (-r1p0C0I0t)
--spider      <URLs>  spider site(s), to test links: reports Errors & Warnings (-p0C0I0t)
--testsite    <URLs>  identical to --spider
--skeleton    <URLs>  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)

以上提到的用法基本可以拿到绝大多数你想要的东西了,如果要更加深入一层,那么可能就要游走在法律的边缘了,最近pandownload作者被抓一事想必大家都有所耳闻,请对自己的行为负责,三思而后行。



版权声明 本文属于本站  原创作品,文章版权归本站及作者所有,请尊重作者的创作成果,转载、引用自觉附上本文永久地址: http://blog.lujianxin.com/x/art/3x2x0qdyuucw

文章评论区

作者名片

图片丢失
  • 作者昵称:Jeyrce.Lu
  • 原创文章:61篇
  • 转载文章:3篇
  • 加入本站:1836天

站点信息

  • 运行天数:1837天
  • 累计访问:164169人次
  • 今日访问:0人次
  • 原创文章:69篇
  • 转载文章:4篇
  • 微信公众号:第一时间获取更新信息