. // // Alexey A.Znayev, znaeff@mail.ru, http://xbsoft.org, http://xbsoft.ru // /////////////////////////////////////////////////////////////////////////// // This file contains public class DNSBL // This class performs IP address check in spam blocking lists as described // on http://ru.wikipedia.org/wiki/RBL class DNSBL { private $_aCheckers = array( // list of checkers available for individual checking 'spamhaus' => array('.zen.spamhaus.org', true), //available for group checking with 'all' key 'spamcop' => array('.bl.spamcop.net', true), //available for group checking with 'all' key 'dsbl' => array('.list.dsbl.org', false), //not available for group checking with 'all' key 'ordb' => array('.relays.ordb.org', false), //not available for group checking with 'all' key 'sorbs' => array('.dnsbl.sorbs.net', false), //not available for group checking with 'all' key 'njabl' => array('.dnsbl.njabl.org', false) //not available for group checking with 'all' key ); // AZ - 1. Key 'all' is illegal // AZ - 2. Most of spammer IP addresses is covered by 'spamhaus' & 'spamcop' (and they are fast), // some of the rest may not work sometimes, you can make them group checking available after individual testing private $_sDefaultChecker = 'spamhaus'; /////////////////////////////////////////////////////////////////////////// // CheckSpamIP - check IP for spam in checkers : given, default or all available for group checking (may be slow) // parameters: // string $ip - ip address // string $checker - checker name or 'all' or nothing // returns: // true when IP exitsts in spam-lists of $checker or at least one of all checkers // false when not or when ip address is local or not correct public function CheckSpamIP($ip, $checker = ''){ if(empty($ip)) return false; if(preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $ip) != 1) return false; $octets = explode('.', $ip); if($octets[0] == '127') return false; if($octets[0] == '10') return false; if($octets[0] == '192' && $octets[0] == '168') return false; if($octets[0] == '169' && $octets[0] == '254') return false; // ms windows if((int)$octets[0] > 255 || (int)$octets[1] > 255 || (int)$octets[2] > 255 || (int)$octets[3] > 255 ) return false; $ret_val = false; $PTR = implode(array_reverse($octets), '.'); if($checker === 'all'){ foreach(array_values($this->_aCheckers) as $c){ if($c[1]){ $ret_val = $ret_val || $this->_CheckDNSAnswer(dns_get_record($PTR . $c[0], DNS_A)); } if($ret_val) break; } }else if(array_key_exists($checker, $this->_aCheckers)){ $ret_val = $this->_CheckDNSAnswer(dns_get_record($PTR . $this->_aCheckers[$checker][0], DNS_A)); }else{ $ret_val = $this->_CheckDNSAnswer(dns_get_record($PTR . $this->_aCheckers[$this->_sDefaultChecker][0], DNS_A)); } return $ret_val; } /////////////////////////////////////////////////////////////////////////// // GetCheckers - gets list of available checker names // returns: // array of strings public function GetCheckers(){ return array_keys($this->_aCheckers); } /////////////////////////////////////////////////////////////////////////// // GetGroupCheckers - gets list of checker names available for group checking with 'all' key // returns: // array of strings public function GetGroupCheckers(){ $ret_val = array(); foreach(array_keys($this->_aCheckers) as $k) if($this->_aCheckers[$k][1]) array_push($ret_val, $k); return $ret_val; } /////////////////////////////////////////////////////////////////////////// // GetDefaultChecker - gets default checker name // returns: // string public function GetDefaultChecker(){ return $this->_sDefaultChecker; } /////////////////////////////////////////////////////////////////////////// // SetDefaultChecker - sets default checker name // parameters: // string $new_checker - new default checker name // returns: // true when success // false when failed ($new_checker is not in the list of available checker names) public function SetDefaultChecker($new_checker){ if(array_key_exists($new_checker, $this->_aCheckers)){ $this->_sDefaultChecker = $new_checker; return true; }else{ return false; } } /////////////////////////////////////////////////////////////////////////// // EnableGroupChecking - sets checker available for group checking // parameters: // string $checker - checker name // returns: // true when success ($checker is included) // false when failed ($checker is not in the list of available checker names) public function EnableGroupChecking($checker){ if(array_key_exists($checker, $this->_aCheckers)){ $this->_aCheckers[$checker][1] = true; return true; }else{ return false; } } /////////////////////////////////////////////////////////////////////////// // DisableGroupChecking - sets checker not available for group checking // parameters: // string $checker - checker name // returns: // true when success ($checker is excluded) // false when failed ($checker is not in the list of available checker names) public function DisableGroupChecking($checker){ if(array_key_exists($checker, $this->_aCheckers)){ $this->_aCheckers[$checker][1] = false; return true; }else{ return false; } } // private methods /////////////////////////////////////////////////////////////////////////// // _CheckDNSAnswer - checks DNS-server answer for 127.0.0.* values // returns: // true when success // false when failed private function _CheckDNSAnswer($dns_answer){ if(!is_array($dns_answer)) return false; $len = count($dns_answer); if($len <= 0) return false; for($i=0; $i<$len; $i++){ $obj = $dns_answer[$i]; if(!(is_object($obj) || is_array($obj))) return false; $ip_str = $obj['ip']; if(!is_string($ip_str)) return false; $pos = strpos($ip_str, '127.0.0.'); if($pos !== false) return true; } return false; } } // end of class DNSBL ?> electronics – Christian Aurich http://c-aurich.de/wordpress all about my personal interests Wed, 15 Jun 2016 20:21:23 +0000 en-US hourly 1 https://wordpress.org/?v=4.7.28 Building a current / flux probe for contactless measurements http://c-aurich.de/wordpress/2012/04/building-a-current-flux-probe-for-contactless-measurements/ http://c-aurich.de/wordpress/2012/04/building-a-current-flux-probe-for-contactless-measurements/#respond Mon, 23 Apr 2012 21:02:00 +0000 http://c-aurich.de/wordpress/?p=401 Continue reading "Building a current / flux probe for contactless measurements"

]]>
In the last weeks I followed an idea to measure current without the need to cut the wires or even open a pcb trace. The solution i came up with is a hall effect based measurement.

