@profullstack/nichedb 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +19 -6
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { homedir, tmpdir } from 'node:os';
|
|
|
15
15
|
import { join } from 'node:path';
|
|
16
16
|
import { createInterface } from 'node:readline';
|
|
17
17
|
|
|
18
|
-
export const VERSION = '0.
|
|
18
|
+
export const VERSION = '0.41.0';
|
|
19
19
|
const GEO_FLAGS = ['lat', 'long', 'radius', 'unit', 'bbox', 'sort', 'offset'];
|
|
20
20
|
const DEFAULT_API = process.env.NICHEDB_API ?? 'https://nichedb.dev';
|
|
21
21
|
const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'nichedb');
|
|
@@ -240,15 +240,24 @@ export const COMMANDS = [
|
|
|
240
240
|
name: 'reputation',
|
|
241
241
|
usage: 'reputation <ip-or-domain>',
|
|
242
242
|
summary:
|
|
243
|
-
'Is an IP or a domain on a blocklist? nichedb /traffic (human-reviewed bans), abuse.ch malware feeds and
|
|
243
|
+
'Is an IP or a domain on a blocklist? nichedb /traffic (human-reviewed bans), abuse.ch malware feeds, SURBL and live DNS blocklists (Spamhaus ZEN/DBL, SpamCop, PSBL, Mailspike, URIBL) in one answer; a domain is also checked on each address it resolves to. Exits 1 when listed.',
|
|
244
244
|
options: ['--json'],
|
|
245
245
|
},
|
|
246
246
|
{
|
|
247
247
|
name: 'traffic',
|
|
248
|
-
usage: 'traffic [<ip>] [--days <n>] [--category <c>] [--txt]',
|
|
248
|
+
usage: 'traffic [<ip>] [--days <n>] [--category <c>] [--txt|--rpz|--rbldnsd]',
|
|
249
249
|
summary:
|
|
250
250
|
'The human-reviewed /traffic IP blocklist: newest approvals, one address, or --txt for a fail2ban/nftables-ready list. Exits 1 when an address is listed.',
|
|
251
|
-
options: [
|
|
251
|
+
options: [
|
|
252
|
+
'--days <n>',
|
|
253
|
+
'--category <c>',
|
|
254
|
+
'--limit <n>',
|
|
255
|
+
'--offset <n>',
|
|
256
|
+
'--txt',
|
|
257
|
+
'--rpz',
|
|
258
|
+
'--rbldnsd',
|
|
259
|
+
'--json',
|
|
260
|
+
],
|
|
252
261
|
},
|
|
253
262
|
{
|
|
254
263
|
name: 'profiles',
|
|
@@ -1072,6 +1081,9 @@ export async function run(
|
|
|
1072
1081
|
}
|
|
1073
1082
|
out(`${r.query}: ${r.listed ? `LISTED, score ${r.score}/100` : 'not listed'}`);
|
|
1074
1083
|
for (const reason of r.reasons) out(` ${reason}`);
|
|
1084
|
+
for (const a of r.addresses ?? [])
|
|
1085
|
+
out(` resolves to ${a.ip}: ${a.listed ? 'LISTED' : 'not listed'}`);
|
|
1086
|
+
if (r.unknown?.length) out(` could not ask: ${r.unknown.join(', ')}`);
|
|
1075
1087
|
if (r.note) out(` ${r.note}`);
|
|
1076
1088
|
out(` checked: ${r.checked.map((c) => c.name).join('; ')}`);
|
|
1077
1089
|
out(` deeper: ${r.deeper.url}`);
|
|
@@ -1091,8 +1103,9 @@ export async function run(
|
|
|
1091
1103
|
);
|
|
1092
1104
|
return r.listed ? 1 : 0;
|
|
1093
1105
|
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1106
|
+
const format = flags.rpz ? 'rpz' : flags.rbldnsd ? 'rbldnsd' : flags.txt ? 'txt' : null;
|
|
1107
|
+
if (format) {
|
|
1108
|
+
out(await client.text(`/traffic/blocklist.${format}${qs.size ? `?${qs}` : ''}`));
|
|
1096
1109
|
return 0;
|
|
1097
1110
|
}
|
|
1098
1111
|
const r = await client.get(`/api/v1/traffic${qs.size ? `?${qs}` : ''}`);
|