Example #1
0
 public function isDomainAvailable(Registrar_Domain $domain)
 {
     $this->getLog()->debug('Checking domain availability: ' . $domain->getName());
     if ($this->config['use_whois']) {
         $w = new Whois($domain->getName());
         return $w->isAvailable();
     }
     return true;
 }
Example #2
0
 function getWhois(){
     //Fetch the WHOIS data if the WHOIS variable is currently empty
     if ( !isset($this->whois) ){
         $whois = new Whois();
         $text = $whois->Lookup($this->getDomain());
         $this->whois = implode("\r\n",$text['rawdata']);
         return $text;
     }
     //Return the whois
     return $this->whois;
 }
Example #3
0
 function testWhois() 
 {
     $Whois = new Whois();
     
     $result = $Whois->FetchRecord("www.webta.net");
     $this->assertTrue($result, "Whois return info for 'www.webta.net'");
     flush();
     $result = $Whois->FetchRecord("asdasdasdfgas23423rfsdafasas.com");
     $this->assertFalse($result, "Did not receive info for 'asdasdasdfgas23423rfsdafasas.com'");
     flush();
     $result = $Whois->FetchRecord("webta.com");
     $this->assertTrue($result, "Received info for 'webta.com'");
     flush();
     $result = $Whois->FetchRecord("test.tw");
     $this->assertTrue($result, "Received info for 'test.tw'");
     flush();
     $result = $Whois->FetchRecord("webta.za");
     $this->assertFalse($result, "Did not receive info for 'webta.za'");
     flush();
     
     // Timeout
     $t1 = time();
     $result = $Whois->FetchRecord("ddeded.cc.f");
     
     $t2 = time();
     $this->assertTrue($t2 <= $t1+3, "\$Whois->SetTimeout cut FetchRecord execution time");
     
     $result = $Whois->FetchRecord("webta.net");
     $this->assertTrue($result, "FetchRecord did not have enough time to execute with SetTimeout(0)");
 }
Example #4
0
 public static function Run()
 {
     if (file_exists("cache.json")) {
         $cache = json_decode(file_get_contents("cache.json"), true);
     } else {
         $cache = array();
     }
     $tlds = explode(",", isset($_GET['tlds']) ? $_GET['tlds'] : "com,co.uk,net,org");
     $domains = explode(",", isset($_GET['domains']) ? $_GET['domains'] : "");
     $whois = new Whois();
     $rows = array();
     foreach ($domains as $domain) {
         if (strlen($domain) == 0) {
             continue;
         }
         $results = array();
         $domain = trim($domain);
         $alltaken = true;
         foreach ($tlds as $tld) {
             if (array_key_exists($domain . "." . $tld, $cache) && $cache[$domain . "." . $tld]['time'] > time() - 60 * 60 * 24) {
                 $info = $cache[$domain . "." . $tld]['data'];
             } else {
                 $info = $whois->lookup($domain . "." . $tld);
                 $cache[$domain . "." . $tld] = array('time' => time(), 'data' => $info);
             }
             $expires = "";
             switch ($info['regrinfo']['registered']) {
                 case "yes":
                     if (isset($info['regrinfo']['domain']['expires'])) {
                         $expires = date("jS F Y", strtotime($info['regrinfo']['domain']['expires']));
                     } else {
                         $expires = "Unknown";
                     }
                     break;
                 case "unknown":
                     $expires = "???";
                     break;
                 case "no":
                     $alltaken = false;
                     break;
             }
             $results[] = array('tld' => $tld, 'registered' => $info['regrinfo']['registered'], 'expires' => $expires);
         }
         $params = array('domain' => $domain, 'results' => $results, 'classes' => $alltaken ? "danger" : "");
         $rows[] = getTemplate()->get('domain-row.php', $params);
     }
     $params = array('rows' => $rows, 'cols' => $tlds);
     getTemplate()->display('page.php', $params);
     file_put_contents("cache.json", json_encode($cache));
 }
Example #5
0
 /**
  * Get the whois information for a host.
  * @return Array|NULL Return a key=>value array with all host information
  * @link whois.internic.net
  */
 public function getWhois()
 {
     $info = parse_url($this->url);
     //make sure there is no subdomains
     $parts = explode('.', $info['host']);
     $ltd = array_pop($parts);
     $name = array_pop($parts);
     return Whois::lookup($name . '.' . $ltd);
 }
