Converting CRLF to LF in a few files

This commit is contained in:
Peca 2025-06-01 14:44:18 +02:00
parent 5ca293c9b2
commit 435a362765
5 changed files with 440 additions and 440 deletions

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# Changing public_html permission # Changing public_html permission
user="$1" user="$1"
domain="$2" domain="$2"
ip="$3" ip="$3"
home_dir="$4" home_dir="$4"
docroot="$5" docroot="$5"
chmod 755 $docroot chmod 755 $docroot
exit 0 exit 0

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# Changing public_html permission # Changing public_html permission
user="$1" user="$1"
domain="$2" domain="$2"
ip="$3" ip="$3"
home_dir="$4" home_dir="$4"
docroot="$5" docroot="$5"
chmod 755 $docroot chmod 755 $docroot
exit 0 exit 0

View file

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# Changing public_html permission # Changing public_html permission
user="$1" user="$1"
domain="$2" domain="$2"
ip="$3" ip="$3"
home_dir="$4" home_dir="$4"
docroot="$5" docroot="$5"
chmod 755 $docroot chmod 755 $docroot
exit 0 exit 0

View file

@ -1,243 +1,243 @@
LICENCE AGREEMENT FOR THE IONCUBE PHP LOADER, PROVIDED TO ENABLE THE USE LICENCE AGREEMENT FOR THE IONCUBE PHP LOADER, PROVIDED TO ENABLE THE USE
OF IONCUBE ENCODED FILES AND AS PART OF THE IONCUBE24 SERVICE (ioncube24.com) OF IONCUBE ENCODED FILES AND AS PART OF THE IONCUBE24 SERVICE (ioncube24.com)
YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE USING THE YOU SHOULD CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS BEFORE USING THE
LOADER SOFTWARE. THE INSTALLATION AND/OR USE OR COPYING OF THE IONCUBE PHP LOADER SOFTWARE. THE INSTALLATION AND/OR USE OR COPYING OF THE IONCUBE PHP
LOADER SOFTWARE INDICATES YOUR ACCEPTANCE OF THIS LICENCE AGREEMENT. IF YOU LOADER SOFTWARE INDICATES YOUR ACCEPTANCE OF THIS LICENCE AGREEMENT. IF YOU
DO NOT ACCEPT THE TERMS OF THIS LICENCE AGREEMENT, DO NOT INSTALL, COPY DO NOT ACCEPT THE TERMS OF THIS LICENCE AGREEMENT, DO NOT INSTALL, COPY
AND/OR USE THE LOADER SOFTWARE. AND/OR USE THE LOADER SOFTWARE.
DEFINITIONS DEFINITIONS
The following definitions shall apply in this document: The following definitions shall apply in this document:
LOADER shall mean the ionCube PHP Loader software package or collection LOADER shall mean the ionCube PHP Loader software package or collection
of Loaders, including any modifications or upgrades to the software, used for of Loaders, including any modifications or upgrades to the software, used for
executing PHP scripts previously encoded with the ionCube PHP Encoder executing PHP scripts previously encoded with the ionCube PHP Encoder
software to render them non-humanly readable, and any associated software to render them non-humanly readable, and any associated
documentation or electronic or online materials relating to the software. documentation or electronic or online materials relating to the software.
ENCODER shall mean any ionCube PHP Encoder software or service used for the ENCODER shall mean any ionCube PHP Encoder software or service used for the
purpose of producing non-humanly readable encoded files from PHP scripts. purpose of producing non-humanly readable encoded files from PHP scripts.
ENCODED FILE shall mean a non-humanly readable file produced by the ENCODED FILE shall mean a non-humanly readable file produced by the
Encoder and being derived from humanly readable PHP script source. Encoder and being derived from humanly readable PHP script source.
PROVIDER shall mean ionCube Ltd. PROVIDER shall mean ionCube Ltd.
USER/YOU shall mean any entity who has downloaded or obtained through any USER/YOU shall mean any entity who has downloaded or obtained through any
other means a version of the Loader software. other means a version of the Loader software.
1 LICENSE ENTITLEMENT 1 LICENSE ENTITLEMENT
1.1 The Loader is provided without charge. Title to the Loader does not pass 1.1 The Loader is provided without charge. Title to the Loader does not pass
to the user in any circumstances. The Loader is supplied as object code. to the user in any circumstances. The Loader is supplied as object code.
1.2 The provider grants a personal, non-transferable, non-exclusive licence to 1.2 The provider grants a personal, non-transferable, non-exclusive licence to
use the Loader in accordance with the terms and conditions of this Licence use the Loader in accordance with the terms and conditions of this Licence
Agreement. Agreement.
1.3 The installation or downloading and use of the Loader entitles the user 1.3 The installation or downloading and use of the Loader entitles the user
to install and use the Loader for its own internal lawful purposes. to install and use the Loader for its own internal lawful purposes.
2 DISTRIBUTION 2 DISTRIBUTION
2.1 The Loader may be freely distributed to third parties alone or as 2.1 The Loader may be freely distributed to third parties alone or as
part of a distribution containing other items provided that this license part of a distribution containing other items provided that this license
is also included. is also included.
2.2 The Loader may under no circumstances be branded as another product, 2.2 The Loader may under no circumstances be branded as another product,
whether distributed or not. whether distributed or not.
2.3 Distribution as part of a commercial product is permitted provided such 2.3 Distribution as part of a commercial product is permitted provided such
distribution is in accordance with clauses 2.1 and 2.2 with respect to the distribution is in accordance with clauses 2.1 and 2.2 with respect to the
Loader. Loader.
3 ANALYSIS / REVERSE ENGINEERING / MODIFICATION 3 ANALYSIS / REVERSE ENGINEERING / MODIFICATION
Except insofar as the user is permitted to do so in accordance with applicable Except insofar as the user is permitted to do so in accordance with applicable
law: law:
3.1 Any analysis of the Loader and embedded data by any means and by 3.1 Any analysis of the Loader and embedded data by any means and by
any entity whether human or otherwise and including but without limitation to any entity whether human or otherwise and including but without limitation to
discover details of internal operation, to reverse engineer, to de-compile discover details of internal operation, to reverse engineer, to de-compile
object code, or to modify for the purposes of modifying behaviour is object code, or to modify for the purposes of modifying behaviour is
forbidden. forbidden.
3.2 Any analysis of encoded files by any means and by any entity whether human 3.2 Any analysis of encoded files by any means and by any entity whether human
or otherwise and including but without limitation to discover details of file or otherwise and including but without limitation to discover details of file
format or for the purposes of modifying behaviour or scope of their usage is format or for the purposes of modifying behaviour or scope of their usage is
forbidden. forbidden.
4 WARRANTY 4 WARRANTY
THE LOADER SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED THE LOADER SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
WARRANTIES INCLUDING BUT WITHOUT LIMITATION THE IMPLIED WARRANTIES WARRANTIES INCLUDING BUT WITHOUT LIMITATION THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE ARE OF MERCHANTABILITY AND FITNESS FOR ANY PARTICULAR PURPOSE ARE
DISCLAIMED. THE PROVIDER DOES NOT WARRANT THAT THE LOADER IS UNINTERRUPTED DISCLAIMED. THE PROVIDER DOES NOT WARRANT THAT THE LOADER IS UNINTERRUPTED
OR ERROR FREE, NOR THAT THE OPERATION OF THE LOADER WILL FUNCTION IN OR ERROR FREE, NOR THAT THE OPERATION OF THE LOADER WILL FUNCTION IN
CONJUNCTION WITH ANY OTHER PRODUCT. CONJUNCTION WITH ANY OTHER PRODUCT.
5 LIMITATION OF LIABILITY 5 LIMITATION OF LIABILITY
5.1 IN NO EVENT WILL THE PROVIDER OF THE LOADER BE LIABLE TO THE USER OR ANY 5.1 IN NO EVENT WILL THE PROVIDER OF THE LOADER BE LIABLE TO THE USER OR ANY
PARTY FOR ANY DIRECT, INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR OTHER PARTY FOR ANY DIRECT, INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR OTHER
CONSEQUENTIAL DAMAGES ARISING DIRECTLY OR INDIRECTLY FROM THIS LICENCE CONSEQUENTIAL DAMAGES ARISING DIRECTLY OR INDIRECTLY FROM THIS LICENCE
AGREEMENT OR ANY USE OF THE LOADER OR ENCODED FILES, EVEN IF THE PROVIDER IS AGREEMENT OR ANY USE OF THE LOADER OR ENCODED FILES, EVEN IF THE PROVIDER IS
EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
5.2 THE LOADER IS PROVIDED ON AN "AS IS" BASIS. THE PROVIDER EXCLUDES ALL 5.2 THE LOADER IS PROVIDED ON AN "AS IS" BASIS. THE PROVIDER EXCLUDES ALL
WARRANTIES, CONDITIONS, TERMS, UNDERTAKINGS AND REPRESENTATIONS (EXCLUDING WARRANTIES, CONDITIONS, TERMS, UNDERTAKINGS AND REPRESENTATIONS (EXCLUDING
FRAUDULENT MISREPRESENTATION) OF ANY KIND, EXPRESS OR IMPLIED, STATUTORY OR FRAUDULENT MISREPRESENTATION) OF ANY KIND, EXPRESS OR IMPLIED, STATUTORY OR
OTHERWISE IN CONNECTION WITH THE LOADER TO THE FULLEST EXTENT PERMITTED BY OTHERWISE IN CONNECTION WITH THE LOADER TO THE FULLEST EXTENT PERMITTED BY
LAW. LAW.
5.3 DOWNLOADING THE LOADER IS AT YOUR OWN RISK AND THE PROVIDER DOES NOT 5.3 DOWNLOADING THE LOADER IS AT YOUR OWN RISK AND THE PROVIDER DOES NOT
ACCEPT LIABILITY FOR ANY DIRECT OR INDIRECT LOSS OR DAMAGE HOWSOEVER CAUSED AS ACCEPT LIABILITY FOR ANY DIRECT OR INDIRECT LOSS OR DAMAGE HOWSOEVER CAUSED AS
A RESULT OF ANY COMPUTER VIRUSES, BUGS, TROJAN HORSES, WORMS, SOFTWARE BOMBS A RESULT OF ANY COMPUTER VIRUSES, BUGS, TROJAN HORSES, WORMS, SOFTWARE BOMBS
OR OTHER SIMILAR PROGRAMS ARISING FROM YOUR USE OF THE LOADER. WHILST THE OR OTHER SIMILAR PROGRAMS ARISING FROM YOUR USE OF THE LOADER. WHILST THE
PROVIDER WILL DO ITS BEST TO ENSURE THAT THE LOADER IS FREE FROM SUCH PROVIDER WILL DO ITS BEST TO ENSURE THAT THE LOADER IS FREE FROM SUCH
DESTRUCTIVE PROGRAMS, IT IS YOUR RESPONSIBILITY TO TAKE REASONABLE PRECAUTIONS DESTRUCTIVE PROGRAMS, IT IS YOUR RESPONSIBILITY TO TAKE REASONABLE PRECAUTIONS
TO SCAN FOR SUCH DESTRUCTIVE PROGRAMS DOWNLOADED FROM THE INTERNET. TO SCAN FOR SUCH DESTRUCTIVE PROGRAMS DOWNLOADED FROM THE INTERNET.
5.4 THE PROVIDER'S MAXIMUM LIABILITY FOR ANY LOSS OR DAMAGE ARISING FROM THIS 5.4 THE PROVIDER'S MAXIMUM LIABILITY FOR ANY LOSS OR DAMAGE ARISING FROM THIS
LICENCE AGREEMENT SHALL IN ANY EVENT BE LIMITED IN THE SOLE DISCRETION OF THE LICENCE AGREEMENT SHALL IN ANY EVENT BE LIMITED IN THE SOLE DISCRETION OF THE
PROVIDER TO THE REPLACEMENT OF THE LOADER PRODUCT. PROVIDER TO THE REPLACEMENT OF THE LOADER PRODUCT.
5.5 DUE TO THE NATURE OF THE INTERNET, THE PROVIDER CANNOT GUARANTEE THAT ANY 5.5 DUE TO THE NATURE OF THE INTERNET, THE PROVIDER CANNOT GUARANTEE THAT ANY
E-MAILS OR OTHER ELECTRONIC TRANSMISSIONS WILL BE SENT TO YOU OR RECEIVED BY E-MAILS OR OTHER ELECTRONIC TRANSMISSIONS WILL BE SENT TO YOU OR RECEIVED BY
THE PROVIDER OR THAT THE CONTENT OF SUCH TRANSMISSIONS WILL BE SECURE DURING THE PROVIDER OR THAT THE CONTENT OF SUCH TRANSMISSIONS WILL BE SECURE DURING
TRANSMISSION. TRANSMISSION.
6 BUG FIXING AND PRODUCT SUPPORT 6 BUG FIXING AND PRODUCT SUPPORT
6.1 The provider will use reasonable endeavours to provide support to users. 6.1 The provider will use reasonable endeavours to provide support to users.
The provider will at their discretion only provide support for the latest The provider will at their discretion only provide support for the latest
release. release.
6.2 Support comprises of fault reporting via tickets and fault diagnosis, 6.2 Support comprises of fault reporting via tickets and fault diagnosis,
recommendations on workarounds, and where reasonably possible a timely recommendations on workarounds, and where reasonably possible a timely
resolution. resolution.
6.3 The user accepts that on occasion the ability of the provider to meet 6.3 The user accepts that on occasion the ability of the provider to meet
anticipated or published support schedules may be impaired due to, but without anticipated or published support schedules may be impaired due to, but without
limitation, Internet service provider failures or software failures that limitation, Internet service provider failures or software failures that
affect the ability to communicate for an indeterminate period. affect the ability to communicate for an indeterminate period.
6.4 The provider reserves the right to refuse to provide support at any time. 6.4 The provider reserves the right to refuse to provide support at any time.
6.5 The provider wishes to maintain and offer a product of the highest 6.5 The provider wishes to maintain and offer a product of the highest
possible quality, and accordingly may from time to time and at its discretion possible quality, and accordingly may from time to time and at its discretion
make product changes for the purpose of correcting behaviour in variance to make product changes for the purpose of correcting behaviour in variance to
the published specification or the user's reasonable expectations. the published specification or the user's reasonable expectations.
6.6 The provider reserves the right to charge for support where the user does 6.6 The provider reserves the right to charge for support where the user does
not have a valid support plan in place, or where the support offered exceeds not have a valid support plan in place, or where the support offered exceeds
the scope of the active support plan. the scope of the active support plan.
7 PRODUCT UPGRADES 7 PRODUCT UPGRADES
7.1 The provider may from time to time release product upgrades. These will 7.1 The provider may from time to time release product upgrades. These will
be provided free of charge and attempts made to provide a timely notification be provided free of charge and attempts made to provide a timely notification
to customers of the existence of any new release. to customers of the existence of any new release.
8 ERRORS AND OMISSIONS 8 ERRORS AND OMISSIONS
Whilst reasonable endeavours are made to ensure the accuracy of documentation Whilst reasonable endeavours are made to ensure the accuracy of documentation
concerning the details of the Loader, the user accepts the possibility of concerning the details of the Loader, the user accepts the possibility of
inaccuracies in information presented in any format, including email inaccuracies in information presented in any format, including email
communications and online services. The provider shall under no circumstances communications and online services. The provider shall under no circumstances
be liable for any events that arise as a result of unintentional inaccuracies be liable for any events that arise as a result of unintentional inaccuracies
or omissions. or omissions.
9 USER INDEMNITY 9 USER INDEMNITY
You agree to fully indemnify, defend and hold the provider harmless You agree to fully indemnify, defend and hold the provider harmless
immediately upon demand from and against all actions, liability, claims, immediately upon demand from and against all actions, liability, claims,
losses, damages, costs and expenses (including legal/attorney fees) incurred losses, damages, costs and expenses (including legal/attorney fees) incurred
by the provider arising directly or indirectly as a result of your breach of by the provider arising directly or indirectly as a result of your breach of
this Licence Agreement. this Licence Agreement.
10 INTELLECTUAL PROPERTY RIGHTS 10 INTELLECTUAL PROPERTY RIGHTS
10.1 The user acknowledges that the Loader and associated documentation and 10.1 The user acknowledges that the Loader and associated documentation and
materials contain proprietary information of the provider and are and shall materials contain proprietary information of the provider and are and shall
remain the exclusive property of the provider and/or its licensors and all remain the exclusive property of the provider and/or its licensors and all
title, copyright, trade marks, trade names, patents and other intellectual title, copyright, trade marks, trade names, patents and other intellectual
property rights therein of whatever nature shall remain the sole property of property rights therein of whatever nature shall remain the sole property of
the provider and/or its licensors. the provider and/or its licensors.
10.2 No title to or rights of ownership, copyright or other intellectual 10.2 No title to or rights of ownership, copyright or other intellectual
property in the Loader is transferred to the user (other than the licence property in the Loader is transferred to the user (other than the licence
rights expressly granted in this Licence Agreement). rights expressly granted in this Licence Agreement).
11 TERMINATION 11 TERMINATION
11.1 The provider reserves the right to terminate this Licence Agreement 11.1 The provider reserves the right to terminate this Licence Agreement
immediately by notice in writing against the user if the user is in breach of immediately by notice in writing against the user if the user is in breach of
any terms and conditions of this Licence Agreement. any terms and conditions of this Licence Agreement.
11.2 Termination of this Licence Agreement for any reason shall be without 11.2 Termination of this Licence Agreement for any reason shall be without
prejudice to any other rights or remedies of the provider which may have prejudice to any other rights or remedies of the provider which may have
arisen on or before the date of termination under this Licence Agreement or in arisen on or before the date of termination under this Licence Agreement or in
law. law.
11.3 The provisions of the following clauses shall survive any termination of 11.3 The provisions of the following clauses shall survive any termination of
this agreement; clause 3, 5, 10 and 13. this agreement; clause 3, 5, 10 and 13.
12 GENERAL 12 GENERAL
12.1 The provider reserves the right to transfer or assign all or any of its 12.1 The provider reserves the right to transfer or assign all or any of its
rights and duties and responsibilities set out in this Licence Agreement to rights and duties and responsibilities set out in this Licence Agreement to
another party. another party.
12.2 Headings have been included for convenience only and will not be used in 12.2 Headings have been included for convenience only and will not be used in
construing any provision of this Licence Agreement. construing any provision of this Licence Agreement.
12.3 No delay or failure by the provider to exercise any powers, rights or 12.3 No delay or failure by the provider to exercise any powers, rights or
remedies under this Licence Agreement will operate as a waiver of them nor remedies under this Licence Agreement will operate as a waiver of them nor
will any single or partial exercise of any such powers, rights or remedies will any single or partial exercise of any such powers, rights or remedies
include any other or further exercise of them. include any other or further exercise of them.
12.4 If any part of this Licence Agreement is found by a court of competent 12.4 If any part of this Licence Agreement is found by a court of competent
jurisdiction or other competent authority to be invalid, unlawful or jurisdiction or other competent authority to be invalid, unlawful or
unenforceable then such part shall be severed from the remainder of this unenforceable then such part shall be severed from the remainder of this
Licence Agreement which will continue to be valid and enforceable to the Licence Agreement which will continue to be valid and enforceable to the
fullest extent permitted by applicable law. fullest extent permitted by applicable law.
12.5 This Licence Agreement including the documents or other sources referred 12.5 This Licence Agreement including the documents or other sources referred
to herein supersede all prior representations, understandings and agreements to herein supersede all prior representations, understandings and agreements
between the user and the provider relating to the Loader and sets forth the between the user and the provider relating to the Loader and sets forth the
entire agreement and understanding between the user and the provider relating entire agreement and understanding between the user and the provider relating
to the Loader. to the Loader.
12.6 Nothing in this Licence Agreement shall be deemed to constitute a 12.6 Nothing in this Licence Agreement shall be deemed to constitute a
partnership between you and the provider nor constitute either party being an partnership between you and the provider nor constitute either party being an
agent of the other party. agent of the other party.
12.7 This Agreement does not create any rights or benefits enforceable by any 12.7 This Agreement does not create any rights or benefits enforceable by any
person not a party to it (within the meaning of the U.K.Contracts (Rights of person not a party to it (within the meaning of the U.K.Contracts (Rights of
Third Parties) Act 1999) except that a person who under clause 12.1 is a Third Parties) Act 1999) except that a person who under clause 12.1 is a
permitted successor or assignee of the rights or benefits of the provider may permitted successor or assignee of the rights or benefits of the provider may
enforce such rights or benefits. enforce such rights or benefits.
13 GOVERNING LAW AND JURISDICTION 13 GOVERNING LAW AND JURISDICTION
This License Agreement and any issues relating thereto shall be construed and This License Agreement and any issues relating thereto shall be construed and
interpreted in accordance with the laws of England and subject to the interpreted in accordance with the laws of England and subject to the
exclusive jurisdiction of the English courts. exclusive jurisdiction of the English courts.
Copyright (c) 2002-2017 ionCube Ltd. Last revised 23-April-2015 Copyright (c) 2002-2017 ionCube Ltd. Last revised 23-April-2015

