httpscan是一个扫描指定网段的Web主机的小工具。和端口扫描器不一样,httpscan是以爬虫的方式进行Web主机发现,因此相对来说不容易被防火墙拦截。
httpscan会返回IP http状态码 Web容器版本 以及网站标题。

Usage:./httpscan IP/CIDR –t threads
Example:./httpscan.py 10.20.30.0/24 –t 10

项目地址:https://github.com/zer0h/httpscan

部分代码:

#!/usr/bin/env python
#coding:utf-8
# Author: Zeroh import re
import sys
import Queue
import threading
import optparse
import requests
from IPy import IP printLock = threading.Semaphore(1) #lock Screen print
TimeOut = 5 #request timeout #User-Agent
header = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36','Connection':'close'} class scan(): def __init__(self,cidr,threads_num):
self.threads_num = threads_num
self.cidr = IP(cidr)
#build ip queue
self.IPs = Queue.Queue()
for ip in self.cidr:
ip = str(ip)
self.IPs.put(ip) def request(self):
with threading.Lock():
while self.IPs.qsize() > 0:
ip = self.IPs.get()
try:
r = requests.Session().get('http://'+str(ip),headers=header,timeout=TimeOut)
status = r.status_code
title = re.search(r'<title>(.*)</title>', r.text) #get the title
if title:
title = title.group(1).strip().strip("\r").strip("\n")[:30]
else:
title = "None"
banner = ''
try:
banner += r.headers['Server'][:20] #get the server banner
except:pass
printLock.acquire()
print "|%-16s|%-6s|%-20s|%-30s|" % (ip,status,banner,title)
print "+----------------+------+--------------------+------------------------------+" #Save log
with open("./log/"+self.cidr.strNormal(3)+".log",'a') as f:
f.write(ip+"\n") except Exception,e:
printLock.acquire()
finally:
printLock.release() #Multi thread
def run(self):
for i in range(self.threads_num):
t = threading.Thread(target=self.request)
t.start() if __name__ == "__main__":
parser = optparse.OptionParser("Usage: %prog [options] target")
parser.add_option("-t", "--thread", dest = "threads_num",
default = 1, type = "int",
help = "[optional]number of theads,default=10")
(options, args) = parser.parse_args()
if len(args) < 1:
parser.print_help()
sys.exit(0) print "+----------------+------+--------------------+------------------------------+"
print "| IP |Status| Server | Title |"
print "+----------------+------+--------------------+------------------------------+" s = scan(cidr=args[0],threads_num=options.threads_num)
s.run()

来源:http://www.rootat.net/2016/03/29/httpscan/

httpscan 爬虫式的网段Web主机发现小工具的更多相关文章

  1. 新手篇丨Python任意网段Web端口信息探测工具

    你学习Python的目的是什么?是想写爬虫爬取数据(数据.图片等内容),还是想自写自动化的小工具,又或是作为一个新手小白单纯的欣赏这门语言呢? 今天i春秋分享的是一篇关于多线程工具的文章,工具使用效率 ...

  2. Python任意网段Web端口信息探测工具

    此篇关于多线程工具的文章,非常适合新手学习,工具效率也挺高的,代码也比较完善,如题. 本文作者:i春秋签约作家——Aedoo 0×00 前言 笔者前一段时间发布了原创文章,“[Python黑客] Py ...

  3. Web压力测试小工具:webbench、http_load、Siege、ab

    webbench 安装 下载地址:http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz 或者 http://soft.vpser ...

  4. web图片转换小工具制作

    HTML <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <titl ...

  5. 前端学HTTP之Web主机托管

    前面的话 对内容资源的存储.协调以及管理的职责统称为Web主机托管.主机托管是Web服务器的主要功能之一.保存并提供内容,记录对内容的访问以及管理内容都离不开服务器.如果不想自行管理服务器所需的软硬件 ...

  6. asp.net core 系列 16 Web主机 IWebHostBuilder

    一.概述 在asp.net core中,Host主机负责应用程序启动和生存期管理.host主机包括Web 主机(IWebHostBuilder)和通用主机(IHostBuilder).Web 主机是适 ...

  7. (15)ASP.NET Core Web主机(IWebHostBuilder)

    1.前言 ASP.NET Core应用程序可以配置和启动主机(Host).主机负责应用程序启动和生存期管理,配置服务器和请求处理管道.主机还可以设置日志记录.依赖关系注入和配置.而host主机又包括W ...

  8. Nmap强大在哪之主机发现

    1.概述 博主前段时间刚入坑渗透测试,随着学习的深入,越来越发现Nmap简直无所不能.今天先从主机发现功能入手分析. 2.Nmap主机发现 nmap --help #nmap帮助 3.参数分析 3.1 ...

  9. 工程师技术(三):独立Web站点的快速部署、虚拟Web主机的部署、配置网页内容访问、使用自定Web根目录、配置安全Web服务、部署并测试WSGI站点

    一.独立Web站点的快速部署 目标: 本例要求为 http://server0.example.com 配置Web站点,要求如下: 1> 从http://classroom/pub/materi ...

随机推荐

  1. springboot+dubbo基于zookeeper快速搭建一个demo

    由于小编是在windows环境下搭建的,故该示例均为在windows下操作,这里只是提供一个快速搭建思路,linux操作也基本上差不多. 首先本示例的dubbo是基于zookeeper发布订阅消息的, ...

  2. PostgreSQL dblink使用过程

    安装: 进入/root/postgresql-11.2/contrib/dblink make && make install 切换到postgres用户 [root@fce40690 ...

  3. MySQL-快速入门(8)存储过程、存储函数

    1.存储过程 1>创建存储过程:create procedure create procedure sp_name ([in | out | inout] param_name type) [c ...

  4. ubutu16.04编译安装apache

    // 安装编译器 sudo apt-get install build-essential // 下载所需依赖及apache2源码包 wget --no-check-certificate https ...

  5. 题解 CF1140D 【Minimum Triangulation】

    题意:求将一个n边形分解成(n-2)个三边形花费的最小精力,其中花费的精力是所有三角形的三顶点编号乘积的和(其中编号是按照顶点的顺时针顺序编写的) 考虑1,x,y连了一个三角形,x,y,z连了一个三角 ...

  6. 搜索专题: HDU1242 Rescue

    Rescue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Sub ...

  7. Django、Flask、Tornado的区别?

    Django:Python 界最全能的 web 开发框架,battery-include 各种功能完备,可维护性和开发速度一级棒.常有人说 Django 慢,其实主要慢在 Django ORM 与数据 ...

  8. 小程序之如和使用view内部组件来进行页面的排版功能

    这篇文章主要介绍了关于小程序之如和使用view内部组件来进行页面的排版功能,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 涉及知识点: 1.垂直排列,水平排列 2.居中对齐 示例: 1 ...

  9. oracle在没

    db_user表中数据: name age nub 张三 13 13 张三 12 12 张三 12 13 张三 12 13 李四 12 12 李四 12 12 查询重复数据(一条) sql:selec ...

  10. iOS微信浏览器回退不刷新(监听浏览器回退事件)

    兼容性:兼容全部ios系统 $(function(){ pushHistory(); }); function pushHistory(){ window.addEventListener(" ...