itomato 5 hours ago

This seems like it belonged on freshmeat ca. Y2K.

  • MarcelOlsz an hour ago

    What's that? Webarchive/google don't return much of anything.

    • 28304283409234 an hour ago

      http://freshmeat.net was a directory of open source software back in the 90's and noughts. It was one of the main ways to discover software.

      But what is X11? Is that like Wayland? ;-)

  • djabatt 2 hours ago

    must have at least once

hamburglar 3 hours ago

This is some old school style bare bones C. popen with a big old pipe chain is pretty quick n dirty. I’d have gone digging around in proc for the active connections. Cool stuff though. I like that it’s so straightforward to read.

  • quotemstr 4 minutes ago

    > This is some old school style bare bones C.

    Which has now become some kind of meta-ironic fashion statement. It's 2025's going to the coffee shop with a typewriter.

rootbear 6 hours ago

Forgive my ignorance, but I'm not sure what this is showing me. I'm running it on my home linux system, which is connected to the Internet via Verizon FIOS. The map shows three red dots, none of which are near me.

  • h2337 6 hours ago

    Those 3 dots are your peers, the other end of the TCP connection :)

    So you basically have some apps running in the background (or foreground) that are making those connections.

    • afroturf an hour ago

      I'm colorblind and had to change the dots color. Might be a nice config option.

    • positron26 6 hours ago

      Maybe they were expecting first hops like from traceroute. Maybe traceroute is an interesting way to continue developing.

    • rootbear 6 hours ago

      Okay, got it, thanks. I suppose it could also be the FIOS router itself making those connections, or any of the other systems on my local network.

      • jdwithit 2 hours ago

        It's only showing connections directly initiated by your computer. Not anything "upstream" of you like the FIOS router. It would also show any connections TO your computer, but being behind NAT on a normal home network, that would likely be nothing unless you've intentionally punched holes.

      • h2337 6 hours ago

        No, for normal network configurations they wouldn't show. It's most likely your system connmap is running on making those connections.

      • esseph 3 hours ago

        You might be surprised how much traffic every device makes.

raldi 2 hours ago

What's a network peer?

  • jdwithit 2 hours ago

    Yeah from an extremely quick read of the code, I agree with atworkc. It's showing any IP address you have an established network connection to.

      void refreshConnections() {
        ssOutput =
            popen("ss -atun4 | grep ESTAB | awk '{print $6}' | cut -f1 -d\":\"", "r");
    
        if (ssOutput == NULL) {
          printf("Failed to run ss command\n");
          exit(1);
        }
      }
    
    edit: ssOutput is a global variable which is read elsewhere.
  • atworkc 2 hours ago

    Servers / Computers your device is currently communicating with, e.g. github servers when you load the link (well probably a cdn edge one)

GranPC 6 hours ago

Pretty cool! Reminds me of the game Uplink.

  • apollo-zero 4 hours ago

    Uplink! I loved that game. I should find it again.

freeone3000 5 hours ago

make sure interNIC is your first hop! LogDeleter is not optional <3

generalizations 2 hours ago

Of course this was made by an i3wm user. Nicely done!

rxwxx 2 hours ago

In the fonction IpRangeVector_resize() in ip.c, you have a bug, that's not how realloc are supposed to be used.

lxgr 5 hours ago

Neat! This runs fully offline (i.e. without calls to a GeoIP database), right?

  • serbuvlad 5 hours ago

    From what I was able to tell looking at the code, yes.

    The database is embedded in the program. Specifically, it is this file:

    https://github.com/h2337/connmap/blob/master/connmap/resourc...

    Presumably generated by the author with this Python script

    https://github.com/h2337/connmap/blob/master/tools/get-ip-da...

    • lxgr 5 hours ago

      Ah, cool, this should incorporate location data at least as good as what the networks self-report! (I suspect that these databases, on top of ingesting all geofeed data, do something similar to Wi-Fi positioning, i.e. correlate the IP address of various GPS-enabled devices with their physical location to try and deduce undocumented/non-public allocation patterns.)

  • DonHopkins 5 hours ago

    Of course it works fully offline, since then you don't have any network peers to draw on the map.

    • lxgr 5 hours ago

      Localhost has to be somewhere too :)

