?? ntoptest.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."
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -