Skip to content

Commit eefaca1

Browse files
authored
v0.9.15
2 parents 623a64f + 2b905b1 commit eefaca1

17 files changed

+276
-154
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_*
22
.old*
3-
vendor/*
3+
vendor/*
4+
dist/*

bin/abuseipdb

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,54 +14,48 @@
1414
* For the full copyright and license information, please view the LICENSE
1515
* file that was distributed with this source code.
1616
*
17-
* @version 0.9.14
17+
* @version 0.9.15
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020

2121
use Kristuff\AbuseIPDB\AbuseIPDBClient;
2222

2323
/**
24-
* Autoloading (depending on install directory)
24+
* Autoloading and locate config (depending on install directory)
2525
*
26-
* 1/ Installed with create-project abuseipdb-client
26+
* 1/ Project installed with git clone or create-project abuseipdb-cli:
27+
* bin and config folder at same level
2728
*
28-
* project
29-
* |_ bin
30-
* xxx symlink
31-
* |_ config
32-
* |_ vendor
33-
* |_ kristuff
34-
* |_ abusedipdb-cli
35-
* |_ bin
36-
* xxx <- me
29+
* ~/abuseipdb-cli/
30+
* |_ bin/
31+
* xxx <- me
32+
* |_ config/
33+
* |_ vendor/
3734
*
38-
* 2/ installed with git clone or create-project abuseipdb-cli
39-
* bin and config folder as same level
35+
* 2/ In case the .deb package is installed, config folder
36+
* is located in /etc/abuseipdb-client and main library in
37+
* /usr/lib/abuseipdb-client
4038
*
41-
* project
42-
* |_ bin
39+
* /usr/lib/abuseipdb-client/
40+
* |_ bin/
4341
* xxx <- me
44-
* |_ config
45-
* |_ vendor
42+
* |_ vendor/
43+
44+
* /etc/abuseipdb-client/
45+
* conf...
4646
*
4747
*/
4848

49-
// 2/ git clone or create-project abuseipdb-cli
49+
// 1/ git clone or create-project abuseipdb-cli
5050
$autoloadPath = realpath(__DIR__) .'/../vendor/autoload.php';
51-
$keyPath = realpath(__DIR__) .'/../config/key.json';
52-
53-
// test for 1/
54-
$parentDirectory = dirname(get_included_files()[0], 2);
55-
$subParentDirectory = dirname(get_included_files()[0], 3);
56-
$vendorDirectory = dirname(get_included_files()[0], 4); // should be vendor
51+
$configPath = realpath(__DIR__) .'/../config';
5752

58-
if (pathinfo($parentDirectory, PATHINFO_BASENAME) === 'abuseipdb-cli' &&
59-
pathinfo($subParentDirectory, PATHINFO_BASENAME) === 'kristuff' &&
60-
pathinfo($vendorDirectory, PATHINFO_BASENAME) === 'vendor') {
53+
// test for 2/
54+
$globalConfPath = '/etc/abuseipdb-client';
55+
if (file_exists($globalConfPath) && is_dir($globalConfPath)){
56+
$configPath = $globalConfPath;
57+
}
6158

62-
$keyPath = $vendorDirectory . '/../config/key.json';
63-
$autoloadPath = $vendorDirectory .'/autoload.php';
64-
};
6559

6660
require_once $autoloadPath;
6761

@@ -70,7 +64,7 @@ AbuseIPDBClient::start(
7064
AbuseIPDBClient::SHORT_ARGUMENTS,
7165
AbuseIPDBClient::LONG_ARGUMENTS
7266
),
73-
$keyPath
67+
$configPath
7468
);
7569

7670
?>

composer.lock

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/conf.ini

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; _ ___ ___ ___ ___
2+
; __ _| |__ _ _ ___ ___|_ _| _ \ \| _ )
3+
; / _` | '_ \ || (_-</ -_)| || _/ |) | _ \
4+
; \__,_|_.__/\_,_/__/\___|___|_| |___/|___/
5+
;
6+
; Kristuff\AbuseIPDB-client configuration file.
7+
; v0.9.15 | (c) Kristuff <[email protected]>
8+
9+
; -----------------------------------------------------------
10+
; WARNING: In most of the cases you should not modify this
11+
; file, but provide customizations in a local.ini
12+
; file under this directory. In case package is
13+
; installed globally, this prevents to lost changes
14+
; during update.
15+
; -----------------------------------------------------------
16+
17+
18+
[common]
19+
; api_key:
20+
; Your api key on abuseipdb.com (mandatory)
21+
;
22+
; Example:
23+
; api_key= "1234"
24+
api_key=
25+
26+
[report]
27+
; self_ips:
28+
; Represents the ips or domain list to exclude from report messages (email address are already removed)
29+
; List MUST be comma separated and MAY comtain spaces. Order does matter for subdomains.
30+
;
31+
; Example:
32+
; self_ips= "xx9999.ip-256-256-256.xx ,256.256.256.256, subdomain.example.com,example.com, example"
33+
self_ips=

config/config.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

config/key.sample.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

config/self_ips.sample.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

create_package.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ rm -rf debian
88
mkdir -p debian/DEBIAN
99
mkdir -p debian/usr/lib/abuseipdb-client
1010
mkdir -p debian/usr/share/doc/abuseipdb-client
11-
# it's planned to use text files, instead of json
12-
# for config and properly place them in /etc
13-
# mkdir -p debian/etc/abuseipdb-client
11+
mkdir -p debian/etc/abuseipdb-client
1412

1513
# populate the debian directory
1614
cp deb/control debian/DEBIAN
1715
cp deb/postinst.sh debian/DEBIAN/postinst
1816
cp deb/prerm.sh debian/DEBIAN/prerm
17+
cp config/conf.ini debian/etc/abuseipdb-client
1918
cp deb/copyright debian/usr/share/doc/abuseipdb-client
2019
cp LICENSE debian/usr/lib/abuseipdb-client
2120
cp -R bin debian/usr/lib/abuseipdb-client
22-
cp -R config debian/etc/lib/abuseipdb-client
2321
cp -R src debian/usr/lib/abuseipdb-client
2422
cp -R vendor debian/usr/lib/abuseipdb-client
2523

deb/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: abuseipdb-client
2-
Version: 0.9.14
2+
Version: 0.9.15
33
Maintainer: kristuff <[email protected]>
44
Architecture: all
55
Depends: php, php-curl

0 commit comments

Comments
 (0)