ben0x539 7 hours ago

That's a really neat idea, damn.

anthk 2 hours ago

OpenBSD devs did the same with either XPlanet or Xearth, can't rememeber. Now they use a GeoJson format.

Then you can import it under geo/viking port:

     doas pkg_add viking
Open Viking and just load the geo.json file from

        /usr/local/share/markers/OpenBSD.geojson
wslh 7 hours ago

No basically secure:

char mapFilename[256]; strcat(strcpy(mapFilename, getenv("HOME")), RESOURCES); strcat(mapFilename, mapName);

  • josephcsible 6 hours ago

    While that's indeed a bug, for it to be a security vulnerability, wouldn't there also have to be a security boundary involved? Specifically, mapName is always either "w1000b.png" or "w1000.png", so the only way to trigger the buffer overflow would be through the HOME environment variable. But if an attacker can run commands as you with arbitrary environment variables, aren't you already pwned? What would anyone gain by running your program and exploiting it to do something, rather than just doing the thing directly? https://devblogs.microsoft.com/oldnewthing/20060508-22/?p=31...

    • im3w1l 5 hours ago

      While exploitation is unlikely I think such things are still best avoided because multiple such things can sometimes be chained together.

  • h2337 7 hours ago

    What's insecure? Can you explain what's the vulnerability here and how and by whom can it be exploited?

    • floating-io 6 hours ago

      Assuming that code is actually present in your app, env vars can hold more than 255 characters. Easy buffer overflow to trigger. Use length-bounded copies and concats...

      That's just off the top of my head; I've not written in C in a while.

      • h2337 6 hours ago

        Why would you want to trigger a buffer overflow in user application if you can already control HOME envvar?

        • floating-io 6 hours ago

          Yeah, that is not a helpful attitude to take when it comes to this sort of thing. If nothing else, a super-long home path can crash your app and leave your user scratching their head. In other words, this is a bug (as is the fact that paths are not necessarily limited to 255 characters in the first place; see the PATH_MAX constant, I think it is?).

          As to what could be accomplished with an overflow? I don't know; I'm not in security, and I don't sit around thinking of possible uses for various bugs when it comes to compromising systems.

          Perhaps the most important thing to realize, though, is that you're distributing software publicly. Your security situation may not be the same as your user's security situation. Assumptions should not be made.

          Something to keep in mind.

          • h2337 6 hours ago

            Thanks for the discussion. Fix is already committed.

            • db48x 3 hours ago

              As long as you’re fixing that bug, you should do it right. If the return value from snprintf if more than 256 but less than a few GB then you should malloc a buffer big enough to hold the string and then call snprintf again with the new buffer. Only if that or malloc fails would you print an error. (It’s really a shame that the C standard library requires so many extra steps to do things correctly; this ought to be way easier.)

    • sedatk 6 hours ago

      Basically, any path longer than 256 characters for `mapFilename` would cause a buffer overrun.

      An unprivileged app could run your app (say, with more privileges), with a very long `HOME` environment path, causing a buffer overflow, and potentially exploit it to use your app's privileges to do more stuff than it was supposed to.

      Basically, you should never use strcpy and strcat and but use the secure alternatives like strcpy_s and strcat_s, even when you know the source buffer would never exceed the destination size.

      • h2337 6 hours ago

        > (say, with more privileges)

        Isn't it a moot point if unprivileged app can already run anything with more privileges? In normal operation, connmap requires no special privileges.

        • sedatk 6 hours ago

          Sure, but since there's no enforced standard for how privileges are configured on a system, there's always the possibility that your app to be the only escape ticket.

          You can dismiss that possibility of course. But, as a general habit, it's best to use secure alternatives instead of mulling over probabilities every other line.

          As a positive side-effect, the change would make your app not crash on systems with long HOME env paths.:)

    • DonHopkins 5 hours ago

      Using strcat to a fixed size buffer is like using a gun to kill flies in a crowded flophouse while on crystal meth.

  • h2337 6 hours ago

    Thanks for noticing! Fix pushed.