Ejemplo n.º 1
0
                        len(search) > 0
                        and host.hostResolvedName().lower().find(search.lower()) == -1
                        and host.ethAddress().lower().find(search.lower()) == -1
                        and host.ipAddress().lower().find(search.lower()) == -1
                    ):
                        continue
                    if host.ipAddress() == "":
                        # drop host with no throughput or no ip
                        continue
                    geo = host.geoIP()
                    country = geo.get("country_name", "")
                    countryCode = geo.get("country_code", "")
                    hostType = (
                        0
                        + __P2P__ * host.isP2P()
                        + __VOIP__ * (host.isVoIPHost() | host.isVoIPClient() | host.isVoIPGateway())
                        + __PRINTER__ * host.isPrinter()
                        + __DIRECTORY__ * host.isDirectoryHost()
                        + __WORKSTATION__ * host.isWorkstation()
                        + __HTTPHOST__ * host.isHTTPhost()
                        + __FTPHOST__ * host.isFTPhost()
                        + __SERVER__ * host.isServer()
                        + __MAILSERVER__ * (host.isSMTPhost() | host.isPOPhost() | host.isIMAPhost())
                        + __DHCP__ * (host.isDHCPClient() | host.isDHCPServer())
                        + __NTP__ * (host.isNtpServer())
                    )

                    thpSent = host.sendThpt()
                    thpRcvd = host.receiveThpt()

                    if len(choice) <= 0:
Ejemplo n.º 2
0
                while ntop.getNextHost(i):
                    if (len(search) > 0
                            and host.hostResolvedName().lower().find(
                                search.lower()) == -1
                            and host.ethAddress().lower().find(search.lower())
                            == -1 and host.ipAddress().lower().find(
                                search.lower()) == -1):
                        continue
                    if host.ipAddress() == "":
                        #drop host with no throughput or no ip
                        continue
                    geo = host.geoIP()
                    country = geo.get('country_name', '')
                    countryCode = geo.get('country_code', '')
                    hostType = 0 + __P2P__ * host.isP2P() + __VOIP__ * (
                        host.isVoIPHost() | host.isVoIPClient()
                        | host.isVoIPGateway()) + __PRINTER__ * host.isPrinter(
                        ) + __DIRECTORY__ * host.isDirectoryHost(
                        ) + __WORKSTATION__ * host.isWorkstation(
                        ) + __HTTPHOST__ * host.isHTTPhost(
                        ) + __FTPHOST__ * host.isFTPhost(
                        ) + __SERVER__ * host.isServer() + __MAILSERVER__ * (
                            host.isSMTPhost() | host.isPOPhost()
                            | host.isIMAPhost()) + __DHCP__ * (
                                host.isDHCPClient() | host.isDHCPServer()
                            ) + __NTP__ * (host.isNtpServer())

                    thpSent = host.sendThpt()
                    thpRcvd = host.receiveThpt()

                    if (len(choice) <= 0):
Ejemplo n.º 3
0
selectedif = form.getvalue('if', default="")

ifIndex = identify_interface_index(selectedif)

while ntop.getNextHost(ifIndex):
    if host.ipAddress() == "":
        #drop host with no throughput or no ip
        continue

    #host.hostResolvedName()
    #ntop.sendString("%s\n" % host.hostResolvedName())
    #ip,mac,name,fingerprint,isFTPhost,isWorkstation,isMasterBrowser,isPrinter,isSMTPhost,isPOPhost,isIMAPhost,isDirectoryHost,isHTTPhost,isVoIPClient,isVoIPGateway,isDHCPServer,isDHCPClient,
    data = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % (
        host.ipAddress(), host.ethAddress(), host.hostResolvedName(),
        host.fingerprint(), host.isFTPhost(), host.isWorkstation(),
        host.isMasterBrowser(), host.isPrinter(), host.isSMTPhost(),
        host.isPOPhost(), host.isIMAPhost(), host.isDirectoryHost(),
        host.isHTTPhost(), host.isVoIPClient(), host.isVoIPGateway(),
        host.isDHCPServer(), host.isDHCPClient())
    ntop.sendString("%s\n" % data)