Example #6
0
function get_whois($ip)
{
    require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_bfstop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'phpwhois' . DIRECTORY_SEPARATOR . 'whois.main.php';
    require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_bfstop' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'phpwhois' . DIRECTORY_SEPARATOR . 'whois.utils.php';
    $whois = new Whois();
    $whois->non_icann = true;
    $result = $whois->Lookup($ip);
    $winfo = '';
    if (!empty($result['rawdata'])) {
        $utils = new utils();
        return $utils->showHTML($result);
    } else {
        if (isset($whois->Query['errstr'])) {
            $winfo = implode("\n<br></br>", $whois->Query['errstr']);
        } else {
            $winfo = 'Unexpected error';
        }
    }
    return $winfo;
}
Example #7
0
function get_updatetime($domain)
{
    $ret = array();
    $query = new Whois($domain);
    $query->whois_query();
    $date = $query->whois_get_updatetime();
    $date = deal_updatetime($date);
    $time = strtotime($date);
    $now = time();
    $hours = round(($now - $time) / 3600);
    #echo $hours;
    if ($hours <= 72) {
        $ret['time'] = $date;
        $ret['msg'] = "该域名的最新更新时间没有超过72小时,请耐心等待(最多等待" . (72 - $hours) . "个小时)";
    } else {
        $ret['time'] = $date;
        $ret['msg'] = "";
    }
    return $ret;
}
Example #8
0
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//include whois class
include __DIR__ . '\\src\\Whois.php';
$whois = new \Whois();
$domain = 'google.com';
//get whois info
$whois_result = $whois->getInfo($domain);
echo $whois_result;
//check domain status
if ($whois->isAvailable($domain)) {
    echo "Domain is available\n";
} else {
    echo "Domain is registered\n";
}
Example #9
0
Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic

Maintained by David Saez

For the most recent version of this package visit:

http://www.phpwhois.org

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
include 'whois.main.php';
if (isset($argv[1])) {
    $domain = $argv[1];
} else {
    $domain = 'example.com';
}
$whois = new Whois();
$result = $whois->Lookup($domain);
print_r($result);
 public function __construct($sld)
 {
     parent::__construct($sld);
     $whois_answer = $this->info();
 }
