Beispiel #1
0
def Main():
	paramkeyShowUnconnected = "Show unconnected sockets"

	# TODO: At the moment, only uses false default values for boolean parameters,
	# TODO: because CGI and the CGI lib do not send empty strings.
	cgiEnv = lib_common.CgiEnv(
		parameters = { paramkeyShowUnconnected : False }
	)

	flagShowUnconnected = bool(cgiEnv.get_parameters( paramkeyShowUnconnected ))

	grph = cgiEnv.GetGraph()

	for proc in CIM_Process.ProcessIter():
		try:
			if lib_common.is_useless_process(proc):
				continue

			pid = proc.pid

			# TCP sockets only.
			all_connect = CIM_Process.PsutilProcConnections(proc)
			if all_connect:
				node_process = lib_common.gUriGen.PidUri(pid)

				# Trop lourd, ca ne sert a rien, dans la mesure ou les processes
				# ont le meme URI, donc ils DOIVENT etre fusionnes (A verifier).
				# A la limite, ca pourrait etre un attribut.
				# grph.add( ( node_process, pc.property_pid, Literal(pid) ) )

				# Not sure this is the best plmace to add this edge.
				grph.add( ( node_process, pc.property_host, lib_common.nodeMachine ) )
				grph.add( ( node_process, pc.property_pid, lib_common.NodeLiteral(pid) ) )

				# Les deux fonctionnent sous Linux mais verifier sous Windows.
				# Un peu plus lent en asynchrone si peu de sockets;
				# Ou il faudrait un parametre.
				# lib_common.PsutilAddSocketToGraph(node_process,all_connect,grph)
				# lib_common.PsutilAddSocketToGraphAsync(node_process,all_connect,grph,flagShowUnconnected)

				# TODO: MAYBE CREATES ALL THE PROCESSES AND RUN THE THREADS ON THE COMPLETE LIST ???
				survol_addr.PsutilAddSocketToGraphAsync(node_process,all_connect,grph,flagShowUnconnected)

		#except psutil.AccessDenied:
		#	pass
		#except psutil.NoSuchProcess:
		#	pass
		except Exception as exc:
			# This is for psutil.AccessDenied and psutil.NoSuchProcess but we do not want to import the module
			exc_str = str(exc)
			if (exc_str.find("AccessDenied") < 0) and (exc_str.find("NoSuchProcess") < 0):
				lib_common.ErrorMessageHtml("Caught:" + exc_str )
				raise

	cgiEnv.OutCgiRdf("LAYOUT_SPLINE")
Beispiel #2
0
def Main():
    cgiEnv = lib_common.CgiEnv()

    grph = cgiEnv.GetGraph()

    # Not really useful.
    grph.add((lib_common.nodeMachine, pc.property_hostname,
              lib_common.NodeLiteral(lib_util.currentHostname)))

    mapToProc = {}

    for proc in CIM_Process.ProcessIter():

        # TODO: Instead, should test psutil version !!!
        try:
            FunctionProcess(mapToProc, proc)
        except CIM_Process.AccessDenied:
            pass
        except Exception:
            lib_common.ErrorMessageHtml("Unexpected error:" +
                                        str(sys.exc_info()[0]))
    # sys.stderr.write( "Leaving processes enumeration\n" )

    addedProcs = {}

    # Now display only memory maps with more than one process linked to it.
    for mapPath, procLst in lib_util.six_iteritems(mapToProc):
        if len(procLst) <= 0:
            continue

        uriMemMap = lib_common.gUriGen.MemMapUri(mapPath)

        for pid in procLst:
            try:
                nodeProcess = addedProcs[pid]
            except KeyError:
                nodeProcess = lib_common.gUriGen.PidUri(pid)
                addedProcs[pid] = nodeProcess

            grph.add((nodeProcess, pc.property_memmap, uriMemMap))
    # sys.stderr.write( "Leaving second maps enumeration\n" )

    # TODO: They could also be displayed based on the hierarchy of their
    # associated file in the directory tree.

    for pid, nodeProcess in lib_util.six_iteritems(addedProcs):
        grph.add((nodeProcess, pc.property_pid, lib_common.NodeLiteral(pid)))

    # TODO: Petit bug: Ca duplique les memmap. Forcement, l'affichage en tables
    # suppose que c'est un arbre. Mais c'est plus rapide et plus clair.
    # cgiEnv.OutCgiRdf("",[pc.property_memmap])
    cgiEnv.OutCgiRdf("LAYOUT_SPLINE")
