netsed: Does for the ‘net what sed does for …

I can see the usefulness of netsed, and I can get it running, but I can’t seem to arrange it in a way that would be suitable for a screenshot. Hence …

2014-02-04-lv-r1fz6-netsed

Sorry, that’s all you get. 😦

netsed should do the same thing as sed, and swap out strings of characters as they pass — this time, through network connections.

Perhaps I had my hopes up, but I was expecting to be able to substitute every occurrence of the word “program” on this site with “cheeseburger.” A weak attempt at comedy. 🙄

It appears to be working though, and a new version was released a few months ago. So short of the fact that, once again, I can’t seem to get the program to perform, I have no reason to doubt this is a useful gadget.

See, this would have been so much funnier if the word “cheeseburger” kept appearing … 😕

3 thoughts on “netsed: Does for the ‘net what sed does for …

  1. chris-l

    Actually, I think you are doing it a bit wrong. The program requires that you provide a listening port, a host, and a destination port on the host.
    Those last two can actually be set as ‘0’ to represent the original destination.
    If it requires a listening port, it seems that it requires some redirection.

    I have one machine that I use as router, so there I used iptables like this:
    iptables -t nat -A PREROUTING -p tcp –destination-port 80 -j REDIRECT –to-port 10000
    All packages destined to port 80, no matter the host, will be redirected to the local port 10000 (the local port of the router machine, that is)

    And then I used, again on the router:
    netsed tcp 10000 0 0 ‘s/Linux/Win98’ ‘s/linux/win98’
    So now on the machines connected to the router, I see win98 instead of linux on every page… or at least that’s what I would like to say.

    The truth is, I get ALMOST that result; you see, for some reason that I haven’t figured out yet, using chrome and other browsers, websites still show “linux”.

    However, using elinks, I correctly see “win98” instead.

    (oh and by the way, it works on every package, including the ones with the HTTP headers. So if you try to do s/inconsolation/cheeseburger you’ll end up in cheeseburger.wordpress.com)

    1. chris-l

      The reason is not the cache, btw; I already tried to delete it.

      Also, trying to use the regex [Ll]inux failed to me, that is the reason I’m using two rules.

  2. Pingback: ngrep: Does for the ‘net what grep does for … | Inconsolation

Comments are closed.