import urllib
import urllib2
#import webbrowser
import re
import socket def is_domain_in_black_list(domain, ip):
try_time = 3
url = "http://www.bulkblacklist.com/"
for i in range(try_time):
try:
data = urllib.urlencode({'domains': domain})
results = urllib2.urlopen(url, data, timeout=30)
all_data = results.read()
#with open("results.html", "w") as f:
# f.write(all_data)
#print all_data
#webbrowser.open("results.html")
assert all_data.find(domain) >= 0
search = re.compile(r'(\d+\.\d+\.\d+\.\d+)')
black_ip_list = search.findall(all_data)
print black_ip_list
return ip in black_ip_list
except urllib2.URLError, e:
if isinstance(e.reason, socket.timeout):
print domain, "timeout:", e
else:
print domain, "err:",e
return False def is_domain_access_normal(domain):
try_time = 3
for i in range(try_time):
try:
url = "http://%s" % domain
html = urllib2.urlopen(url, timeout=10).read()
#print url, html
return True
except urllib2.URLError, e:
if isinstance(e.reason, socket.timeout):
print "timeout:", e
else:
print "other err:",e
return False domain = "tojoycloud.org"
print "is_domain_in_black_list:", is_domain_in_black_list(domain, "1.1.2.3")
print "is_domain_access_normal:", is_domain_access_normal(domain)

python 从bulkblacklist信誉查询网站提交查询的更多相关文章

  1. python 全栈开发,Day63(子查询,MySQl创建用户和授权,可视化工具Navicat的使用,pymysql模块的使用)

    昨日内容回顾 外键的变种三种关系: 多对一: 左表的多 对右表一 成立 左边的一 对右表多 不成立 foreign key(从表的id) refreences 主表的(id) 多对多 建立第三张表(f ...

  2. 子域名爆破&C段查询&调用Bing查询同IP网站

    在线子域名爆破 <?php function domainfuzz($domain) { $ip = gethostbyname($domain); preg_match("/\d+\ ...

  3. Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据

    Atitit.列表页面and条件查询的实现最佳实践(1)------设置查询条件and提交查询and返回json数据 1. 1. 配置条件字段@Conditional 1 1 2. 2. 配置条件字段 ...

  4. 情报收集:Metasploit命令、查询网站和测试网站

    外围信息收集: testfire.com IBM建立的测试网站 http://www.maxmind.com 查找一些网站的地理位置 http://searchdns.netcraft.com/ 查询 ...

  5. 推荐一个CMMI认证查询网站

    随着软件企业的增多和意识的增强,越来越多公司开始做CMMI的认证评估,由于国内网速和CMMI官网的网站综合原因,打开速度超级慢. 所以本文推荐一个CMMI认证查询网站,认证后的结果查询可以点这里查询: ...

  6. Atitit.列表页and查询条件的最佳实践(1)------设定搜索条件and提交查询and返回json数据

    Atitit.列表页and查询条件的最佳实践(1)------设置查询条件and提交查询and返回json数据 1. 1. 配置条件字段@Conditional 1 1 2. 2. 配置条件字段显示类 ...

  7. python全栈开发day68-ORM操作:一般操作、ForeignKey操作、ManyToManyField、聚合查询和分组查询、F查询和Q查询等

    ORM操作 https://www.cnblogs.com/maple-shaw/articles/9403501.html 一.一般操作 1. 必知必会13条 <1> all(): 查询 ...

  8. Python操作Mysql数据库——多表组合查询

    前面我们介绍了单张表的查询,包括模糊查询.分组.排序.各种筛选条件等等操作,在实际应用中,查询的数据往往不止局限在一张表里,通常需要多张表在一起进行组合查询,今天我们将会对Mysql当中的多张有关联的 ...

  9. Log2Net日志查询网站代码解析

    在前面的几节中,我们介绍了Log2Net的使用方法和代码设计.使用这个组件,我们可以方便地将日志记录到数据库中,那么,我们怎么能看到这些日志呢?于是,日志查询网站应运而生.效果图如下: 该代码已开源, ...

随机推荐

  1. POJ 2406 KMP next数组的应用

    题意:让你找最小重复串的个数 加深KMP中对next数组的理解 #include <cstdio> #include <cstring> using namespace std ...

  2. C#操作Mysql类

    using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Text. ...

  3. Boolean占几个字节

    Boolean:1.1bit 2.1byte 3.4byte 简书地址:  http://www.jianshu.com/p/2f663dc820d0 官网地址:       http://docs. ...

  4. mysql5.7 设置密码

    5.7版本的MYSQL的用户表的密码字段与以往版本有所区别, 不再是password字段 而是authentication_string字段. 请注意修改密码: vim  /opt/mysql_d/m ...

  5. vue路由history模式下打包node服务器配置

    vue-router 默认 hash 模式 —— 使用 URL 的 hash 来模拟一个完整的 URL,于是当 URL 改变时,页面不会重新加载. 如果不想要很丑的 hash,我们可以用路由的 his ...

  6. js原生_获取url键值对

    思路: 1.先对url进行处理,获取 ?后的字符串 postid=10457794&actiontip=保存修改成功') 2. 字符串通过&标识,不同参数转为数组 ["pos ...

  7. dbcp相关配置

    最近在看一些dbcp的相关内容,顺便做一下记录,免得自己给忘记了.   1. 引入dbcp (选择1.4) <dependency> <groupId>com.alibaba. ...

  8. 全栈框架——MEAN

    MEAN: MongoDB - Express - AngularJs - Node.js MongoDB 是一个面向文档的. NoSQL 类型的数据库.MongoDB 颠覆了传统的基于表的数据存储方 ...

  9. vc++创建窗体

    //创建窗口,一般分为四步 /*1 WinMain函数的定义 2 创建一个窗口 3 编写消息循环 4 编写窗口过程函数*/ #include <windows.h> //包含windows ...

  10. php 单例模式与常驻服务

    运行机制使得每个PHP页面被解释执行后,所有的相关资源都会被回收.也就是 说,PHP在语言级别上没有办法让某个对象常驻内存.在PHP中,所有的变量都是页面级的,无论是全局变量,还是类的静态成员,都会在 ...