$mysql = new MySQL();
$mysql->opendb("dnspro_client", "utf8");
$sql = "select `domain`,`id` from `zone` where `client_id` = '{$id}'";
$result = $mysql->query($sql);
$num_rows = mysql_num_rows($result);
if ($num_rows == NULL) {
    echo "数据为空";
    exit;
}
while ($row = mysql_fetch_array($result)) {
    $domain = $row['domain'];
    $zone_id = $row['id'];
    $domains[$domain] = $zone_id;
}
foreach ($domains as $domain => $zone_id) {
    $query = new Whois($domain);
    $query->whois_query();
    $ret = get_whois_info($domain);
    #$nameservers = $ret['module']['nameServers'];
    $nameservers = $query->whois_get_nameserver();
    #print_r($nameservers);
    #$endtime = $ret['module']['standardFormatExpirationDate'];
    #$endtime=str_replace('年','-',$endtime);
    #$endtime=str_replace('月','-',$endtime);
    #$endtime = substr($endtime,0,-3);
    #$endtime = $endtime." 00:00:00";
    $endtime = get_endtime($query);
    set_domain_whois($zone_id, $endtime);
    $temp = 0;
    foreach ($nameservers as $nameserver) {
        foreach ($eflydns_nsaddr as $eflydns_ns) {
Example #12
0
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //donation historie DT end
    $userdetailtpl->set("userdetail_last_ip", $row["cip"] . "&nbsp;&nbsp;&nbsp;<a href=index.php?page=iplog&id={$id}><img src=images/icon_ip.gif border=0></a>");
    // Start - Whois check by Petr1fied
    include_once "whois/whois.main.php";
    $whois = new Whois();
    $result = $whois->Lookup($row["cip"]);
    $output = "<pre>";
    $i = 0;
    while ($i < count($result["rawdata"])) {
        $i++;
        $output .= $result["rawdata"][$i] . "<br />";
    }
    $output .= "</pre>";
    $userdetailtpl->set("userdetail_whois", $output);
    // End - Whois check by Petr1fied
    $userdetailtpl->set("userdetail_level_admin", $row["level"]);
    $userdetailtpl->set("userdetail_colspan", "2");
} else {
    $userdetailtpl->set("userdetail_level", $row["level"]);
    $userdetailtpl->set("userdetail_colspan", "0");
<?php

require_once 'whois.php';
$whoisClass = new Whois();
if (empty($_GET['domain'])) {
    $domain = "hello.com";
} else {
    $domain = $_GET['domain'];
}
$domain = str_replace("http://", "", $domain);
$domain = str_replace("https://", "", $domain);
$domain = str_replace("www.", "", $domain);
$domain = explode("/", $domain, 2)[0];
$domain = strtolower($domain);
$domain = htmlspecialchars($domain);
if (empty($_GET['type'])) {
    $type = "array";
} else {
    $type = htmlspecialchars($_GET['type']);
}
$whoisResult = $whoisClass->query($domain);
if (!is_array($whoisResult)) {
    if (mb_substr($whoisResult, 0, 3) == "++[") {
        die($whoisResult);
    }
} else {
    switch ($type) {
        case "json":
            $jsonResult = json_encode($whoisResult);
            echo $jsonResult;
            break;
Example #14
0
<?
require("whoisclass.php");

$domainName = "cloudheroes.com";

$whois=new Whois;
echo "<br> $domainName <br>";

echo $whois->whoislookup("$domainName");

echo "<br> hello world!";
?>
function getwhois($domain, $tld)
{
    $override = apply_filters('pre_getwhois', false, $domain, $tld);
    if ($override !== false) {
        return $override;
    }
    if (empty($domain)) {
        $domain = nebula_url_components('sld');
        //Default value is current domain
    }
    if (empty($tld)) {
        $tld = nebula_url_components('tld');
        //Default value is current domain
    }
    require_once get_template_directory() . "/includes/libs/class-whois.php";
    $whois = new Whois();
    if (!$whois->ValidDomain($domain . '.' . $tld)) {
        return 'Sorry, "' . $domain . '.' . $tld . '" is not valid or not supported.';
    }
    if ($whois->Lookup($domain . '.' . $tld)) {
        return $whois->GetData(1);
    } else {
        return 'A WHOIS error occurred.';
    }
}
Example #16
0
        echo "" . $CNAMErecord['host'] . "\n<br> (" . $CNAMErecord['target'] . ")\n<br>";
    }
    ?>
                    </div>
                </div>
            </div>
        </div><!-- Main component for a primary marketing message or call to action -->

        <div class="jumbotron">
            <h2>Whois Info - <?php 
    echo $domain;
    ?>
</h2>
            <pre>
<?php 
    $whois = new Whois();
    echo $whois->whoislookup("{$domain}");
    ?>
</pre>
        </div><?php 
}
// End of if  postback is true
?>
    </div><!-- /container -->
    <!-- Bootstrap core JavaScript
================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript">
</script><script src="js/bootstrap.min.js" type="text/javascript">
</script><!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
</body>
 public function show()
 {
     //if(!$this->id) return '';
     global $LANG, $lInfo, $DB;
     list($amount, $bonustime, $closetime) = $this->getBalance();
     //list($amount2,$bonustime2,$closetime2) = $this->getBalance_old();
     $whois = new Whois($this->domain);
     if (!empty($this->domain)) {
         $result = $DB->make_select('Domains', '*', "`username`='{$this->username}' AND `ServerID`='{$this->ServerID}'");
         if (!($row = $DB->row($result))) {
             $DB->make_insert('Domains', array('name' => $this->domain, 'username' => $this->username, 'ServerID' => $this->ServerID));
             $result = $DB->make_select('Domains', '*', "`username`='{$this->username}' AND `ServerID`='{$this->ServerID}'");
             $row = $DB->row($result);
         }
         $domain = new Domain();
         $domain->load($row);
         if (!empty($domain->expirate)) {
             $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>" . '<br />Истекает: ' . $domain->expirate;
         } else {
             //if($_SERVER['HTTP_HOST'] != 'localhost') {
             if ($whois->is_available()) {
                 $domain_str = "<a href='http://{$this->ServerID}/~{$this->username}/' target='_blank'>{$this->domain} [Not Delegeted]</a>";
             } else {
                 $whois_parsed = $whois->parsed_info();
                 $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>" . '<br />Истекает: ' . $whois_parsed['expirate'];
                 $domain->expirate = $whois_parsed['expirate'];
                 $DB->make_update('Domains', '`DomainID`=' . $domain->id, array('expirate' => $domain->expirate));
             }
             //}else $domain_str = "<a href='http://$this->domain' target='_blank'>$this->domain</a>";
         }
     } else {
         $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>";
     }
     $show = beginTable("{$LANG['AccountDetails']} c ID {$this->id} , {$this->reseller->label}", '100%');
     $show .= StaticField($LANG['Domain'], $domain_str);
     $show .= StaticField($LANG['Server'], $this->ServerID);
     if (!empty($this->ServerID)) {
         $show .= StaticField('Проверить', '<a href="http://' . $this->ServerID . '/~' . $this->username . '/">' . $this->ServerID . '/~' . $this->username . '</a>');
     }
     $show .= StaticField($LANG['Username'], $this->username);
     $show .= StaticField($LANG['Password'], $this->password);
     $show .= StaticField('Дата Создания', date('d.m.Y H:i:s', strtotime($this->opentime)));
     $show .= '<tr><td colspan="2">Биллинг:</td></tr>';
     $show .= StaticField($LANG['Status'], Account::show_status($this->status));
     if ($this->status == 'Suspend' || $this->status == 'Deleted') {
         $show .= StaticField('Остановлен', '<b>' . date('d.m.Y H:i', strtotime($this->closetime)) . '</b>');
     } else {
         $show .= StaticField('Оплачен по', date('d.m.Y H:i', $closetime));
         if ($this->billing_opts['credit_days'] > 0) {
             $show .= StaticField('Проработает до', date('d.m.Y H:i', $closetime + iDAY * $this->billing_opts['credit_days']));
         }
     }
     $show .= StaticField($LANG['Amount'], '<b>' . round($amount, 2) . ' руб.</b>');
     $show .= StaticField($LANG['Bonus'], '<b>' . round($bonustime / iDAY, 1) . '</b> дн.');
     //$show .= StaticField('OLD | Оплачен по', date('d.m.Y H:i', $closetime2));
     //$show .= StaticField('OLD | '.$LANG['Amount'], '<b>'.round($amount2,2).' руб.</b>');
     //$show .= StaticField('OLD | '.$LANG['Bonus'], '<b>'.round($bonustime2/iDAY,1).'</b> дн.');
     $show .= StaticField('Макс. глубина минуса', $this->billing_opts['negativ_days'] . ' дн.');
     $show .= StaticField('Возможный кредит', $this->billing_opts['credit_days'] . ' дн.');
     $show .= StaticField($LANG['Package'], '<a href="' . iSELF . '?object=package&amp;action=show&amp;PackageID=' . $this->package->id . '">' . $this->package->title . ' (' . round($this->package->price, 2) . ' руб.)</a>');
     $show .= '<tr><td colspan="2">Доп. информация:</td></tr>';
     $show .= StaticField($LANG['Client_type'], $lInfo[$this->contype]);
     $show .= StaticField('RUCenter Anketa', $this->info['ruanketa']);
     $show .= StaticField('<a href="?object=account&amp;action=edit_comment&amp;AccountID=' . $this->id . '">' . Account::$LANG['comment'] . '</a>', '<pre>' . $this->info['comment'] . '</pre>');
     $show .= StaticField('Последний вход', $this->lastlogin == '0000-00-00 00:00:00' ? 'никогда' : date('d.m.Y H:i', strtotime($this->lastlogin)));
     if ($this->itsResellerID) {
         $show .= StaticField('Система управления бизнесом', '<font color="blue"><b>' . $this->itsResellerID . '</b></font>');
     }
     $show .= endTable();
     $show .= '<br />' . $this->contact->show();
     return $show;
 }
Example #18
0
function signup_ip_ban($user_ip, $comment)
{
    global $THIS_BASEPATH, $CURUSER, $TABLE_PREFIX, $DBDT;
    $include = $THIS_BASEPATH . "/whois/whois.main.php";
    if (@file_exists($include)) {
        include_once $include;
        $whois = new Whois();
        $result = $whois->Lookup($user_ip);
        $iplist = explode("-", preg_replace("/\\ /", "", $result["regrinfo"]["network"]["inetnum"]));
        if (!$iplist[1]) {
            // The IP address is listed in CIDR form eg 127.0/16 etc.
            $iplist = cidr_decode($result["regrinfo"]["network"]["inetnum"]);
        }
        $found = @mysqli_fetch_assoc(@mysqli_query($GLOBALS["___mysqli_ston"], "SELECT `id` FROM `{$TABLE_PREFIX}signup_ip_block` WHERE `first_ip`=INET_ATON('{$iplist['0']}') AND `last_ip`=INET_ATON('{$iplist['1']}')"));
        if (!$found) {
            // Create a new record
            $query = "INSERT INTO `{$TABLE_PREFIX}signup_ip_block` ";
            $query .= "SET `first_ip`=INET_ATON('{$iplist['0']}'), ";
            $query .= "`last_ip`=INET_ATON('{$iplist['1']}'), ";
            $query .= "`added`=UNIX_TIMESTAMP(), ";
            $query .= "`addedby`='" . $CURUSER["username"] . "', ";
            $query .= "`comment`='" . mysqli_real_escape_string($DBDT, $comment) . "'";
            @mysqli_query($GLOBALS["___mysqli_ston"], $query);
        } else {
            // Update the timestamp on the pre-existing record to extend the ban.
            @mysqli_query($GLOBALS["___mysqli_ston"], "UPDATE `{$TABLE_PREFIX}signup_ip_block` SET `added`=UNIX_TIMESTAMP(), `addedby`='" . $CURUSER["username"] . "' WHERE `id`=" . $found["id"]);
        }
    } else {
        // They don't have the required PHPWhois files so do nothing and exit the function
        return;
    }
}
Example #19
0
    foreach ($temp as $key => $status) {
        $ret[] = $status_array[$status];
    }
    return $ret;
}
if (isset($argv[1])) {
    $domain = $argv[1];
} else {
    $domain = @$_POST['domain'];
}
if ($domain == '') {
    return;
}
$ret = array();
#$info = get_whois_info($domain);
$query = new Whois($domain);
$query->whois_query();
$ret['Ret'] = 0;
$ret['RetMsg'] = "";
$ret['BeginDate'] = get_begintime($query);
$ret['EndDate'] = get_endtime($query);
if ($ret['BeginDate'] == '未收录' && $ret['EndDate'] == '未收录') {
    $ret['Ret'] = 1;
    $ret['RetMsg'] = "该域名暂无相关信息<br/>请检查域名填写格式是否正确<br/>(例:不要携带如 ‘www’ 等子域名)";
    print_r(json_encode($ret));
    return;
}
$ret['Updated'] = get_updatetime($query);
$ret['Nameservers'] = get_nameserver($query);
$beginday = $ret['BeginDate'];
$endday = $ret['EndDate'];
Example #20
0
 public function actionWhois($id)
 {
     $model = $this->loadModel($id);
     $whois = new Whois();
     $this->renderPartial('whois', array('model' => $model, 'data' => $whois->whoislookup($model->ipstr)));
 }
Example #21
0
<?php

// ini_set('display_errors', 1);
// Load composer framework
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
// use phpWhois\Whois;
// ini_set('display_errors', 1);
$whois = new Whois();
$query = $_POST['query'];
$result = $whois->lookup($query, false);
echo json_encode($result);
 /**
  * Maps WeFact Whois object to ODR contact format
  *
  * @param Whois $whois Whois object
  * @param mixed $type  Contact Type
  *
  * @return array
  */
 public function mapWhoisToContact(Whois $whois, $type)
 {
     $prefix = $this->_getContactPrefix($type);
     // Some help-functions, to obtain more formatted data
     $whois->getParam($prefix, 'StreetName');
     // Not only Address, but also StreetName, StreetNumber and StreetNumberAddon are available after calling this function
     $whois->getParam($prefix, 'CountryCode');
     // Phone and faxnumber are split. CountryCode, PhoneNumber and FaxNumber available. CountryCode contains for example '+31'. PhoneNumber contains number without leading zero e.g. '123456789'
     $legalForm = $this->_getLegalForm($whois, $prefix);
     $gender = 'NA';
     if (in_array(strtoupper($whois->{$prefix . 'Sex'}), array('F', 'M'), true)) {
         $gender = strtoupper($whois->{$prefix . 'Sex'}) === 'F' ? 'FEMALE' : 'MALE';
     }
     $custs = empty($whois->{$prefix . 'customvalues'}) ? array() : $whois->{$prefix . 'customvalues'};
     if (empty($custs) && !empty($whois->{$prefix . 'custom'})) {
         $custs = $whois->{$prefix . 'custom'};
     }
     $state = empty($whois->{$prefix . 'State'}) ? null : $whois->{$prefix . 'State'};
     if ($state === null) {
         if (isset($custs['state'])) {
             $state = $custs['state'];
         } elseif (isset($custs['region'])) {
             $state = $custs['region'];
         }
     }
     return array('type' => $this->mapContactPrefixToOdr($prefix), 'first_name' => $whois->{$prefix . 'Initials'}, 'last_name' => $whois->{$prefix . 'SurName'}, 'full_name' => trim($whois->{$prefix . 'Initials'} . ' ' . $whois->{$prefix . 'SurName'}), 'initials' => $whois->{$prefix . 'Initials'}, 'state' => $state, 'city' => $whois->{$prefix . 'City'}, 'postal_code' => strtoupper(str_replace(' ', '', $whois->{$prefix . 'ZipCode'})), 'phone' => $whois->{$prefix . 'CountryCode'} . '.' . str_replace(' ', '', $whois->{$prefix . 'PhoneNumber'}), 'email' => $whois->{$prefix . 'EmailAddress'}, 'country' => $whois->{$prefix . 'Country'}, 'language' => 'NL', 'gender' => $gender, 'street' => $whois->{$prefix . 'StreetName'}, 'house_number' => $whois->{$prefix . 'StreetNumber'} . ' ' . $whois->{$prefix . 'StreetNumberAddon'}, 'company_name' => $whois->{$prefix . 'CompanyName'} ?: trim($whois->{$prefix . 'Initials'} . ' ' . $whois->{$prefix . 'SurName'}), 'company_email' => $whois->{$prefix . 'EmailAddress'}, 'company_street' => $whois->{$prefix . 'StreetName'}, 'company_house_number' => $whois->{$prefix . 'StreetNumber'} . ' ' . $whois->{$prefix . 'StreetNumberAddon'}, 'company_postal_code' => strtoupper(str_replace(' ', '', $whois->{$prefix . 'ZipCode'})), 'company_city' => $whois->{$prefix . 'City'}, 'company_phone' => $whois->{$prefix . 'CountryCode'} . '.' . str_replace(' ', '', $whois->{$prefix . 'PhoneNumber'}), 'company_vatin' => $whois->{$prefix . 'TaxNumber'}, 'organization_legal_form' => $legalForm);
 }
Example #23
0
function visited_sites_whois()
{
    $unix = new unix();
    if (!$GLOBALS["FORCE"]) {
        $timefile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
        $timeOfFile = $unix->file_time_min($timefile);
        if ($timeOfFile < 520) {
            return;
        }
        @unlink($timefile);
        @file_put_contents($timefile, time());
    }
    $t1 = time();
    $sql = "SELECT familysite FROM visited_sites WHERE whois IS NULL AND `familysite`!='ipaddr' AND LENGTH(familysite)>0";
    $results = $GLOBALS["Q"]->QUERY_SQL($sql);
    if (!$GLOBALS["Q"]->ok) {
        stats_admin_events(0, $q->mysql_error, null, __FILE__, __LINE__);
        return;
    }
    $num_rows = mysql_num_rows($results);
    stats_admin_events(2, "visited_sites -> whois -> {$num_rows} rows", null, __FILE__, __LINE__);
    if ($num_rows == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo "No datas `{$sql}`" . __FUNCTION__ . " " . __LINE__ . "\n";
        }
        return;
    }
    $c = 0;
    $f = 0;
    $already = array();
    $MinutesFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".minutes";
    @unlink($MinutesFile);
    @file_put_contents($MinutesFile, time());
    $D = 0;
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $D++;
        $domain = $ligne["familysite"];
        if (strpos($domain, ".") == 0) {
            continue;
        }
        if (!isset($already[$domain])) {
            $whois = new Whois();
            $result = $whois->Lookup($domain);
            $already[$domain] = $result;
            $c++;
        } else {
            continue;
        }
        if (!is_array($result)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "{$domain} no results...\n";
                $f++;
                continue;
            }
        }
        $whoisdatas = addslashes(serialize($result));
        $TimeLoop = $unix->file_time_min($MinutesFile);
        if ($TimeLoop > 4) {
            if (count($ROWS_visited_sites_prefix) > 0) {
                $GLOBALS["Q"]->QUERY_SQL($ROWS_visited_sites_prefix . @implode(",", $ROWS_visited_sites_catz));
                $ROWS_visited_sites_catz = array();
            }
            stats_admin_events(2, "{$D}/{$num_rows} rows", null, __FILE__, __LINE__);
            if (SquidStatisticsTasksOverTime()) {
                stats_admin_events(1, "Statistics overtime... Aborting", null, __FILE__, __LINE__);
                return;
            }
            @unlink($MinutesFile);
            @file_put_contents($MinutesFile, time());
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "update {$domain} width " . strlen($whoisdatas) . " bytes\n";
        }
        $sql = "UPDATE visited_sites SET whois='{$whoisdatas}' WHERE familysite='{$domain}'";
        $GLOBALS["Q"]->QUERY_SQL($sql);
        if (!$GLOBALS["Q"]->ok) {
            echo "{$GLOBALS["Q"]->mysql_error}\n";
            return;
        }
    }
    if ($c > 0) {
        $unix = new unix();
        $took = $unix->distanceOfTimeInWords($t1, time());
        stats_admin_events(2, "WHOIS: {$c} visisted websites informations updated {$f} failed, {$took}", null, __FILE__, __LINE__, "visited");
    }
}
Example #24
0
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
header('Content-Type: text/html; charset=UTF-8');
$out = implode('', file('example.html'));
$out = str_replace('{self}', $_SERVER['PHP_SELF'], $out);
$resout = extract_block($out, 'results');
if (isset($_GET['query'])) {
    $query = $_GET['query'];
    if (!empty($_GET['output'])) {
        $output = $_GET['output'];
    } else {
        $output = '';
    }
    include_once 'src/whois.main.php';
    include_once 'src/whois.utils.php';
    $whois = new Whois();
    // Set to true if you want to allow proxy requests
    $allowproxy = false;
    // get faster but less acurate results
    $whois->deep_whois = empty($_GET['fast']);
    // To use special whois servers (see README)
    //$whois->UseServer('uk','whois.nic.uk:1043?{hname} {ip} {query}');
    //$whois->UseServer('au','whois-check.ausregistry.net.au');
    // Comment the following line to disable support for non ICANN tld's
    $whois->non_icann = true;
    $result = $whois->Lookup($query);
    $resout = str_replace('{query}', $query, $resout);
    $winfo = '';
    switch ($output) {
        case 'object':
            if ($whois->Query['status'] < 0) {
Example #25
0
 public static function ajax_whois_callback()
 {
     if (!class_exists('Whois')) {
         require_once 'whois/whois.main.php';
     }
     $val = trim($_POST['val']);
     $val = preg_replace('/[^a-zA-Z0-9\\.\\-]+/', '', $val);
     $whois = new Whois();
     $result = $whois->Lookup($val);
     return array('ok' => 1, 'result' => $result);
 }
function whoissave_perform($familysite)
{
    $GLOBALS["Q"] = new mysql_squid_builder();
    include_once dirname(__FILE__) . '/ressources/whois/whois.main.php';
    $domain = $familysite;
    $FamilySite = $GLOBALS["Q"]->GetFamilySites($domain);
    $whois = new Whois();
    writelogs("->Lookup({$domain})", __FUNCTION__, __FILE__, __LINE__);
    $result = $whois->Lookup($domain);
    if (!is_array($result)) {
        writelogs("->Lookup({$FamilySite})", __FUNCTION__, __FILE__, __LINE__);
        $result = $whois->Lookup($FamilySite);
    }
    if (!is_array($result)) {
        writelogs("Not an array....", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $whoisdatas = addslashes(serialize($result));
    writelogs("{$whoisdatas}", __FUNCTION__, __FILE__, __LINE__);
    $sql = "SELECT familysite FROM `visited_sites` WHERE familysite='{$Familysite}'";
    $ligne = mysql_fetch_array($GLOBALS["Q"]->QUERY_SQL($sql));
    if ($ligne["familysite"] == null) {
        $sql = "UPDATE visited_sites SET whois='{$whoisdatas}' WHERE familysite='{$FamilySite}'";
    } else {
        $sql = "UPDATE visited_sites SET whois='{$whoisdatas}' WHERE sitename='{$domain}'";
    }
    $GLOBALS["Q"]->QUERY_SQL($sql);
    if (!$GLOBALS["Q"]->ok) {
        writelogs("{$sql}:{$GLOBALS["Q"]->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
        echo "{$GLOBALS["Q"]->mysql_error}\n";
        return;
    }
}
Example #27
0
 public static function is_root($domain)
 {
     $tlds = Whois::get_tlds();
     $domainArr = explode('.', $domain);
     $count = count($domainArr);
     if ($count < 2 || $count > 3) {
         return false;
     } elseif ($count == 2) {
         return true;
     } else {
         // 2-th zone domain
         if (strlen($domainArr[1]) > 4) {
             return false;
         } elseif (!in_array($domainArr[1] . '.' . $domainArr[2], $tlds) && !in_array($domainArr[1], array('us', 'com', 'ru', 'info', 'biz', 'org', 'net'))) {
             echo $domainArr[1] . '.' . $domainArr[2] . "<br />";
             return false;
         } else {
             return true;
         }
     }
 }
Example #28
0
<?php

include 'Whois.php';
$w = new Whois();
echo '<pre>';
//print_r($w->query('przeslij.pl'));
//print_r($w->query('de77.com'));
//print_r($w->query('meinkaetzchen.de'));
//print_r($w->query('shop.fr'));
//print_r($w->query('wikipedia.org'));
//print_r($w->query('shop.net'));
//print_r($w->query('google.net'));
print_r($w->query('google.com'));
    function render_tab1()
    {
        global $aio_wp_security;
        ?>

        <h2><?php 
        _e('WHOIS Lookup Information', 'aiowpsecurity');
        ?>
</h2>
        <div class="aio_blue_box">
            <?php 
        echo '<p>' . __('This feature allows you to look up more detailed information about an IP address or domain name by querying the WHOIS API.', 'aiowpsecurity') . '
            </p>';
        ?>

        </div>

        <div class="postbox">
        <h3><label for="title"><?php 
        _e('Perform a WHOIS Lookup for an IP or Domain Name', 'aiowpsecurity');
        ?>
</label></h3>
        <div class="inside">
            <form action="" method="POST">
                <?php 
        wp_nonce_field('aiowpsec-whois-lookup-nonce');
        ?>

                <table class="form-table">
                <tr valign="top">
                    <th scope="row"><?php 
        _e('Enter IP Address or Domain Name', 'aiowpsecurity');
        ?>
:</th>
                    <td><input type="text" size="20" name="aiowps_whois_lookup_field" value="<?php 
        //echo $aio_wp_security->configs->get_value('aiowps_whois_lookup_field');
        ?>
" />
                    <span class="description"><?php 
        _e('Enter an IP address or domain name. Example: 111.11.12.13 OR some-domain-name.com', 'aiowpsecurity');
        ?>
</span>
                    </td> 
                </tr>
                </table>
                <input type="submit" name="aiowps_whois_lookup" value="<?php 
        _e('Perform IP or Domain Lookup', 'aiowpsecurity');
        ?>
" class="button-primary ip-domain-lookup" />
            </form>
        </div></div>
    <?php 
        if (isset($_POST['aiowps_whois_lookup'])) {
            $nonce = $_REQUEST['_wpnonce'];
            if (!wp_verify_nonce($nonce, 'aiowpsec-whois-lookup-nonce')) {
                $aio_wp_security->debug_logger->log_debug("Nonce check failed on WHOIS lookup!", 4);
                die("Nonce check failed on WHOIS lookup!");
            }
            require_once AIO_WP_SECURITY_LIB_PATH . '/whois/whois.main.php';
            require_once AIO_WP_SECURITY_LIB_PATH . '/whois/whois.utils.php';
            $input_val = trim($_POST['aiowps_whois_lookup_field']);
            if (filter_var($input_val, FILTER_VALIDATE_IP) || filter_var(gethostbyname($input_val), FILTER_VALIDATE_IP)) {
                //$info_msg_string = '<p class="aio_info_with_icon">'.sprintf( __('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity')).'</p>';
                //echo ($info_msg_string);
                $this->show_msg_updated(__('WHOIS lookup successfully completed. Please see the results below:', 'aiowpsecurity'));
                $whois = new Whois();
                $result = $whois->Lookup($input_val);
                if (!empty($result['rawdata'])) {
                    $utils = new utils();
                    $winfo = $utils->showHTML($result);
                    echo $winfo;
                }
            } else {
                $this->show_msg_error(__('You have entered an incorrectly formatted IP address or domain name. Please try again.', 'aiowpsecurity'));
            }
        }
    }
 public function lookup()
 {
     $view = $this->getView();
     $request = $this->getPageRequest();
     $query = $request->getParameter('q');
     $view->contenttype = View::CTYPE_JSON;
     $view->mode = View::MODE_AJAX;
     $view->record = false;
     $result = Whois::Lookup($query);
     $view->jsondata = ['query' => $query, 'ip' => $result->getIP(), 'network' => $result->getNetwork(), 'organization' => $result->getOrganization(), 'country' => $result->getCountry(), 'country_name' => $result->getCountryName(), 'flag_sm' => $result->getCountryIcon('20x20'), 'flag_lg' => $result->getCountryIcon('100x100')];
 }