Skip to content

Commit 623a64f

Browse files
authored
v0.9.14
2 parents e35499d + 59395a8 commit 623a64f

16 files changed

+150
-68
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
tests/ export-ignore
22
vendor/ export-ignore
33
doc/ export-ignore
4+
deb/ export-ignore
5+
create_package.sh export-ignore
46
.gitattributes export-ignore
57
.gitignore export-ignore
68
.travis.yml export-ignore

bin/abuseipdb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
<?php
33

44
/**
5-
* _ _ ___ ____ ____ ____
6-
* / \ | |__ _ _ ___ ___|_ _| _ \| _ \| __ )
7-
* / _ \ | '_ \| | | / __|/ _ \| || |_) | | | | _ \
8-
* / ___ \| |_) | |_| \__ \ __/| || __/| |_| | |_) |
9-
* /_/ \_\_.__/ \__,_|___/\___|___|_| |____/|____/
10-
*
5+
* _ ___ ___ ___ ___
6+
* __ _| |__ _ _ ___ ___|_ _| _ \ \| _ )
7+
* / _` | '_ \ || (_-</ -_)| || _/ |) | _ \
8+
* \__,_|_.__/\_,_/__/\___|___|_| |___/|___/
9+
*
1110
* This file is part of Kristuff\AbuseIPDB.
1211
*
1312
* (c) Kristuff <[email protected]>
1413
*
1514
* For the full copyright and license information, please view the LICENSE
1615
* file that was distributed with this source code.
1716
*
18-
* @version 0.9.13
17+
* @version 0.9.14
1918
* @copyright 2020-2021 Kristuff
2019
*/
2120

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kristuff/abuseipdb-cli",
3-
"description": "A CLI tool to check/report IP addresses with AbuseIPDB API V2",
3+
"description": "A CLI tool to check/report IP addresses, download blacklist with AbuseIPDB API V2",
44
"keywords": ["abuseIPDB", "API", "Client"],
55
"type": "library",
66
"license": "MIT",
@@ -15,7 +15,7 @@
1515
"require": {
1616
"php": ">=7.1",
1717
"kristuff/mishell": "^1.5-stable",
18-
"kristuff/abuseipdb": "^0.9.12-stable"
18+
"kristuff/abuseipdb": "^0.9.13-stable"
1919
},
2020
"bin": [
2121
"bin/abuseipdb"

create_package.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
# our dist directory
4+
mkdir -p dist
5+
6+
# create a clean debian package directory
7+
rm -rf debian
8+
mkdir -p debian/DEBIAN
9+
mkdir -p debian/usr/lib/abuseipdb-client
10+
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
14+
15+
# populate the debian directory
16+
cp deb/control debian/DEBIAN
17+
cp deb/postinst.sh debian/DEBIAN/postinst
18+
cp deb/prerm.sh debian/DEBIAN/prerm
19+
cp deb/copyright debian/usr/share/doc/abuseipdb-client
20+
cp LICENSE debian/usr/lib/abuseipdb-client
21+
cp -R bin debian/usr/lib/abuseipdb-client
22+
cp -R config debian/etc/lib/abuseipdb-client
23+
cp -R src debian/usr/lib/abuseipdb-client
24+
cp -R vendor debian/usr/lib/abuseipdb-client
25+
26+
# Packages should't be updated manually, do not deploy composer files.
27+
#cp composer.json debian/usr/lib/abuseipdb-client
28+
#cp composer.lock debian/usr/lib/abuseipdb-client
29+
30+
# adjust ownerships
31+
chown -R root:root debian
32+
chmod -R 0755 debian/usr/lib/abuseipdb-client
33+
34+
# minimal permissions required for scripts
35+
chmod 755 debian/DEBIAN/postinst
36+
chmod 755 debian/DEBIAN/prerm
37+
38+
# finally build the package
39+
dpkg-deb --build debian dist

deb/control

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Package: abuseipdb-client
2+
Version: 0.9.14
3+
Maintainer: kristuff <[email protected]>
4+
Architecture: all
5+
Depends: php, php-curl
6+
Description: CLI tool to check, report IP address, download blacklists with AbuseIPDB API v2
7+
Priority: optional
8+
Section: utils

deb/copyright

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Upstream-Name: AbuseIPDB-client
3+
Upstream-Contact: kristuff <[email protected]>
4+
5+
Files: *
6+
Copyright: 2020-2021 Kristuff <[email protected]>
7+
License: MIT License
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
.
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
.
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.

deb/postinst.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
4+
# client
5+
echo "Deploying abuseipdb-client ..."
6+
7+
ln -s /usr/lib/abuseipdb-client/bin/abuseipdb /usr/bin/abuseipdb
8+
9+
if [ $? -eq 0 ]; then
10+
echo "Created symlink /usr/bin/abuseipdb → /usr/lib/abuseipdb-client/bin/abuseipdb."
11+
else
12+
echo "[Error] Unable to create symlink /usr/bin/abuseipdb."
13+
fi
14+

deb/prerm.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
echo "Removing abuseipdb-client from /usr/bin ..."
4+
\rm -f /usr/bin/abuseipdb

src/AbstractClient.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php declare(strict_types=1);
22

33
/**
4-
* _ _ ___ ____ ____ ____
5-
* / \ | |__ _ _ ___ ___|_ _| _ \| _ \| __ )
6-
* / _ \ | '_ \| | | / __|/ _ \| || |_) | | | | _ \
7-
* / ___ \| |_) | |_| \__ \ __/| || __/| |_| | |_) |
8-
* /_/ \_\_.__/ \__,_|___/\___|___|_| |____/|____/
9-
*
4+
* _ ___ ___ ___ ___
5+
* __ _| |__ _ _ ___ ___|_ _| _ \ \| _ )
6+
* / _` | '_ \ || (_-</ -_)| || _/ |) | _ \
7+
* \__,_|_.__/\_,_/__/\___|___|_| |___/|___/
8+
*
109
* This file is part of Kristuff\AbuseIPDB.
1110
*
1211
* (c) Kristuff <[email protected]>
1312
*
1413
* For the full copyright and license information, please view the LICENSE
1514
* file that was distributed with this source code.
1615
*
17-
* @version 0.9.13
16+
* @version 0.9.14
1817
* @copyright 2020-2021 Kristuff
1918
*/
2019
namespace Kristuff\AbuseIPDB;
@@ -42,7 +41,7 @@ abstract class AbstractClient extends ShellErrorHandler
4241
/**
4342
* @var string
4443
*/
45-
const VERSION = 'v0.9.13';
44+
const VERSION = 'v0.9.14';
4645

4746
/**
4847
* @var QuietApiHandler

src/AbuseIPDBClient.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php declare(strict_types=1);
22

33
/**
4-
* _ _ ___ ____ ____ ____
5-
* / \ | |__ _ _ ___ ___|_ _| _ \| _ \| __ )
6-
* / _ \ | '_ \| | | / __|/ _ \| || |_) | | | | _ \
7-
* / ___ \| |_) | |_| \__ \ __/| || __/| |_| | |_) |
8-
* /_/ \_\_.__/ \__,_|___/\___|___|_| |____/|____/
9-
*
4+
* _ ___ ___ ___ ___
5+
* __ _| |__ _ _ ___ ___|_ _| _ \ \| _ )
6+
* / _` | '_ \ || (_-</ -_)| || _/ |) | _ \
7+
* \__,_|_.__/\_,_/__/\___|___|_| |___/|___/
8+
*
109
* This file is part of Kristuff\AbuseIPDB.
1110
*
1211
* (c) Kristuff <[email protected]>
1312
*
1413
* For the full copyright and license information, please view the LICENSE
1514
* file that was distributed with this source code.
1615
*
17-
* @version 0.9.13
16+
* @version 0.9.14
1817
* @copyright 2020-2021 Kristuff
1918
*/
2019
namespace Kristuff\AbuseIPDB;
@@ -78,8 +77,8 @@ protected static function registerApiKey($arguments): void
7877
}
7978

8079
$data = json_encode(['api_key' => $key]);
81-
82-
if (file_put_contents(self::$keyPath, $data, LOCK_EX) === false){
80+
81+
if (@file_put_contents(self::$keyPath, $data, LOCK_EX) === false){
8382
self::error('An error occurred when writing config file. Make sure to give the appropriate permissions to the config directory.');
8483
self::printFooter();
8584
Program::exit(1);

0 commit comments

Comments
 (0)