Beispiel #3
0
def Main():
    cgiEnv = lib_common.CgiEnv()

    grph = cgiEnv.GetGraph()

    # With a dictionary so node are created once only.
    # This attribute belongs to the function (defintion), and not to the function call.
    # Must be mindful of threading and recursion.

    Main.dict__pid_to_node = {}

    def _pid_to_node(pid):
        try:
            return Main.dict__pid_to_node[pid]
        except KeyError:
            node = lib_common.gUriGen.PidUri(pid)
            Main.dict__pid_to_node[pid] = node
            return node

    # Problem here: There is a second loopkup to get the name of the process.
    # In the mean time, the process might have disappeared.
    # Another problem due to Windows is that a parent process might have exit,
    # although it children processes are not reassigned (As it is the case on Unix).
    # This is a "non-existent process".
    for proc in CIM_Process.ProcessIter():
        if lib_common.is_useless_process(proc):
            continue

        pid = proc.pid
        parent_pid = CIM_Process.PsutilProcToPPid(proc)

        # Built the same way in other RDF documents.
        node_process = _pid_to_node(pid)
        parent_node_process = _pid_to_node(parent_pid)

        # We avoid duplicating the edges. Why would the RDF merge do?
        grph.add((node_process, pc.property_ppid, parent_node_process))
        grph.add((node_process, pc.property_pid, lib_common.NodeLiteral(pid)))
        usr_nam = CIM_Process.PsutilProcToUser(proc, None)
        if usr_nam:
            grph.add((node_process, pc.property_user,
                      lib_common.NodeLiteral(usr_nam)))

        # TODO: Add the username as a property ? Change the color with the username ?
        # TODO: Get icons of users or programs, use their colors ?
        # TODO: Or get the graphic chart of any software related to a resource ?

    cgiEnv.OutCgiRdf()
Beispiel #4
0
def Main():

    cgiEnv = lib_common.CgiEnv()
    hostname = cgiEnv.GetId()

    cgiEnv = lib_common.CgiEnv()

    grph = cgiEnv.GetGraph()

    hostAddr = lib_util.GlobalGetHostByName(hostname)

    hostNode = lib_common.gUriGen.HostnameUri(hostname)

    for proc in CIM_Process.ProcessIter():
        pid = proc.pid

    cgiEnv.OutCgiRdf()
Beispiel #5
0
def DoAll(lstStructs, verbose=True):
    print("Starting")
    if len(sys.argv) > 1:
        maxDisplay = int(sys.argv[2])
    else:
        maxDisplay = 10

    # python -m cProfile mmapregex.py
    if len(sys.argv) > 2:
        pidint = int(sys.argv[1])
        ProcessMemoryScan(pidint, lstStructs, maxDisplay, verbose)
    else:
        for i in CIM_Process.ProcessIter():
            print("Pid=%d name=%s" % (i.pid, i.name()))
            try:
                ProcessMemoryScan(i.pid, lstStructs, maxDisplay, verbose)
                print("")
            except Exception:
                t, e = sys.exc_info()[:2]
                print("    Caught:" + str(e).replace("\n", " "))
                print("")
