On Saturday, November 5, 2016 at 2:14:55 PM UTC-4, Brad Tucker wrote:
>
> Mwall, Im using tcpdump and a perl script by radar attached below. Could 
> this be a sensor map issue???
>>
>>
>>
brad, before we can determine if it is a sensor_map issue, we need to see 
what is actually getting to the interceptor.

please try the attached combine-lines.pl

use it something like this:

tcpdump -i eth0 src X.X.X.X and port 80 | combine-lines.pl | curl 
http://localhost:9999 -s -d

first do the tcpdump piped to combine-lines to be sure that we're getting 
what we need.  once that works, add the curl to connect it to the 
interceptor.

tcpdump captures the traffic and spits it out in multiple lines, 
combine-lines puts them together and strips off anything that is not cgi 
args, then curl posts those args to the interceptor web server.

m

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#!/usr/bin/perl
# 05nov2016 mwall
# take CGI arguments split over multiple lines and combine into a single
# line of CGI arguments suitable for reposting to a web server

use strict;

my $out = q();
while(my $line=<>) {
    $line =~ s/\s$//g; # punt any trailing whitespace
    if($line =~ /^GET/) {
        # flush any previous line
        flush($out);
        # start a new line
        ($out) = $line =~ /^GET (.*)/;
    } elsif($line eq q() || $line !~ /\S/ || $line =~ /:/) {
        # skip lines such as these:
        # Host: example.com
        # User-Agent: Hub/224
        # Connection: close
        flush($out);
        $out = q()
    } else {
        $out .= $line;
    }
}

exit 0;


sub flush {
    my($line) = @_;
    if($line ne q()) {
        $line =~ s%^.*\?%%; # remove anything before the args
        $line =~ s% HTTP/1.1%%; # remove dangling HTTP if there is one
        print STDOUT "$line\n";
    }
}

Reply via email to