diff --git a/frontend/src/links/abuseipdb.ts b/frontend/src/links/abuseipdb.ts new file mode 100644 index 0000000..271f926 --- /dev/null +++ b/frontend/src/links/abuseipdb.ts @@ -0,0 +1,20 @@ +import type { IndicatorType, LinkType } from '@/schemas' +import { buildURL } from '@/utils' + +export class AbuseIPDB implements LinkType { + public baseURL: string + public favicon: string + public name: string + public type: IndicatorType + + public constructor() { + this.baseURL = 'https://www.abuseipdb.com/' + this.favicon = `https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=${this.baseURL}` + this.name = 'AbuseIPDB' + this.type = 'ip' + } + + public href(value: string): string { + return buildURL(this.baseURL, `/check/${value}`) + } +} diff --git a/frontend/src/links/index.ts b/frontend/src/links/index.ts index b99c763..dda4655 100644 --- a/frontend/src/links/index.ts +++ b/frontend/src/links/index.ts @@ -1,5 +1,6 @@ import type { LinkType } from '@/schemas' +import { AbuseIPDB } from './abuseipdb' import { AnyRun } from './anyrun' import { Browserling } from './browserling' import { Crtsh } from './crtsh' @@ -16,6 +17,7 @@ import { } from './virustotal' export const Links: LinkType[] = [ + new AbuseIPDB(), new AnyRun(), new Browserling(), new Crtsh(), diff --git a/frontend/tests/unit/links/abuseipdb.spec.ts b/frontend/tests/unit/links/abuseipdb.spec.ts new file mode 100644 index 0000000..a92e732 --- /dev/null +++ b/frontend/tests/unit/links/abuseipdb.spec.ts @@ -0,0 +1,20 @@ +import { describe, expect, it } from 'vitest' + +import { AbuseIPDB } from '@/links/abuseipdb' + +describe('AbuseIPDB', function () { + const subject = new AbuseIPDB() + + describe('#type', function () { + it('equals to ip_address', function () { + expect(subject.type).toEqual('ip') + }) + }) + + describe('#href', function () { + it('returns URL', function () { + const value = '1.1.1.1' + expect(subject.href(value)).toEqual('https://www.abuseipdb.com/check/1.1.1.1') + }) + }) +})