View file

@ -1,164 +1,164 @@
<? <?
error_reporting(NULL); error_reporting(NULL);
session_start(); session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php"); include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
if (!function_exists('str_contains')) { if (!function_exists('str_contains')) {
function str_contains($haystack, $needle) function str_contains($haystack, $needle)
{ {
return $needle !== '' && mb_strpos($haystack, $needle) !== false; return $needle !== '' && mb_strpos($haystack, $needle) !== false;
} }
} }
// cidrMatch() based on https://stackoverflow.com/a/14535823 // cidrMatch() based on https://stackoverflow.com/a/14535823
function cidrMatch($ip, $range) function cidrMatch($ip, $range)
{ {
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) return false; if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) return false;
list($subnet, $bits) = explode('/', $range); list($subnet, $bits) = explode('/', $range);
$ip = substr(ipToBinary($ip), 0, $bits); $ip = substr(ipToBinary($ip), 0, $bits);
$subnet = substr(ipToBinary($subnet), 0, $bits); $subnet = substr(ipToBinary($subnet), 0, $bits);
return ($ip == $subnet); return ($ip == $subnet);
} }
// ipToBinary based on https://stackoverflow.com/a/14535823 // ipToBinary based on https://stackoverflow.com/a/14535823
function ipToBinary($ip) function ipToBinary($ip)
{ {
$ipbin = ''; $ipbin = '';
$ips = explode(".", $ip); $ips = explode(".", $ip);
foreach ($ips as $iptmp) { foreach ($ips as $iptmp) {
$ipbin .= sprintf("%08b", $iptmp); $ipbin .= sprintf("%08b", $iptmp);
} }
return $ipbin; return $ipbin;
} }
function fetchURL($url, &$info = []) function fetchURL($url, &$info = [])
{ {
$curl_handle = curl_init(); $curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_handle, CURLOPT_ENCODING, 'gzip, deflate'); curl_setopt($curl_handle, CURLOPT_ENCODING, 'gzip, deflate');
curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($curl_handle); $data = curl_exec($curl_handle);
$info = curl_getinfo($curl_handle); $info = curl_getinfo($curl_handle);
curl_close($curl_handle); curl_close($curl_handle);
return $data; return $data;
} }
function parseCacheEntries($strEntries) function parseCacheEntries($strEntries)
{ {
$parsed = []; $parsed = [];
$entries = explode("\n", $strEntries); $entries = explode("\n", $strEntries);
if ($entries) { if ($entries) {
foreach ($entries as $entry) { foreach ($entries as $entry) {
list($entry,) = explode("#", $entry); list($entry,) = explode("#", $entry);
list($entry,) = explode(";", $entry); list($entry,) = explode(";", $entry);
$entry = trim($entry); $entry = trim($entry);
if (!empty($entry)) $parsed[] = $entry; if (!empty($entry)) $parsed[] = $entry;
} }
} }
return $parsed; return $parsed;
} }
function checkIP($ip) function checkIP($ip)
{ {
$check_results = []; $check_results = [];
$lists = [ $lists = [
'BDEALL' => 'http://lists.blocklist.de/lists/all.txt', 'BDEALL' => 'http://lists.blocklist.de/lists/all.txt',
'BFB' => 'http://danger.rulez.sk/projects/bruteforceblocker/blist.php', 'BFB' => 'http://danger.rulez.sk/projects/bruteforceblocker/blist.php',
'CIARMY' => 'http://www.ciarmy.com/list/ci-badguys.txt', 'CIARMY' => 'http://www.ciarmy.com/list/ci-badguys.txt',
'GREENSNOW' => 'https://blocklist.greensnow.co/greensnow.txt', 'GREENSNOW' => 'https://blocklist.greensnow.co/greensnow.txt',
'SPAMDROP' => 'https://www.spamhaus.org/drop/drop.txt', 'SPAMDROP' => 'https://www.spamhaus.org/drop/drop.txt',
'SPAMEDROP' => 'https://www.spamhaus.org/drop/edrop.txt', 'SPAMEDROP' => 'https://www.spamhaus.org/drop/edrop.txt',
'TOR' => 'https://check.torproject.org/cgi-bin/TorBulkExitList.py', 'TOR' => 'https://check.torproject.org/cgi-bin/TorBulkExitList.py',
]; ];
$today = date('Y-m-d'); $today = date('Y-m-d');
foreach ($lists as $code => $url) { foreach ($lists as $code => $url) {
$cache_tag = 'ip-blacklist-' . $code . '-cache'; $cache_tag = 'ip-blacklist-' . $code . '-cache';
// init cache // init cache
if (!isset($_SESSION[$cache_tag])) $_SESSION[$cache_tag] = ['updated' => '', 'items' => [], 'http_code' => '']; if (!isset($_SESSION[$cache_tag])) $_SESSION[$cache_tag] = ['updated' => '', 'items' => [], 'http_code' => ''];
// invalidate cache if clear_cache parameter is 1 // invalidate cache if clear_cache parameter is 1
if (!empty($_REQUEST['clear_cache']) && $_REQUEST['clear_cache'] == 1) $_SESSION[$cache_tag]['updated'] = '2000-01-01'; if (!empty($_REQUEST['clear_cache']) && $_REQUEST['clear_cache'] == 1) $_SESSION[$cache_tag]['updated'] = '2000-01-01';
// if cache is not updated, fetch new data and save to cache // if cache is not updated, fetch new data and save to cache
if (strtotime($today) > strtotime($_SESSION[$cache_tag]['updated'])) { if (strtotime($today) > strtotime($_SESSION[$cache_tag]['updated'])) {
$new_cache_data = fetchURL($url, $url_result); $new_cache_data = fetchURL($url, $url_result);
if ($url_result['http_code'] == '200') $new_cache_items = parseCacheEntries($new_cache_data); if ($url_result['http_code'] == '200') $new_cache_items = parseCacheEntries($new_cache_data);
$_SESSION[$cache_tag] = ['updated' => $today, 'items' => $new_cache_items, 'http_code' => $url_result['http_code']]; $_SESSION[$cache_tag] = ['updated' => $today, 'items' => $new_cache_items, 'http_code' => $url_result['http_code']];
} }
// check ip // check ip
$matched_ips = array_filter($_SESSION[$cache_tag]['items'], function ($item) use ($ip) { $matched_ips = array_filter($_SESSION[$cache_tag]['items'], function ($item) use ($ip) {
if (str_contains($item, '/')) return cidrMatch($ip, $item); if (str_contains($item, '/')) return cidrMatch($ip, $item);
if ($ip == $item) return true; if ($ip == $item) return true;
return false; return false;
}); });
$check_results[$code]['found'] = count($matched_ips) > 0 ? true : false; $check_results[$code]['found'] = count($matched_ips) > 0 ? true : false;
$check_results[$code]['updated'] = $_SESSION[$cache_tag]['updated']; $check_results[$code]['updated'] = $_SESSION[$cache_tag]['updated'];
$check_results[$code]['http_code'] = $_SESSION[$cache_tag]['http_code']; $check_results[$code]['http_code'] = $_SESSION[$cache_tag]['http_code'];
} }
return $check_results; return $check_results;
} }
// Check token // Check token
if ((!isset($_REQUEST['token'])) || ($_SESSION['token'] != $_REQUEST['token'])) { if ((!isset($_REQUEST['token'])) || ($_SESSION['token'] != $_REQUEST['token'])) {
die("Wrong token"); die("Wrong token");
} }
$ip = $_REQUEST['ip']; $ip = $_REQUEST['ip'];
// Validate IP format // Validate IP format
if (filter_var($ip, FILTER_VALIDATE_IP) === false) { if (filter_var($ip, FILTER_VALIDATE_IP) === false) {
die('<strong>GENERAL ERROR</strong><br>BAD_IP_FORMAT'); die('<strong>GENERAL ERROR</strong><br>BAD_IP_FORMAT');
} }
// Query host // Query host
$host = gethostbyaddr($ip); $host = gethostbyaddr($ip);
// Query blocklists // Query blocklists
$result_blocklists = ''; $result_blocklists = '';
$ip_check = checkIP($ip); $ip_check = checkIP($ip);
if ($ip_check) { if ($ip_check) {
foreach ($ip_check as $list_code => $list_results) { foreach ($ip_check as $list_code => $list_results) {
$result_blocklists .= '<div title="'.$list_results['updated'].' / '.$list_results['http_code'].'">'; $result_blocklists .= '<div title="'.$list_results['updated'].' / '.$list_results['http_code'].'">';
$result_blocklists .= $list_results['found'] ? '<i class="fas fa-fw fa-exclamation-triangle"></i>' : '<i class="fas fa-fw fa-check-circle"></i>'; $result_blocklists .= $list_results['found'] ? '<i class="fas fa-fw fa-exclamation-triangle"></i>' : '<i class="fas fa-fw fa-check-circle"></i>';
$result_blocklists .= '&nbsp;<span>'.$list_code.'</span>&nbsp;'; $result_blocklists .= '&nbsp;<span>'.$list_code.'</span>&nbsp;';
$result_blocklists .= $list_results['http_code'] == '200' ? '' : '<i class="fas fa-fw fa-exclamation-circle"></i>'; $result_blocklists .= $list_results['http_code'] == '200' ? '' : '<i class="fas fa-fw fa-exclamation-circle"></i>';
$result_blocklists .= '</div>'; $result_blocklists .= '</div>';
} }
} }
// Query location // Query location
$url = 'https://api.db-ip.com/v2/free/'.$ip; $url = 'https://api.db-ip.com/v2/free/'.$ip;
$result = fetchURL($url); $result = fetchURL($url);
$result_array = json_decode($result, true); $result_array = json_decode($result, true);
if (!is_array($result_array)) { if (!is_array($result_array)) {
die('<strong>GENERAL ERROR</strong><br>BAD_JSON'); die('<strong>GENERAL ERROR</strong><br>BAD_JSON');
} }
if (!empty($result_array['errorCode'])) { if (!empty($result_array['errorCode'])) {
die('<strong>GENERAL ERROR</strong><br>'.$result_array['errorCode']); die('<strong>GENERAL ERROR</strong><br>'.$result_array['errorCode']);
} }
// Output // Output
echo " echo "
<dl> <dl>
<dt>".__('Host')."</dt> <dt>".__('Host')."</dt>
<dd>".$host."</dd> <dd>".$host."</dd>
<dt>".__('Banlist')."</dt> <dt>".__('Banlist')."</dt>
<dd>".$result_blocklists."</dd> <dd>".$result_blocklists."</dd>
<dt>".__('Continent')."</dt> <dt>".__('Continent')."</dt>
<dd>".$result_array['continentName']." [".$result_array['continentCode']."]</dd> <dd>".$result_array['continentName']." [".$result_array['continentCode']."]</dd>
<dt>".__('Country')."</dt> <dt>".__('Country')."</dt>
<dd>".$result_array['countryName']." [".$result_array['countryCode']."]</dd> <dd>".$result_array['countryName']." [".$result_array['countryCode']."]</dd>
<dt>".__('State / Province')."</dt> <dt>".__('State / Province')."</dt>
<dd>".$result_array['stateProv']." [".$result_array['stateProvCode']."]</dd> <dd>".$result_array['stateProv']." [".$result_array['stateProvCode']."]</dd>
<dt>".__('City / Locality')."</dt> <dt>".__('City / Locality')."</dt>
<dd>".$result_array['city']."</dd> <dd>".$result_array['city']."</dd>
</dl> </dl>
"; ";