. // // 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 ?> Comments on: import eagle boards in mechanical CAD drawings http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/ all about my personal interests Wed, 30 Nov 2016 23:41:07 +0000 hourly 1 https://wordpress.org/?v=4.7.29 By: HackEDA « Tomi Engdahl’s ePanorama blog http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-14212 Wed, 27 Mar 2013 06:34:15 +0000 http://c-aurich.de/wordpress/?p=423#comment-14212 […] Eagle boards for use in FreeCAD article tells an idea how an Eagle CAD circuit board design can be imported a proper CAD program in order to design […]

]]>
By: import eagle boards in mechanical CAD drawings | Senior Project: Mechanical Engineering | Scoop.it http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8910 Thu, 21 Feb 2013 17:42:18 +0000 http://c-aurich.de/wordpress/?p=423#comment-8910 […] Usually you use eagle to design your printed circuit boards (PCBs) only in 2 dimensions (when not considering the layers as 3rd layer). This gives you some headaches for narrow space designs like in small cases.  […]

]]>
By: Christian http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8864 Wed, 20 Feb 2013 05:18:30 +0000 http://c-aurich.de/wordpress/?p=423#comment-8864 I just googled that Lucas also uses text files to save the PDB data, so the same way should work with Lucas too… Maybe I implement it some day 😉

]]>
By: ken http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8856 Tue, 19 Feb 2013 19:29:03 +0000 http://c-aurich.de/wordpress/?p=423#comment-8856 Cool stuff…any idea if this is possible w/ KiCAD files?

]]>
By: import eagle boards in mechanical CAD drawings | Arduino progz | Scoop.it http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8769 Mon, 18 Feb 2013 08:20:24 +0000 http://c-aurich.de/wordpress/?p=423#comment-8769 […] Usually you use eagle to design your printed circuit boards (PCBs) only in 2 dimensions (when not considering the layers as 3rd layer). This gives you some headaches for narrow space designs like in small cases.  […]

]]>
By: Christian http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8698 Fri, 15 Feb 2013 05:32:28 +0000 http://c-aurich.de/wordpress/?p=423#comment-8698 Thank you for the hint. The instal section was just not up to date, because I changed the script name from eagle2freecad.py to eagle.FCMacro recently to allow an easier instal procedure.

]]>
By: Jorge Garcia http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8697 Thu, 14 Feb 2013 21:20:48 +0000 http://c-aurich.de/wordpress/?p=423#comment-8697 Hi Christian,

eagle2freecad.py does not appear to be up on your github. At least I can’t find it. Sorry if there’s something really simple I’m missing.

Best Regards,
Jorge Garcia

]]>
By: Jorge Garcia http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8682 Tue, 12 Feb 2013 17:01:15 +0000 http://c-aurich.de/wordpress/?p=423#comment-8682 THIS IS AWESOOOOMMMEEEEE!!!!!!!!!!!!!!!!!!!!!

YOU HAVE NO IDEA HOW STOKED I AM ABOUT THIS! I WILL BE STUDYING THIS THE REST OF THE WEEK.

THANK YOU! THANK YOU!

Jorge Garcia
Cadsoft Support

]]>
By: Script lets you import Eagle boards for use in FreeCAD | Cool Internet Projects http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8679 Tue, 12 Feb 2013 12:50:35 +0000 http://c-aurich.de/wordpress/?p=423#comment-8679 […] There are already a few options along these lines, but they didn’t quite fit his needs so he developed a script to import Eagle boards into FreeCAD. The script is packaged as a python macro for […]

]]>
By: Flo http://c-aurich.de/wordpress/2013/02/import-eagle-boards-in-mechanical-cad-drawings/comment-page-1/#comment-8673 Tue, 12 Feb 2013 06:15:17 +0000 http://c-aurich.de/wordpress/?p=423#comment-8673 Hi,
If you can do that with the XML data, you can do the same directly in Eagle using an ULP(script in the IDE).
About the color, there is a path which use colors in Eagle, but this is not really appropriate for coloring parts in your 3D models.. :/
I’m think it’s interesting for people who don’t have Eagle 😉
++

]]>