Tcp socket via nc?

I got this fifo def working from looking through the source code:

def do_it():
    var fifo_path = "/tmp/mmm_audio_pipe"
    
    remove(fifo_path)
    _ = run("mkfifo " + fifo_path + " 2>/dev/null")

    # Continuous reading loop
    while True:
        try:
            with open(fifo_path, "r") as f:
                var content = f.read()
                if content:
                    var parts = content.split(",")
                    for part in parts:
                        print(part)
        except:
            print("Error reading, retrying...")
            sleep(0.1)

I’d like to do the same but with netcat. When I do:

_ = run("(nc -lk 9999 2>/dev/null)")

in the same place, I know is receiving the message, because the python tcp writer doesn’t throw an error that no one is listening. I just have no idea how to get the message from netcat.

Is there any example code that does this that I could look at? Or any pointers to help me out?

Thanks,

Sam

Classic Cyber security Spluta.

According to my self taught & long term cyber security and networking I can see is not a hardware misconfiguration—it’s a logical plumbing error in the code. The network card is likely doing exactly what it was told: listening for packets on port 9999.
If you are on Kali Linux or Parrot OS here is the breakdown that I found :smiling_face_with_sunglasses: dude as I’m trying to understand it… You are probably trying to inject the mojo script through First in first out to the NIC

  • ​The NIC (Network Interface Card): It’s successfully receiving the Packets and passing them to the Kali/Parrot Linux Kernel.
  • ​Netcat : It is successfully grabbing those packets from the kernel.
  • ​The Error: Because you didn’t use a redirection operator (like >), the data stops at the netcat process. It never enters the FIFO pipe where the Mojo script is waiting.

I think this is the best answer I can give you..

You are stuck because you are running nc -lk 9999 but not redirecting it into the pipe.
To make it work, the command should look something like:
nc -lk 9999 > /tmp/mmm_audio_pipe
Without that > redirection, the data just sits in the netcat process and never enters the “tunnel” where Mojo is waiting.
I tried it I think it works on my machine… Dude you can try it too if their is any unexpected behavior we are born to look into it.

1 Like

Thanks. Looks like a fifo might be the correct vibe if I need to use it anyway.

All thanks are welcomed and appreciated… Concerning that did the MMM audio pipe work? Superb