Beispiel #6
0
def Main():
    paramkeyShowSharedLib = "Show shared libraries"
    paramkeyShowFontFiles = "Show font files"
    paramkeyShowNonShared = "Show non shared files"

    # TODO: At the moment, only uses false default values for boolean parameters,
    # TODO: because CGI and the CGI lib do not send empty strings.
    cgiEnv = lib_common.CgiEnv(
        parameters={
            paramkeyShowSharedLib: False,
            paramkeyShowFontFiles: False,
            paramkeyShowNonShared: False
        })

    flagShowSharedLib = bool(cgiEnv.GetParameters(paramkeyShowSharedLib))
    flagShowFontFiles = bool(cgiEnv.GetParameters(paramkeyShowFontFiles))
    flagShowNonShared = bool(cgiEnv.GetParameters(paramkeyShowNonShared))

    grph = cgiEnv.GetGraph()

    ################################################################################

    Main.dictPathToNod = {}

    AddPidFileLink.dictFiles = {}

    # Maybe this is done in another CGI. What happens when merging ?
    grph.add((lib_common.nodeMachine, pc.property_hostname,
              lib_common.NodeLiteral(lib_util.currentHostname)))

    # https://code.google.com/p/psutil/issues/detail?id=340
    # This might hang.

    for proc in CIM_Process.ProcessIter():
        try:
            if lib_common.UselessProc(proc):
                continue

            pid = proc.pid

            node_process = None

            # http://code.google.com/p/psutil/issues/detail?id=340
            # https://github.com/giampaolo/psutil/issues/340
            for fil in CIM_Process.PsutilProcOpenFiles(proc):

                # Some files are not interesting even if accessed by many processes.
                if lib_common.MeaninglessFile(fil.path, not flagShowSharedLib,
                                              not flagShowFontFiles):
                    continue

                # Adds the process node only if it has at least one open file.
                if node_process == None:
                    node_process = lib_common.gUriGen.PidUri(pid)
                    grph.add((node_process, pc.property_pid,
                              lib_common.NodeLiteral(pid)))

                # TODO: What about files on a shared drive?
                if flagShowNonShared:
                    fileNode = PathToNod(fil.path)
                    grph.add((node_process, pc.property_open_file, fileNode))
                else:
                    # This takes into account only files accessed by several processes.
                    AddPidFileLink(grph, node_process, fil.path)

        # except psutil.AccessDenied:
        #	pass
        except:
            exc = sys.exc_info()[1]
            sys.stderr.write("Exception:%s\n" % str(exc))
            pass

    cgiEnv.OutCgiRdf("LAYOUT_SPLINE")
Beispiel #7
0
def Main():
    cgiEnv = lib_common.CgiEnv()

    # userNameWithHost = cgiEnv.GetId()
    # Usernames have the syntax user@host
    # Example: [email protected]
    # userSplit = userNameWithHost.split('@')
    # userName = userSplit[0]

    userName = cgiEnv.m_entity_id_dict["Name"]

    try:
        # Exception if local machine.
        userHost = cgiEnv.m_entity_id_dict["Domain"]
    except KeyError:
        userHost = lib_util.currentHostname

    if userHost:
        # if userHost != lib_util.currentHostname:
        if not lib_util.IsLocalAddress(userHost):
            # TODO: Should interrogate other host with "finger" protocol.
            # Cannot get user properties on different host:rchateau-HP than rchateau-HP.home
            lib_common.ErrorMessageHtml(
                "Cannot get user properties on different host:%s than %s" %
                (userHost, lib_util.currentHostname))

    grph = cgiEnv.GetGraph()

    # It will be possible to transform this into a Json tree by
    # selecting only the RDF predicate property_ppid.
    # This will be done in a gui cgi script which takes as input
    # parameter a CGI script, visible by SLP, stored in a bookmark page
    # or anything else.

    # See http://stackoverflow.com/questions/17967686/retrieving-specific-rdf-graph-triples-based-on-predicate-nodes
    # on how to select triples on a given predicate only.

    # But in the general case, we cannot know if the RDF graph will be a tree,
    # something similar to a CSV file (That is, flat) or a general graph.

    # So we might have to process the resulting graph on the fly, to see
    # which visualising methods are applicable.

    # Also, in the case of a tree, we must find ourselves what is its root.

    for proc in CIM_Process.ProcessIter():

        procUsername = CIM_Process.PsutilProcToUser(proc)

        # sys.stderr.write("procUsername=%s userName=%s\n" % ( procUsername, userName ) )
        # procUsername=EURO\\UK936025 userName=UK936025
        # procUsername=NT AUTHORITY\\NETWORK SERVICE
        # procUsername=NT AUTHORITY\\SYSTEM
        # procUsername=EURO\\UK936025
        # procUsername=NT AUTHORITY\\SYSTEM
        if procUsername != userName:
            # On Windows, second chance with only the second part of the user.
            try:
                userShort = procUsername.split('\\')[1]
            except IndexError:
                userShort = procUsername
            if userShort != userName:
                continue

        if lib_common.is_useless_process(proc):
            continue

        procName = proc.name

        pid = proc.pid
        parent_pid = CIM_Process.PsutilProcToPPid(proc)

        # Built the same way in other RDF documents.
        node_process = lib_common.gUriGen.PidUri(pid)
        parent_node_process = lib_common.gUriGen.PidUri(parent_pid)

        # We avoid duplicating the edges. Why would the RFD merge do?
        grph.add((node_process, pc.property_ppid, parent_node_process))
        grph.add((node_process, pc.property_pid, lib_common.NodeLiteral(pid)))
        # grph.add( ( node_process, pc.property_information, lib_common.NodeLiteral(procUsername) ) )

    # We avoid duplicating the edges. Why would the RFD merge do?
    ############ grph.add( ( node_process, pc.property_ppid, parent_node_process ) )

    cgiEnv.OutCgiRdf()
