web指纹识别脚本

找到份800+的指纹字典,原理就是根据一些特殊文件的md5来判断cms。没事写着玩的,单线程的并没有什么卵用。py2在cmd下显示中文乱码,略烦。

简易脚本:

#! /usr/bin/env python
# coding:utf-8

'''
简易web指纹识别
基于文件md5验证
'''

import requests
import hashlib
import re
import sys

# 单url检测
url = sys.argv[1]
cms = sys.argv[2]

if len(sys.argv) != 3:
    print u'''
    Usage:web_identify.py http://www.baidu.com cms.txt
    cms.txt格式:
    /favicon.ico|Jingyi|32b016195f800b8d3e8d93fbd24583b4
    '''
# 获取md5
def getmd5(url):
    try:
        res = requests.get(url)
        cont = res.content
        md5 = hashlib.md5(cont).hexdigest()
        return md5
    except Exception:
        print u'网址打开错误'
        return None

# 分割cms.txt
with open(cms, 'r') as f:
    for line in f.readlines():
        li = re.split('\||\\n', line)
        url0 = li[0]
        cmsName = li[1]
        cmsMd5 = li[2]
        newUrl = url + url0
        tmpMd5 = getmd5(newUrl)
        print u'正在检测:', cmsName
        if tmpMd5 == cmsMd5:
            print 'result: %s' % cmsName
            break

标签: none

添加新评论