mirror of
				https://github.com/optim-enterprises-bv/nDPId.git
				synced 2025-11-04 12:17:50 +00:00 
			
		
		
		
	* nDPId: Fixed broken validation tests. * nDPId: Removed TICK_RESOLUTION, not required anymore. * c-collectd: Improved total layer4 payload calculation/update handling. * c-collectd: Updated RRD Graph script according to total layer4 payload changes. * py-flow-info.py: Fixed several bugs and syntax errors. * Python scripts: Added dirname(argv[0]) as search path for nDPIsrvd.py. * nDPIsrvd&nDPId-test: Fixed missing EPOLLERR check. Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			923 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			923 B
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env python3
 | 
						|
 | 
						|
import os
 | 
						|
import sys
 | 
						|
 | 
						|
sys.path.append(os.path.dirname(sys.argv[0]) + '/../../dependencies')
 | 
						|
sys.path.append(os.path.dirname(sys.argv[0]) + '/../share/nDPId')
 | 
						|
sys.path.append(os.path.dirname(sys.argv[0]))
 | 
						|
sys.path.append(sys.base_prefix + '/share/nDPId')
 | 
						|
import nDPIsrvd
 | 
						|
from nDPIsrvd import nDPIsrvdSocket, TermColor
 | 
						|
 | 
						|
def onJsonLineRecvd(json_dict, instance, current_flow, global_user_data):
 | 
						|
    print(json_dict)
 | 
						|
    return True
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    argparser = nDPIsrvd.defaultArgumentParser()
 | 
						|
    args = argparser.parse_args()
 | 
						|
    address = nDPIsrvd.validateAddress(args)
 | 
						|
 | 
						|
    sys.stderr.write('Recv buffer size: {}\n'.format(nDPIsrvd.NETWORK_BUFFER_MAX_SIZE))
 | 
						|
    sys.stderr.write('Connecting to {} ..\n'.format(address[0]+':'+str(address[1]) if type(address) is tuple else address))
 | 
						|
 | 
						|
    nsock = nDPIsrvdSocket()
 | 
						|
    nsock.connect(address)
 | 
						|
    nsock.loop(onJsonLineRecvd, None, None)
 |