I wrote some more about it in an article here: http://avrs-at-leipzig.de/dokuwiki/en/prokekte/fluxprobe

If you do not like to open the full arcitle here you can review the basic schematic as well as to see a foto of my first prototype:

schematic of the prototype
Foto of my prototype

The first but still impressing measurement:

flux probe measurement at 10Hz
flux probe measurement at 10Hz, 10ms/div, red: output of probe at 200mV/div, yellow current at 33,3mA/div
]]>
http://c-aurich.de/wordpress/2012/04/building-a-current-flux-probe-for-contactless-measurements/feed/ 0
Self driving car – Take 1 http://c-aurich.de/wordpress/2012/04/self-driving-car-take-1/ http://c-aurich.de/wordpress/2012/04/self-driving-car-take-1/#respond Sun, 22 Apr 2012 21:24:54 +0000 http://c-aurich.de/wordpress/?p=408 Continue reading "Self driving car – Take 1"

]]>

The following video shows the first quasi autonomous movements of my 1:8 sized buggy. I wrote a little script that makes movements suitable for turning the car.  I had no space in my flat for letting it run right now so I stuck with the ‘dry run’ for now. After adding some more sensors I will replace the script to be event driven instead of timer based.

The electronic components are: Toradex Colibri T20 on an Iris carier board running Linux (I got that one at embedded world this year) and an Arduino for controlling the servos. There also is a DC motor controller for driving the wheels that came with the car.

]]>
http://c-aurich.de/wordpress/2012/04/self-driving-car-take-1/feed/ 0
Finishing the construction of my 3D Printer http://c-aurich.de/wordpress/2012/04/finishing-the-construction-of-my-3d-printer/ http://c-aurich.de/wordpress/2012/04/finishing-the-construction-of-my-3d-printer/#comments Tue, 17 Apr 2012 21:37:49 +0000 http://c-aurich.de/wordpress/?p=405 Continue reading "Finishing the construction of my 3D Printer"

]]>
Over the weekend I finished the mechanical work on my 3d printer. It now has all parts assembled. It took a long time because the seller needed two more tries to deliver all missing parts. But finally I got all parts plus a few bonus parts. Thanks for that to John from seemecnc.com!

