Skip to content

[Enhancement]: Improve agent API response when returning active connections #140

Closed

Description

@LorenzoTettamanti

Is your feature request related to a problem?

  • Yes

Problem Description:

The api response for the active connections endpoint returns this type of output:

[SYSTEM] Founded config files
[SYSTEM] Readed configs for env variable: "Kubernetes"
=====> Connecting to cortexflow Client
=====> Connected to CortexFlow Client
{"\"35655\"": "\"143.171.168.192\"", "\"48872\"": "\"133.171.168.192\"", "\"35623\"": "\"148.171.168.192\"", "\"48807\"": "\"173.171.168.192\"", "\"60011\"": "\"136.171.168.192\"", "\"48551\"": "\"163.171.168.192\"", "\"48582\"": "\"129.171.168.192\"", "\"48580\"": "\"133.171.168.192\"", "\"100228\"": "\"147.171.168.192\"", "\"46616\"": "\"133.171.168.192\"", "\"36079\"": "\"136.171.168.192\"", "\"36077\"": "\"136.171.168.192\"", "\"43845\"": "\"131.171.168.192\"", "\"35619\"": "\"136.171.168.192\"", "\"45042\"": "\"135.171.168.192\"", "\"42669\"": "\"148.171.168.192\"", "\"49747\"": "\"143.171.168.192\"", "\"45305\"": "\"147.171.168.192\"", "\"45280\"": "\"147.171.168.192\"", "0": "0", "\"45281\"": "\"147.171.168.192\"", "\"36682\"": "\"136.171.168.192\"", "\"35631\"": "\"148.171.168.192\"", "\"42722\"": "\"148.171.168.192\"", "\"44074\"": "\"136.171.168.192\"", "\"45\"": "\"133.171.168.192\"", "\"44335\"": "\"136.171.168.192\"", "\"35625\"": "\"148.171.168.192\"", "\"32\"": "\"156.171.168.192\"", "\"36073\"": "\"135.171.168.192\"", "\"49748\"": "\"143.171.168.192\"", "\"45282\"": "\"147.171.168.192\"", "\"49380\"": "\"129.171.168.192\"", "\"35620\"": "\"148.171.168.192\"", "\"90399\"": "\"158.171.168.192\"", "\"49077\"": "\"143.171.168.192\"", "\"45312\"": "\"147.171.168.192\"", "\"49383\"": "\"133.171.168.192\"", "\"48581\"": "\"133.171.168.192\"", "\"48809\"": "\"173.171.168.192\"", "\"49379\"": "\"156.171.168.192\"", "\"0\"": "\"173.171.168.192\"", "\"42725\"": "\"148.171.168.192\"", "\"42721\"": "\"148.171.168.192\"", "\"44075\"": "\"136.171.168.192\"", "\"41299\"": "\"135.171.168.192\"", "\"16\"": "\"143.171.168.192\"", "\"44071\"": "\"136.171.168.192\"", "\"42720\"": "\"148.171.168.192\""}

The first number is associated with the event ID, while the second number represents the scanned IP.
This is the current schema:

    {
        "event_id":,
        "src_ip":
    }

This type of output is visually messy and doesn't give enough information to the user.

Solution:

The response can be improved by refactoring the output as follows:

{
  "event_id":,
  "src_ip/src_port":,
  "dst_ip/src_port":,
}

Additional info:

API proto file: agent.proto
API implementation: api.rs

Activity

  1. added
    enhancementNew feature or request
    rustPull requests that update Rust code
    ebpfeBPF related tasks
    on Sep 5, 2025
  2. added a commit that references this issue on Oct 12, 2025
  3. siddh34 commented on Oct 12, 2025

    @siddh34
    Collaborator

    @LorenzoTettamanti got it working mate, let me know about the format

    Image Image
  4. added 4 commits that reference this issue on Oct 12, 2025
  5. added a commit that references this issue on Oct 13, 2025
  6. LorenzoTettamanti commented on Oct 13, 2025

    @LorenzoTettamanti
    MemberAuthor

    Image

    @siddh34 Hey mate, everything is working! Unfortunately i can't replicate this exact result. Do you also have updated the CLI right?

  7. siddh34 commented on Oct 13, 2025

    @siddh34
    Collaborator

    @LorenzoTettamanti Yes mate! unfortunately I can't see your image

    Image

    although I had to a little kubectl port forward for it

    kubectl port-forward -n cortexflow svc/cortexflow-agent 9090:9090
  8. LorenzoTettamanti commented on Oct 13, 2025

    @LorenzoTettamanti
    MemberAuthor

    @siddh34 Can you raise a PR to match the agent API response format? It would be great if you could format the CLI response like the one I can see in your 2nd image :)

    Today, I merged your updates with mine in the ebpf_core branch. I've also tagged the Docker image with the "0.1.1.beta.x" tag.

    Docker images:
    agent: https://hub.docker.com/r/lorenzotettamanti/cortexflow-agent
    identity: https://hub.docker.com/r/lorenzotettamanti/cortexflow-identity

    issue #105 update:
    I'm working on a PR to fix a couple of bugs in the policy command. I'm ensuring that the blocklist works properly. Up to now, if you sync the repo you will see that the addresses are exposed in the right order (previously: 1.1.168.192 (reversed order) ----> now: 192.168.1.1). You will also see that the policy command is available, but right now you can't really block anything (the PR will come at the end of the week)

    unfortunately I can't see your image
    Don't worry, I was trying to include your second image in my reply 😆

  9. LorenzoTettamanti commented on Oct 13, 2025

    @LorenzoTettamanti
    MemberAuthor

    @siddh34 P.S. if you need to run some quick tests now you can use the docker images with the beta tag linked above

  10. siddh34 commented on Oct 20, 2025

    @siddh34
    Collaborator

    @LorenzoTettamanti sorry for late reply mate but I am not able to find the structure which I used

    Image

    on my side, which I updated a long time ago

    Image

    I will still update the cli, via local try to push changes that doesn't break release cycle

  11. added a commit that references this issue on Oct 20, 2025
  12. LorenzoTettamanti commented on Oct 20, 2025

    @LorenzoTettamanti
    MemberAuthor

    @siddh34 Thanks for reporting this issue. I haven't pushed any new beta version on crates.io so this is why you are seeing the old outdated code.

    This is the latest version of the agent.proto file https://github.com/CortexFlow/CortexBrain/blob/feature%2Febpf-core/core%2Fapi%2Fprotos%2Fagent.proto

    Let me know you if you still have any divergences!

    Tomorrow i'll merge all the opened PR and i'll push the 0.1.1-beta.1 release on crates.io.

    Probably you might find it easier working with the local crates instead of using the uploaded one on crates.io. i'll suggest you to use the tagged versions (e.g. 0.1.0, 0.1.1-beta.0) as a backup because the only reason why i've started uploading the identity and agent crates is because you can't upload the CLI with local dependencies. If you need to write new features or update existing ones you can use the local path for the module that you need, just make sure that you local branch is synced with the root

  13. added a commit that references this issue on Oct 21, 2025
  14. siddh34 commented on Oct 21, 2025

    @siddh34
    Collaborator

    @LorenzoTettamanti cool, let me know if anything left in this issue or we can close this one!

  15. added a commit that references this issue on Oct 21, 2025
  16. added a commit that references this issue on Oct 21, 2025
  17. moved this from In Progress to Done in CortexFlow v0.1on Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ebpfeBPF related tasksenhancementNew feature or requestrustPull requests that update Rust code

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions