Skip to content

Commit 87147b9

Browse files
authored
v0.9.11
**Changed** - **fixed** strict type exceptions (v0.9.10 is broken) - **fixed** empty json in blacklist
2 parents afece83 + 45a36c1 commit 87147b9

10 files changed

+24
-23
lines changed

bin/abuseipdb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* For the full copyright and license information, please view the LICENSE
1616
* file that was distributed with this source code.
1717
*
18-
* @version 0.9.10
18+
* @version 0.9.11
1919
* @copyright 2020-2021 Kristuff
2020
*/
2121

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "kristuff/abuseipdb-cli",
33
"description": "A CLI tool to check/report IP addresses with AbuseIPDB API V2",
4+
"keywords": ["abuseIPDB", "API", "Client"],
45
"type": "library",
56
"license": "MIT",
67
"authors": [

src/AbstractClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;
@@ -42,7 +42,7 @@ abstract class AbstractClient extends ShellErrorHandler
4242
/**
4343
* @var string
4444
*/
45-
const VERSION = 'v0.9.10';
45+
const VERSION = 'v0.9.11';
4646

4747
/**
4848
* @var QuietApiHandler

src/AbuseIPDBClient.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;
@@ -170,7 +170,7 @@ protected static function printHelp(): void
170170
Console::log(Console::text(' -C, --check ', 'white') . Console::text('IP', 'yellow', 'underline'));
171171
Console::log(' Performs a check request for the given IP address. A valid IPv4 or IPv6 address is required.', 'lightgray');
172172
Console::log();
173-
Console::log(Console::text(' -K, --check-block ', 'white') . Console::text('network', 'yellow', 'underline'));
173+
Console::log(Console::text(' -K, --check-block ', 'white') . Console::text('NETWORK', 'yellow', 'underline'));
174174
Console::log(' Performs a check-block request for the given network. A valid subnet (v4 or v6) denoted with ', 'lightgray');
175175
Console::log(' CIDR notation is required.', 'lightgray');
176176
Console::log();
@@ -223,7 +223,7 @@ protected static function printHelp(): void
223223
Console::log(' Prints the current version. If given, all next arguments are ignored.', 'lightgray');
224224
Console::log();
225225
Console::log(Console::text(' -S, --save-key ', 'white') . Console::text('KEY', 'yellow', 'underline'));
226-
Console::log(' Save the given API key in the configuration file. Required writing permissions on the config directory. ', 'lightgray');
226+
Console::log(' Save the given API key in the configuration file. Requires writing permissions on the config directory. ', 'lightgray');
227227
Console::log();
228228
}
229229

@@ -471,7 +471,7 @@ protected static function getBlacklist(array $arguments): void
471471
{
472472
self::printTitle(Console::text(' ► Get Blacklist ', 'darkgray'));
473473

474-
$plainText = self::$outputFormat === self::OUTPUT_PLAINTEXT;
474+
$plainText = (self::$outputFormat === self::OUTPUT_PLAINTEXT);
475475
$limit = self::getNumericParameter($arguments,'l', 'limit', 1000);
476476
$scoreMin = self::getNumericParameter($arguments,'s', 'score', 100);
477477

@@ -495,7 +495,7 @@ protected static function getBlacklist(array $arguments): void
495495
// ✓ Done: print deleted report number
496496
switch (self::$outputFormat){
497497
case self::OUTPUT_JSON:
498-
echo json_encode($response, JSON_PRETTY_PRINT);
498+
echo json_encode($decodedResponse, JSON_PRETTY_PRINT);
499499
break;
500500

501501
case self::OUTPUT_DEFAULT:

src/BulkReportTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;

src/CheckBlockTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;

src/CheckTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;

src/ShellErrorHandler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;
@@ -39,7 +39,7 @@ abstract class ShellErrorHandler extends ShellUtils
3939
*
4040
* @return bool
4141
*/
42-
protected static function hasErrors(object $response, bool $checkForEmpty = true): bool
42+
protected static function hasErrors(?object $response = null, bool $checkForEmpty = true): bool
4343
{
4444
return $checkForEmpty ? self::parseErrors($response) || self::checkForEmpty($response) : self::parseErrors($response);
4545
}
@@ -54,7 +54,7 @@ protected static function hasErrors(object $response, bool $checkForEmpty = true
5454
*
5555
* @return bool
5656
*/
57-
private static function parseErrors(object $response): bool
57+
private static function parseErrors(?object $response = null): bool
5858
{
5959
if (isset($response) && isset($response->errors)){
6060
switch (self::$outputFormat){
@@ -235,7 +235,7 @@ private static function getErrorDetail(object $error, string $field, ?string $pa
235235
*
236236
* @return bool
237237
*/
238-
protected static function checkForEmpty(object $response): bool
238+
protected static function checkForEmpty(?object $response = null): bool
239239
{
240240
// check for empty response ?
241241
if ( empty($response) || empty($response->data) ){

src/ShellUtils.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;
@@ -125,10 +125,6 @@ protected static function clearTempMessage(): void
125125
protected static function printLogo(): void
126126
{
127127
if (self::isDefaultOuput()) {
128-
//Console::log(" _ _ _ __ __ ", "darkgray");
129-
//Console::log(" | |___ _(_)__| |_ _ _ / _|/ _| ", "darkgray");
130-
//Console::log(" | / / '_| (_-< _| || | _| _| ", "darkgray");
131-
//Console::log(" |_\_\_| |_/__/\__|\_,_|_| |_| ", "darkgray");
132128
Console::log(" _ ___ ___ ___ ___ ", "darkgray");
133129
Console::log(" __ _| |__ _ _ ___ ___|_ _| _ \ \| _ ) ", "darkgray");
134130
Console::log(" / _` | '_ \ || (_-</ -_)| || _/ |) | _ \ ", "darkgray");
@@ -177,7 +173,11 @@ protected static function printBanner(): void
177173
if (self::isDefaultOuput()) {
178174
Console::log();
179175
Console::log( Console::text(' Kristuff/AbuseIPDB-client ', 'darkgray') . Console::text(' ' . AbuseIPDBClient::VERSION . ' ', 'white', 'blue'));
180-
Console::log(Console::text(' Made with ', 'darkgray') . Console::text('', 'red') . Console::text(' in France | © 2020-2021 Kristuff', 'darkgray'));
176+
Console::log(Console::text(' Made with ', 'darkgray') . Console::text('', 'red') . Console::text(' in France', 'darkgray'));
177+
Console::log(Console::text(' © 2020-2021 Kristuff (', 'darkgray').
178+
Console::text('https://github.com/kristuff', 'darkgray', 'underlined').
179+
Console::text(')', 'darkgray')
180+
);
181181
Console::log();
182182
}
183183
}
@@ -258,7 +258,7 @@ protected static function getScoreBadge(int $score, string $padding = ' '): stri
258258
$scoreBackgroundColor = 'red';
259259
}
260260

261-
$badge = str_pad($score, 3, ' ',STR_PAD_LEFT);
261+
$badge = str_pad(strval($score), 3, ' ',STR_PAD_LEFT);
262262
return Console::text($padding.$badge.$padding, $scoreforegroundColor, $scoreBackgroundColor);
263263
}
264264
}

src/UtilsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
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.10
17+
* @version 0.9.11
1818
* @copyright 2020-2021 Kristuff
1919
*/
2020
namespace Kristuff\AbuseIPDB;

0 commit comments

Comments
 (0)