Beispiel #8
0
def Main():

    cgiEnv = lib_common.CgiEnv()
    hostname = cgiEnv.GetId()

    cgiEnv = lib_common.CgiEnv()

    grph = cgiEnv.GetGraph()

    hostAddr = lib_util.GlobalGetHostByName(hostname)

    # hostNode = lib_common.gUriGen.HostnameUri(hostAddr)
    # BEWARE: The rule whether we use the host name or the host IP is not very clear !
    # The IP address would be unambiguous but less clear.
    hostNode = lib_common.gUriGen.HostnameUri(hostname)
    # serverBox = lib_common.RemoteBox(hostAddr)

    # Similar code in "enumerate_sockets.py"
    for proc in CIM_Process.ProcessIter():
        try:
            if lib_common.is_useless_process(proc):
                continue

            pid = proc.pid

            # TCP sockets only.
            all_connect = CIM_Process.PsutilProcConnections(proc)

            Main.node_process = None

            def AssociateWithSockets(grph, larray, rarray):
                if Main.node_process == None:
                    Main.node_process = lib_common.gUriGen.PidUri(pid)

                    grph.add((Main.node_process, pc.property_host,
                              lib_common.nodeMachine))
                    grph.add((Main.node_process, pc.property_pid,
                              lib_common.NodeLiteral(pid)))

                lsocketNode = lib_common.gUriGen.AddrUri(larray[0], larray[1])
                grph.add((lsocketNode, pc.property_information,
                          lib_common.NodeLiteral(cnt.status)))
                rsocketNode = lib_common.gUriGen.AddrUri(rarray[0], rarray[1])
                grph.add((lsocketNode, pc.property_information,
                          lib_common.NodeLiteral(cnt.status)))
                grph.add((lsocketNode, pc.property_socket_end, rsocketNode))

                grph.add(
                    (Main.node_process, pc.property_has_socket, rsocketNode))
                grph.add((hostNode, pc.property_has_socket, lsocketNode))

            for cnt in all_connect:
                if ((cnt.family == socket.AF_INET)
                        and (cnt.type == socket.SOCK_STREAM)
                        and (cnt.status == 'ESTABLISHED')):
                    (larray, rarray) = survol_addr.SocketToPair(cnt)

                    if hostAddr == larray[0]:
                        AssociateWithSockets(grph, larray, rarray)
                    elif hostAddr == rarray[0]:
                        AssociateWithSockets(grph, rarray, larray)

        except:
            pass

    cgiEnv.OutCgiRdf("LAYOUT_SPLINE")
