コード例 #1
0
ファイル: url_abuse_async.py プロジェクト: PSJoshi/url-abuse
def psslcircl(url, user, passwd, q):
    cached = _cache_get(q, 'pssl')
    if cached is not None:
        return cached
    psslcircl = PyPSSL(url, basic_auth=(user, passwd))
    response = psslcircl.query(q)
    if response.get(q) is not None:
        entries = response[q]
        _cache_set(q, entries, 'pssl')
        return entries
    return None
コード例 #2
0
def query_certificates():
    parser = argparse.ArgumentParser()
    parser.add_argument('-u', '--username', required=True, type=str)
    parser.add_argument('-p', '--password', required=True, type=str)
    parser.add_argument('ip')
    args = parser.parse_args()

    ip = args.ip
    psslObj = PyPSSL(basic_auth=(args.username, args.password))

    resp = psslObj.query(ip)
    if len(resp) == 0:
        serv_pssl.set(ip, {})
    else:
        serv_pssl.set(ip, resp[ip])
コード例 #3
0
def psslcircl(url, user, passwd, q):
    cached = _cache_get(q, 'pssl')
    if cached is not None:
        return cached
    pssl = PyPSSL(url, basic_auth=(user, passwd))
    response = pssl.query(q)
    if response.get(q) is not None:
        certinfo = response.get(q)
        entries = {}
        for sha1 in certinfo['certificates']:
            entries[sha1] = []
            if certinfo['subjects'].get(sha1):
                for value in certinfo['subjects'][sha1]['values']:
                    entries[sha1].append(value)
        _cache_set(q, entries, 'pssl')
        return entries
    return None