spider's Introduction
简易分布式爬虫设计 程序大体上由两部分组成,第一部分是总控制台(MSpider),第二部分是子蜘蛛扫描器(Sc)。 总控制台功能:确定要扫描的任务Ip段,将任务Ip段分组,下发给链接的子蜘蛛,当子蜘蛛完成一次扫描后发送信息给母蜘蛛,母蜘蛛继而发送新的任务段给子蜘蛛.程序间的通信由Socket实现。 子蜘蛛扫描器功能:首先与控制台进行链接,获得一个待扫描的任务段Ip,继而开启多线程扫描活跃Ip,具体方法是开启计算机所能承受效率最高的线程数,然后每个线程分配一定数量的Ip进行扫描,运用CyclicBarrier类对线程进行统一管理,所有下发线程扫面完成后继而进行下一次扫面即子蜘蛛的下发线程每次都是同一时间点开始扫描,先结束的也必须等待。判定活跃IP方法为:与目标Ip的设定端口进行规定时间内的链接,若能链接,则判断为活跃Ip,判定活跃Ip后存于BlockingQuenue容器中,不活跃Ip存于另一容器,一次扫面完成后,对不活跃Ip进行二次扫描,将活跃Ip存于活跃Ip容器中.两次扫面完成后向数据库中存入活跃Ip,统计各项信息,如扫面时长,活跃Ip个数等,向母蜘蛛汇报情况以及清理删除容器内的数据,继而请求下一次任务.所有任务执行完之后,向数据库中提取活跃Ip,链接Ip地址进行抓包,将目标Ip地址的html文档抓入制定文件夹,格式为txt文档. 数据库设计: Mysql数据库 库名:internetspider 表名:ActiveIp 表中含有两个字段: 名 类型 长度 允许空值 主键 id int 11 否 是 ip char 30 是 否 2022 4.4 添加一行 2022 4.4 添加二行 2022 4.4 添加三行
spider's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.