As in my last post I have shot timelapse videos to show you the progress:

I connected all the motors, the heater and the thermosensor to the printer. Surprisingly all the axes were working instandly. Unfortunately the heater and the sensor were not working at all and the stepsize of the motors seem not to fit. Als I have to attach the end stop sensors to the printer for the Gen6 hardware… This means it will take some more time until I finally can print 😉

]]>
http://c-aurich.de/wordpress/2012/04/finishing-the-construction-of-my-3d-printer/feed/ 2
day 3 of embedded world http://c-aurich.de/wordpress/2012/03/day-3-of-embedded-world/ http://c-aurich.de/wordpress/2012/03/day-3-of-embedded-world/#respond Thu, 01 Mar 2012 19:46:01 +0000 http://c-aurich.de/wordpress/?p=388 Continue reading "day 3 of embedded world"

]]>
OSADL

The final day of the exhibition “embedded world” was a bit less exhausting. We spend some time speaking to the people of the stand linux meets industry. This organisation is supporting big companies running and developing open source software as well as spreading the open source thinking.

The rest of my day was quite relaxed… we walked around a bit and talked to several companies as well as some people who were interested in the project leobots.

All in all the exhibition was a big success for the team as well as for me. We all got some great impressions what the embedded industry is like at the moment.

]]>
http://c-aurich.de/wordpress/2012/03/day-3-of-embedded-world/feed/ 0
day 0 of embedded world http://c-aurich.de/wordpress/2012/02/day-0-of-embedded-world/ http://c-aurich.de/wordpress/2012/02/day-0-of-embedded-world/#respond Mon, 27 Feb 2012 21:13:16 +0000 http://c-aurich.de/wordpress/?p=374 Continue reading "day 0 of embedded world"

]]>
Today I travelled to Nuremberg with the other participants of our exhibition stand. We arrived really early about 4pm and equipped our stand for the tomorrow starting show.

Afterwards I went to my hostel room. I took a bed at A&O Hostel in the city center of nuremberg. It is next to the main station. As far as I can judge until now it is great.

After unpacking my stuff into the tiny locker in the room, I went to buy some food. On the way to the supermarket I came along a shop that was selling used stuff. I noticed a tripod in the shop windows. They sold a really nice looking one for only 29€, so it had to buy it at this bargain 😉 Just a picture with my crappy mobile phone cam:

my new tripod

When I came back to the Hostel I tried to connect to the internet. Seems that simyo delays the booking of the umts flatrates by some hours, so that I started whatching a movie. Some minutes later a roommate arrived – he came directly from india. He is going to visit the same exhibition, so we talked a while until we decided to go to a bar and have a beer and talk about the different cultures…

]]>
http://c-aurich.de/wordpress/2012/02/day-0-of-embedded-world/feed/ 0
Some random updates http://c-aurich.de/wordpress/2012/02/some-random-updates/ http://c-aurich.de/wordpress/2012/02/some-random-updates/#respond Sun, 26 Feb 2012 19:27:16 +0000 http://c-aurich.de/wordpress/?p=370 Continue reading "Some random updates"

]]>
Some of you might know it already: I stop to participate at the students project Leobots at my university. There were some disagreements in the team over the last weeks that led to my decision to leave the team as of now. I just finish the documentation of my work as far as I got and support the team at the trade fair “embedded world” next week.

As I still like to play around with robotics I bought a small rc car, a wifi-router and some electronics. I hope to get it somehow self driving and self navigating in unknown terrain.

RC Buggy

I think my other new toy, the 3d printer will be a good help for my modifications… at least for adding backets for the distance sensor that is scanning the sourrounding of the car it will be superb to have a costum made part that really fits my needs 😉

]]>
http://c-aurich.de/wordpress/2012/02/some-random-updates/feed/ 0