本文整理汇总了Python中tools.Tools.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Tools.__init__方法的具体用法?Python Tools.__init__怎么用?Python Tools.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.Tools
的用法示例。
在下文中一共展示了Tools.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
MAC lookup to identify the vendor from the OUI of the mac address
Usage example:
>>> x = mac.Mac()
>>> x.id_mac('0000.0c07.ac03')
('Cisco', 'CISCO SYSTEMS')
Tested with Python ver 2.7.2 on Win7 & Win XP
(c) 2012 - 2014 Intelligent Planet Ltd
"""
if "\\" in os.getcwd():
self.path = os.getcwd() + "\\"
else:
self.path = os.getcwd() + "/"
self.mac_file = self.path + "mac"
self.mac_file_url = "http://anonsvn.wireshark.org/wireshark/trunk/manuf"
self.oui_list = []
try:
self.load_mac()
except:
self.create_mac_file() # download mac oui list and save to file as per the self.mac_file value
self.load_mac()
示例2: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=0):
Tools.__init__(self)
"""
Assigned Internet Protocol Numbers search tool
downloaded port list from
http://www.iana.org/assignments/protocol-numbers/protocol-numbers-1.csv
format of csv file
Decimal,Keyword,Protocol,Reference
0,HOPOPT,IPv6 Hop-by-Hop Option,[RFC2460]
1,ICMP,Internet Control Message,[RFC792]
format of dictionary
[Protocol_num]['name'] = name
[Protocol_num]['description'] = description
Tested with Python ver 2.7.2 on Win7 & Win XP
(c) 2012 - 2014 Intelligent Planet Ltd
"""
self.verbose = verbose
self.protocol_dict = {}
self.path = os.getcwd() + '\\'
self.load_file = self.path + 'protocols.csv'
self.load()
示例3: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=0):
Tools.__init__(self)
"""
Cisco IP Cache Flow parse tool and Db viewer
SrcIf SrcIPaddress DstIf DstIPaddress Pr SrcP DstP Pkts
Fa0/1 10.155.20.122 Se0/0:0.101* 10.7.10.124 01 0000 0000 219
Fa0/1 10.155.20.123 Se0/0:0.101* 10.7.10.124 01 0000 0000 219
Fa0/0 10.182.137.8 Se0/0:0.101* 62.239.26.81 06 C508 07D0 2
[flow_id] = {}
[flow_id][SrcIPaddress]
[flow_id][DstIPaddress]
[flow_id][SrcIf]
[flow_id][DstIf]
[flow_id][Protocol]
[flow_id][SrcPort]
[flow_id][DstPort]
[flow_id][Packets]
Written by Peter Rogers
(C) Intelligent Planet 2013
"""
self.load_file = 'c:/cache_load'
self.limit = 200
self.verbose = verbose
self.cache_dict = {}
self.display_heading = '\nSrcIPaddress SrcPort DstIPaddress DstPort Protocol Packets\n'
示例4: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=0):
Tools.__init__(self)
"""
Well known port search tool
downloaded port list from
http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv
format of csv file
Service Name,Port Number,Transport Protocol,Description,Assignee,Contact,Registration Date,Modification Date,Reference,Service Code,Known Unauthorized Uses,Assignment Notes
ftp-data,20,tcp,File Transfer [Default Data],[Jon_Postel],[Jon_Postel],,,,,,
ftp-data,20,udp,File Transfer [Default Data],[Jon_Postel],[Jon_Postel],,,,,,
format of dictionary
[portnum_protocol]['name'] = name
[portnum_protocol]['description'] = description
Written by Peter Rogers
(C) Intelligent Planet 2013
"""
self.verbose = verbose
self.port_dict = {}
self.load_file = 'c:/ports.csv'
self.load()
示例5: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=0):
Tools.__init__(self)
"""
Well known port search tool
downloaded port list from
http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv
format of csv file
Service Name,Port Number,Transport Protocol,Description,Assignee,Contact,Registration Date,Modification Date,Reference,Service Code,Known Unauthorized Uses,Assignment Notes
ftp-data,20,tcp,File Transfer [Default Data],[Jon_Postel],[Jon_Postel],,,,,,
ftp-data,20,udp,File Transfer [Default Data],[Jon_Postel],[Jon_Postel],,,,,,
format of dictionary
[portnum_protocol]['name'] = name
[portnum_protocol]['description'] = description
Tested with Python ver 2.7.2 on Win7 & Win XP
(c) 2012 - 2014 Intelligent Planet Ltd
"""
self.verbose = verbose
self.port_dict = {}
self.path = os.getcwd() + '\\'
self.load_file = self.path + 'ports.csv'
self.load()
示例6: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, ip="", hostname="", out_dict="", auth_con=""):
Tools.__init__(self)
Vty.__init__(self, hostname, out_dict)
"""
interface to the the telnet library
"""
self.ip = ip
self.hostname = hostname.lower()
self.port = 23
self.auth_con = auth_con
self.user = ""
self.password = ""
self.path = os.getcwd() + "\\"
self.newline = "\r\n"
self.space = " "
self.verbose = 1
self.read_until_timeout = 2
self.timeout = 5
self.sleep = 0.1
# set the values for Cisco as default
self.login_text = "Username: "
self.password_text = "Password: "
self.exit_text = "q"
self.banner_list = ["\d+>", "--More--", "\d+#"]
self.more = "--More--"
示例7: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
Cisco show command parse tool and Db viewer
sh ip int brief format is:
['Interface', 'IP-Address', 'OK?', 'Method', 'Status', 'Protocol']
Dict format example is:
self.dict_db[self.hostname] = {}
self.dict_db[self.hostname][command] = {}
self.dict_db[self.hostname][command][interface] = {}
self.dict_db[self.hostname][command][interface][ip-address] = value
"""
self.verbose = 0
### set the path to the log and db files ###
try: self.path = 'H:/crt/sessions/'
except: self.path = 'C:/Program Files/SecureCRT/Sessions/'
self.load_file = self.path + 'log'
self.db_file = self.path + 'show_db'
self.load_dict()
self.classify_dict = {'sh ip int brief': ['Interface', 'IP-Address']}
示例8: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=0):
Tools.__init__(self)
"""
X.25 Routing parser for cisco routers
format of router output
r01#sh x25 rou | inc dest|0/0
1 dest ^(0000111111).* xot 10.11.12.13
2 dest ^(0000111112).* xot 10.11.12.14
format of dictionary
key = auto incrementing integer
[key]['router'] = hostname
[key]['route_id'] = route_num
[key]['x25_route'] = destination
[key]['ip_address'] = ip_add
[key]['match'] = match
Written by Peter Rogers
(C) Intelligent Planet 2013
"""
self.verbose = verbose
self.x25_dict = {}
self.route_list = []
self.config = []
self.config_list = []
self.load_file = 'c:/x25'
self.out_file = 'c:/x25_out'
self.display_heading = '\n # X.25 route IPaddress match router \n'
self.load()
示例9: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
Dictionary storage method
Use # followed by csv fields to define headers e.g. #host, ip, model, serial number
dictionary format example
dict_db[unique numeric key] = {}
dict_db[unique numeric key]['host'] = 'router-01'
dict_db[unique numeric key]['ip'] = '1.1.1.1'
dict_db[unique numeric key]['model'] = 'cisco 2811'
dictionary search index
search_db['router-01'] = {}
search_db['router-01']['tag'] = 'host'
search_db['router-01']['key'] = unique numeric key
search_db['1.1.1.1'] = {}
search_db['router-01']['tag'] = 'ip'
search_db['router-01']['key'] = unique numeric key
host entries appended to the self index list to provide a way to check for unique entries when adding data
data entries appended to the register if unique, if not the key number is added to the entry i.e. Cisco #123
Written by Peter Rogers
(C) Intelligent Planet 2013
"""
self.verbose = 1
self.space_size = 18
self.index = []
self.index_db = {}
self.register = {}
self.dict_db = {}
self.search_db = {}
示例10: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, ip='192.168.1.10', name='test', port=23):
Tools.__init__(self)
"""
Network tool kit
Tested on Win XP with Python 2.7
(c) 2012, 2013 Intelligent Planet Ltd
"""
self.init_net(ip, name, port)
self.timeout = 0.2
self.sleep = 0.1
self.verbose = 1
self.buffers = 1024
self.error = 'fail'
self.web_proxy = '172.19.193.122'
self.port_list = [20, 21, 22, 23, 25, 53, 67, 68, 69, 80, 161, 162, 179, 443, 520, 1719, 1720, 1985, 1998, 2000, 2427, 3389, 5060, 5900, 8080]
#FTP(20, 21), SSH(22), Telnet(23), SMTP(25), DNS(53), DHCP(67, 68), TFTP(69), HTTP(80), SNMP(161, 162), BGP(179), HTTPS(443), RIP(520)
#H.323(1719. 1720), HSRP(1985), XOT(1998), SCCP(2000), MGCP(2427), RDP(3389), SIP(5060), VNC(5900)
self.http_get = 'GET /index.html HTTP/1.1 \r\n'
self.http_host = 'Host: %s \r\n\r\n'
示例11: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
English language lookup tools
Word list from http://www-01.sil.org/Linguistics/wordlists/english/wordlist/wordsEn.txt
(c) 2012, 2013 Intelligent Planet Ltd
"""
self.alphabet = 'abcdefghijklmnopqrstuvwxyz'
self.eng_dict = self.load('c:/python27/wordsEn.txt')
self.freq = self.letter_frequency(self.eng_dict)
示例12: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, verbose=1, maxq=200):
Net.__init__(self)
Tools.__init__(self)
"""
Multithreaded network tools
"""
self.verbose = verbose
self.maxq = maxq
self.timeout = 0.2 #
self.buffers = 256 #for check_port
示例13: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self, ip, name, port, auth_con=''):
Tools.__init__(self)
self.ip = ip
self.name = name
self.port = port
self.auth_con = auth_con
self.verbose = 1
self.telnet_timeout = 2
self.telnet_cmd_timeout = 5
self.telnet_sleep = 0.1
self.path = os.getcwd() + '\\'
self.ssh_key_file = self.path + 'ssh_host_keys'
示例14: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
Dictionary storage method
Use # followed by csv fields to define headers e.g. #host, ip, model, serial number
device dict = [key][user specified fields]
Written by Peter Rogers
(C) Intelligent Planet 2013
"""
self.verbose = 1
self.key_txt = 'key'
self.space_size = 18
self.index = []
示例15: __init__
# 需要导入模块: from tools import Tools [as 别名]
# 或者: from tools.Tools import __init__ [as 别名]
def __init__(self):
Tools.__init__(self)
"""
Search interface for host, ip and extended information within device db
Start point for Command line networking toolkit
Tested with Python ver 2.7.2 on Win7 & Win XP
(c) 2012 - 2014 Intelligent Planet Ltd
"""
self.verbose = 0
### cli vars ###
self.search_txt = '\n\nsearch >>>'
self.user = getpass.getuser()
### set the path to csv device files ###
try:
self.path = 'H:/crt/sessions/'
cfile = self.path + 'telnet.ini'
open(cfile)
except:
try:
self.path = 'C:/Documents and Settings/' + self.user + '/Application Data/VanDyke/SecureCRT/Config/sessions/'
cfile = self.path + 'telnet.ini'
open(cfile)
except: self.path = os.getcwd() + '\\'
self.log_file = self.path + 'log'
self.sticky = 1 #can be set to 0 to disable level1 cli
self.session_fail_delay = 2
self.session_start_delay = 1
self.total_records = len(dev_con.search_db)
self.total_hosts = len(dev_con.index)
self.batch_con = batch.Batch(dev_con, self)
self.host_list = []
self.dns_suffix = []
self.test_dns_suffix()
self.arp_start()
self.level_0()