Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions frontend/src/links/abuseipdb.ts
Original file line number Diff line number Diff line change
@@ -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}`)
}
}
2 changes: 2 additions & 0 deletions frontend/src/links/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -16,6 +17,7 @@ import {
} from './virustotal'

export const Links: LinkType[] = [
new AbuseIPDB(),
new AnyRun(),
new Browserling(),
new Crtsh(),
Expand Down
20 changes: 20 additions & 0 deletions frontend/tests/unit/links/abuseipdb.spec.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})
})