'''
while ntop.getNextHost(interfaceId):
	#ip,mac,name,fingerprint,isFTPhost,isWorkstation,isMasterBrowser,isPrinter,isSMTPhost,isPOPhost,isIMAPhost,isDirectoryHost,isHTTPhost,isVoIPClient,isVoIPGateway,isDHCPServer,isDHCPClient,
	data = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % (host.ipAddress(), host.ethAddress(), host.hostResolvedName(), host.fingerprint(),
							 host.isFTPhost(),host.isWorkstation(),host.isMasterBrowser(),host.isPrinter(),
							 host.isSMTPhost(),host.isPOPhost(),host.isIMAPhost(),host.isDirectoryHost(),host.isHTTPhost(),
							 host.isVoIPClient(),host.isVoIPGateway(),host.isDHCPServer(),host.isDHCPClient())
	ntop.sendString("%s\n" % data)	

'''
Ejemplo n.º 4
0
topHostsByPeakThroughputData = {}
topHostsByAverageThroughputData = {}
topHostsByActualThroughputData = {}
topHostsByTransferedBytesData = {}
topHostsByTransferedPacketsData = {}

while ntop.getNextHost(ifIndex):
	
	if host.ipAddress()=="":
		 #drop host with no throughput or no ip
		continue 
		
	geo = host.geoIP()
	country = geo.get('country_name', '')
	countryCode = geo.get('country_code', '')
	hostType = 0 + __P2P__*host.isP2P() + __VOIP__*(host.isVoIPHost()|host.isVoIPClient()|host.isVoIPGateway()) + __PRINTER__*host.isPrinter() + __DIRECTORY__*host.isDirectoryHost() + __WORKSTATION__*host.isWorkstation() + __HTTPHOST__*host.isHTTPhost() + __FTPHOST__*host.isFTPhost() + __SERVER__*host.isServer() + __MAILSERVER__*(host.isSMTPhost()|host.isPOPhost()|host.isIMAPhost()) + __DHCP__*(host.isDHCPClient()|host.isDHCPServer())

	thpSent=host.sendThpt()
	thpRcvd=host.receiveThpt()
	
	# set peak throughput
	# according to direction ( kBps )
	thpPeakSent = (thpSent['peak']*8)/1000
	thpPeakRcvd = (thpRcvd['peak']*8)/1000
	thpPeak = thpPeakSent
	if (direction == 1): thpPeak = thpPeakRcvd
	
	# set average throughput
	# according to direction
	thpAvgSent = (thpSent['average']*8)/1000
	thpAvgRcvd = (thpRcvd['average']*8)/1000
Ejemplo n.º 5
0
form = cgi.FieldStorage();

# Top hosts for which interface?
selectedif = form.getvalue('if', default="")

ifIndex = identify_interface_index(selectedif)

while ntop.getNextHost(ifIndex):
	if host.ipAddress()=="":
		 #drop host with no throughput or no ip
		continue 

	#host.hostResolvedName()
	#ntop.sendString("%s\n" % host.hostResolvedName())
	#ip,mac,name,fingerprint,isFTPhost,isWorkstation,isMasterBrowser,isPrinter,isSMTPhost,isPOPhost,isIMAPhost,isDirectoryHost,isHTTPhost,isVoIPClient,isVoIPGateway,isDHCPServer,isDHCPClient,
	data = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % (host.ipAddress(), host.ethAddress(), host.hostResolvedName(), host.fingerprint(),
							 host.isFTPhost(),host.isWorkstation(),host.isMasterBrowser(),host.isPrinter(),
							 host.isSMTPhost(),host.isPOPhost(),host.isIMAPhost(),host.isDirectoryHost(),host.isHTTPhost(),
							 host.isVoIPClient(),host.isVoIPGateway(),host.isDHCPServer(),host.isDHCPClient())
	ntop.sendString("%s\n" % data)
'''
while ntop.getNextHost(interfaceId):
	#ip,mac,name,fingerprint,isFTPhost,isWorkstation,isMasterBrowser,isPrinter,isSMTPhost,isPOPhost,isIMAPhost,isDirectoryHost,isHTTPhost,isVoIPClient,isVoIPGateway,isDHCPServer,isDHCPClient,
	data = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % (host.ipAddress(), host.ethAddress(), host.hostResolvedName(), host.fingerprint(),
							 host.isFTPhost(),host.isWorkstation(),host.isMasterBrowser(),host.isPrinter(),
							 host.isSMTPhost(),host.isPOPhost(),host.isIMAPhost(),host.isDirectoryHost(),host.isHTTPhost(),
							 host.isVoIPClient(),host.isVoIPGateway(),host.isDHCPServer(),host.isDHCPClient())
	ntop.sendString("%s\n" % data)	

'''