<commit_before><commit_msg>Week3 Ex1<commit_after>#!/usr/bin/env python

snmp_oids = (
#    ('sysName', '1.3.6.1.2.1.1.5.0', None),
    ('sysUptime', '1.3.6.1.2.1.1.3.0', None),
    ('runLastChange', '1.3.6.1.4.192.168.127.12.1.1.1.0', True),
    ('runLastSave', '1.3.6.1.4.192.168.127.12.1.1.2.0', True),
    ('startLastChange', '1.3.6.1.4.192.168.127.12.1.1.3.0', True),
)

IP = '192.168.3.11'
portv3 = 161
a_user = 'pysnmp'
auth_key = 'galileo1'
encrypt_key = 'galileo1'
snmp_user = (a_user, auth_key, encrypt_key)
pynet_rtr = (IP, portv3)

import snmp_helper

sysName = snmp_helper.snmp_get_oid_v3(pynet_rtr, snmp_user, oid='1.3.6.1.2.1.1.5.0')

print snmp_helper.snmp_extract(sysName) + " - " + IP

for desc, an_oid, is_count in snmp_oids:
    snmp_data = snmp_helper.snmp_get_oid_v3(pynet_rtr, snmp_user, oid=an_oid)
    output = snmp_helper.snmp_extract(snmp_data)
    print "%s    %s" % (output, desc)
{'fraction_non_alphanumeric': 0.20242024202420242, 'fraction_numerical': 0.11771177117711772, 'mean_word_length': 3.715025906735751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 16, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2090507', 'n_tokens_mistral': 495, 'n_tokens_neox': 463, 'n_words': 62}