Beispiel #9
0
def Main():
    cgiEnv = lib_common.CgiEnv()

    grph = cgiEnv.GetGraph()

    # With a dictionary so node are created once only.
    # This attribute belongs to the function (defintion), and not to the function call.
    # Must be mindful of threading and recursion.

    Main.dictPidToNode = {}

    def PidToNode(pid):
        global dictPidToNode
        try:
            return Main.dictPidToNode[pid]
        except KeyError:
            node = lib_common.gUriGen.PidUri(pid)
            Main.dictPidToNode[pid] = node
            return node

    # Problem here: There is a second loopkup to get the name of the process.
    # In the mean time, the process might have disappeared.
    # Another problem due to Windows is that a parent process might have exit,
    # although it children processes are not reassigned (As it is the case on Unix).
    # This is a "non-existent process".
    for proc in CIM_Process.ProcessIter():
        if lib_common.UselessProc(proc):
            continue

        # proc=['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__modu
        # le__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '
        # __weakref__', '_create_time', '_exe', '_gone', '_hash', '_ident', '_init', '_last_proc_cpu_times', '_last_sys_cpu_times', '_name', '
        # _pid', '_ppid', '_proc', 'as_dict', 'children', 'cmdline', 'connections', 'cpu_affinity', 'cpu_percent', 'cpu_times', 'create_time',
        #  'cwd', 'exe', 'io_counters', 'ionice', 'is_running', 'kill', 'memory_info', 'memory_info_ex', 'memory_maps', 'memory_percent', 'nam
        # e', 'nice', 'num_ctx_switches', 'num_handles', 'num_threads', 'open_files', 'parent', 'pid', 'ppid', 'resume', 'send_signal', 'statu
        # s', 'suspend', 'terminate', 'threads', 'username', 'wait']'
        # sys.stderr.write("proc=%s\n"%str(dir(proc)))

        procName = CIM_Process.PsutilProcToName(proc)

        pid = proc.pid
        parent_pid = CIM_Process.PsutilProcToPPid(proc)

        # Built the same way in other RDF documents.
        node_process = PidToNode(pid)
        parent_node_process = PidToNode(parent_pid)

        # We avoid duplicating the edges. Why would the RDF merge do?
        grph.add((node_process, pc.property_ppid, parent_node_process))
        grph.add((node_process, pc.property_pid, lib_common.NodeLiteral(pid)))
        usrNam = CIM_Process.PsutilProcToUser(proc, None)
        if usrNam:
            grph.add((node_process, pc.property_user,
                      lib_common.NodeLiteral(usrNam)))

        # TODO: Add the username as a property ? Change the color with the username ?
        # Pour les couleurs, on pourrait imaginer d'aller chercher les icones des utilisateurs
        # ou des programmes et d'en prendre la couleur dominante ?
        # Ou bien, si un objet est associe a un de nos packages, en prendre les attributs graphiques:
        # Si c'est un process oracle, on prend les couleurs de notre package Oracle etc...

        # procUsername = lib_common.PsutilProcToUser(proc)
        # grph.add( ( node_process, pc.property_user, lib_common.NodeLiteral(procUsername) ) )

    cgiEnv.OutCgiRdf()
Beispiel #10
0
def DisplayMappedProcesses(grph, fileName):
    grph.add((lib_common.nodeMachine, pc.property_hostname,
              lib_common.NodeLiteral(lib_util.currentHostname)))

    # This is also a file mapped into memory.
    uriMappedFile = lib_common.gUriGen.FileUri(fileName)

    uriMemMap = None

    try:
        statinfo = os.stat(fileName)
    except Exception:
        exc = sys.exc_info()[1]
        grph.add((uriMappedFile, lib_common.MakeProp("Error"),
                  lib_common.NodeLiteral(str(exc))))
        return

    fileSize = lib_util.AddSIUnit(statinfo.st_size, "B")
    grph.add((uriMappedFile, pc.property_file_size,
              lib_common.NodeLiteral(fileSize)))

    propMemoryRSS = lib_common.MakeProp("Resident Set Size")
    for proc in CIM_Process.ProcessIter():

        if lib_common.is_useless_process(proc):
            continue

        pid = proc.pid

        try:
            all_maps = CIM_Process.PsutilProcMemmaps(proc)
        except:
            # Probably psutil.AccessDenied
            exc = sys.exc_info()[1]
            # sys.stderr.write("get_memory_maps Pid=%d. Caught %s\n" % (pid,str(exc)) )
            continue

        # sys.stderr.write("get_memory_maps OK Pid=%d:%s.\n" % (pid,str(all_maps)) )

        for map in all_maps:
            # This, because all Windows paths are "standardized" by us.
            cleanMapPath = lib_util.standardized_file_path(map.path)

            # MapPath=C:\Windows\System32\KernelBase.dll fileName=c:\windows\system32\API-MS-WIN-CORE-LOCALIZATION-L1-1-0.DLL
            # sys.stderr.write("Pid=%d MapPath=%s cleanMapPath=%s fileName=%s\n" % (pid,map.path,cleanMapPath,fileName))

            sameFil = lib_util.standardized_file_path(
                map.path) == lib_util.standardized_file_path(fileName)

            if sameFil:
                DEBUG("Pid=%d MapPath=%s cleanMapPath=%s fileName=%s", pid,
                      map.path, cleanMapPath, fileName)
                # Maybe this is the first mapping we have found.
                if uriMemMap == None:
                    uriMemMap = lib_common.gUriGen.MemMapUri(fileName)
                    grph.add((uriMappedFile, pc.property_mapped, uriMemMap))
                nodeProcess = lib_common.gUriGen.PidUri(pid)
                # The property is reversed because of display.
                grph.add((uriMemMap, pc.property_memmap, nodeProcess))
                grph.add((nodeProcess, pc.property_pid,
                          lib_common.NodeLiteral(pid)))

                # Displays the RSS only if different from the file size.
                if map.rss != statinfo.st_size:
                    grph.add((nodeProcess, propMemoryRSS,
                              lib_common.NodeLiteral(map.rss)))
