Geo location and the raspberry pie as webserver

Geo location and the raspberry pie as webserver

As mentioned I coded a new version of ip_to_country.

length 4071407 bytes. wget

formatting link

Use tar -zxf ip_to_country-0.4.tgz to unpack it, see README file for compile and install instructions.

When the original /var/log/apache2/access.log looks like

103.211.106.194 - - [26/Jun/2018:16:04:09 +0000] "GET / HTTP/1.1" 200 3205 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"

then using ip_to_country -t /var/log/apache2/access.log -f 2

shows

103.211.106.194 "IN" India - - [26/Jun/2018:16:04:09 +0000] "GET / HTTP/1.1" 200 3205 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"

You can just leave it running that way, and it will start showing the log plus country info starting at the last log line before the moment you started it.

Or use ip_to_country -i 103.211.106.194

103.211.106.194 "IN" India

Many other ways exist to use it from a script of course.

No support for IPV6 as I cannot test that.

It finds, in its > 500,000 entries database, the correct entry in about 18 steps using successive approximation, so even on a fully loaded pi it seems timeless and uses no detectable processor cycles when run.

For those C coders maybe worth a peek howitsdone :-)

Experimental of course, released under the GPL.

Reply to
Jan Panteltje
Loading thread data ...

On a sunny day (Tue, 26 Jun 2018 17:11:04 GMT) it happened Jan Panteltje wrote in :

New version available:

formatting link
more features, you can specify words that signal bad entries, an alarm beep that sounds if your raspi is connected to some amplifier and speaker, and it can also tell you what is going on in English if you installed festival voice syntesizer. On top of that in can execute any shell commands upon detection of a bad guy: ip_to_country -t /var/log/apache2/access.log -f 2 -a "phpMyAdmin 404 cgi" -b "" -e "echo intruder | festival --tts

Now for the Forz guys to code it here...

And the executable is still less than 16 kB in size rwxr-xr-x 1 root root 15472 Jun 30 15:11 ip_to_country

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.