⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ntoptest.py

📁 ntop 3.2的源代码
💻 PY
字号:
#!/usr/bin/env pythonimport urllib, timeURL = "http://localhost:3000/dumpData.html?language=python"print "Getting NTop stats in Python format"statsText = ''attempt = 1# NTop takes a while to build the statswhile not statsText.count("hostNumIpAddress"):	print "Attempt #" + str(attempt)	try:		statsText = urllib.urlopen(URL).read()	except IOError:		"NTop timed out, is it active?"	assert statsText.count("ntopDict"), \		"ntopDict not in output"	assert attempt < 100, \		"Could not get stats from NTop"	attempt += 1	# give it a little while	time.sleep(2)try:	exec(statsText)except:	print "Problems interpreting the stats"else:	print "Found stats for the following hosts:"	for host in ntopDict.keys():		print hostprint "All done."

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -