今天更新的是爆破二级域名
版本:Python 3.5
一共是两个文件1、Address.py 2、dns.py[附件配字典,如有不清楚的请联系我QQ]
下面有附件打包.
1、Address.py
import pymysql
class Address(object):
#domainName:www.baidu.com
#ip:192.168.0.1
#tableName:baidu.com
def __init__(self,domainName,ip,tableName):
self.domainName = domainName
self.ip = ip
self.tableName = tableName
#调用创建表的函数
self.createTable(tableName)
#如果这个IP地址存在,则不插入数据
if self.isHava(tableName,ip):
self.insertTable(domainName,ip,tableName)
def createTable(self,tableName):
#根据tableName的参数,创建表
coon = pymysql.connect(host = 'localhost',port = 3306, user = 'root', passwd = '',db = 'new',charset = 'UTF8')
cursor = coon.cursor()
#根据'.'对tableName进行拆分['baidu','com'] 根据某一字符给它拆分
DM = tableName.split('.')
a = 'create table if not exists ' + DM[0] +' (id int primary key auto_increment,domainName varchar(1000),ip varchar(1000))'
cursor.execute(a)
coon.commit()
coon.close()
def insertTable(self,domainName,ip,tableName):
#根据table