def Main():
    cgiEnv = lib_common.CgiEnv()
    socketNam = cgiEnv.GetId()

    grph = cgiEnv.GetGraph()

    # See AddrUri() to understand the syntax of a socket name.
    socketSplit = socketNam.split(':')
    socketName = socketSplit[0]

    socketAddr = lib_util.GlobalGetHostByName(socketName)

    allIpAddrs = [
        i[4][0] for i in socket.getaddrinfo(socket.gethostname(), None)
    ]

    # If the address is one of our IP addresses, replace it.
    if socketAddr in allIpAddrs:
        socketAddr = "127.0.0.1"

    # TODO: If the input address is not "127.0.0.1", there is NO POINT doing this !!

    # Maybe the port is given as a string, "ssh" or "telnet".
    # See usage of socket.getservbyport
    socketPortString = socketSplit[1]
    try:
        socketPort = int(socketPortString)
    except ValueError:
        socketPort = socket.getservbyname(socketPortString)

    sys.stderr.write("socketName=%s socketAddr=%s socketPort=%d\n" %
                     (socketName, socketAddr, socketPort))

    # TBH, I do not understand why a local address is sometimes displayed as "192.168.1.83",
    # "127.0.0.1", "0.0.0.0" etc...
    # l[0]=    192.168.1.83 l[1]= 5353 NO END
    # l[0]=             ::1 l[1]= 5353 NO END
    # l[0]=         0.0.0.0 l[1]=59135 NO END
    # l[0]=              :: l[1]=59136 NO END
    # l[0]=    192.168.56.1 l[1]= 5353 NO END
    # l[0]=       127.0.0.1 l[1]= 5354 NO END
    # l[0]=         0.0.0.0 l[1]= 1433 NO END
    # l[0]=              :: l[1]= 1433 NO END
    def IsGoodSocket(xarray):
        try:
            # Compares the port number first because this is faster.
            if xarray[1] != socketPort:
                return False

            # Beware: We may have socketName='192.168.1.83', socketAddr='127.0.0.1'
            # but the list of socket will display '192.168.1.83', at least on Windows.
            addr = xarray[0]

            if addr == socketAddr or addr == socketName:
                return True

            # "::1" is equivalent to 127.0.0.1 for IPV6.
            if addr == "0.0.0.0" or addr == "::" or addr == "::1":
                return socketAddr == "127.0.0.1"
        except IndexError:
            pass

        return False

    for proc in CIM_Process.ProcessIter():
        node_process = None

        # All sockets connected to this process.
        # all_connect = proc.get_connections('all')
        # all_connect = proc.get_connections()
        all_connect = CIM_Process.PsutilProcConnections(proc, 'all')

        for cnt in all_connect:
            (larray, rarray) = survol_addr.SocketToPair(cnt)

            try:
                sys.stderr.write("l[0]=%16s l[1]=%5d r[0]=%16s r[1]=%5d\n" %
                                 (larray[0], larray[1], rarray[0], rarray[1]))
            except IndexError:
                sys.stderr.write("l[0]=%16s l[1]=%5d NO END\n" %
                                 (larray[0], larray[1]))

            isTheSock = IsGoodSocket(larray) or IsGoodSocket(rarray)

            if isTheSock:
                # Creates the process only if not done before.
                if node_process == None:
                    pid = proc.pid
                    node_process = lib_common.gUriGen.PidUri(pid)

                    # PAS BON: CAR PEUT_ETRE LE PROCESS PARENT EST DANS LA LISTE DES PROCESSES QU ON AJOUTE,
                    # DONC C EST PAS CLAIR. FAUT VERIFIER LA RELATION DE PARENTE.
                    grph.add((node_process, pc.property_host,
                              lib_common.nodeMachine))
                    grph.add((node_process, pc.property_pid,
                              lib_common.NodeLiteral(pid)))

                # No need to be asynchronous because this is always the same socket.
                survol_addr.PsutilAddSocketToGraphOne(node_process, cnt, grph)

    cgiEnv.OutCgiRdf()