Skip to content

Commit

Permalink
refactor: apply formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Feb 3, 2024
1 parent 5a20f6e commit e2e4b90
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 128 deletions.
2 changes: 1 addition & 1 deletion backend/api/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter

from backend.api.endpoints import analyze, submit, lookup
from backend.api.endpoints import analyze, lookup, submit

api_router = APIRouter()
api_router.include_router(analyze.router, prefix="/analyze", tags=["analyze"])
Expand Down
2 changes: 1 addition & 1 deletion backend/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def cast_optional_str(v: typing.Any | None) -> str | None:

@contextmanager
def _get_optional_redis(
redis_url: str | None = cast_optional_str(settings.REDIS_URL)
redis_url: str | None = cast_optional_str(settings.REDIS_URL),
) -> typing.Generator[Redis | None, None, None]:
if redis_url is None:
yield None
Expand Down
2 changes: 1 addition & 1 deletion backend/factories/eml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from hashlib import sha256
from io import BytesIO
from typing import Any
from hashlib import sha256

import arrow
import dateparser
Expand Down
1 change: 0 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def create_app():

# add routes
app.include_router(api_router, prefix="/api")
app.mount("/assets", StaticFiles(directory="frontend/dist/assets"), name="assets")
app.mount("/", StaticFiles(html=True, directory="frontend/dist/"), name="index")

return app
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/links/emailrep.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IndicatorType,Link } from '@/types'
import type { IndicatorType, Link } from '@/types'

export class EmailRep implements Link {
public baseURL: string
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/shims-tsx.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Vue, { VNode } from "vue"
import Vue, { VNode } from 'vue'

declare global {
namespace JSX {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module "*.vue" {
import Vue from "vue"
declare module '*.vue' {
import Vue from 'vue'
export default Vue
}
98 changes: 49 additions & 49 deletions frontend/tests/unit/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,78 @@
import { Header } from "@/types"
import { Header } from '@/types'

export const header: Header = {
messageId: "test",
subject: "test",
messageId: 'test',
subject: 'test',
defect: undefined,
from: "[email protected]",
to: ["[email protected]"],
from: '[email protected]',
to: ['[email protected]'],
cc: [],
date: "2020-06-26T19:01:46+09:00",
date: '2020-06-26T19:01:46+09:00',
receivedEmail: undefined,
receivedForemail: ["[email protected]"],
receivedDomain: ["[email protected]"],
receivedIp: ["1.1.1.1"],
receivedForemail: ['[email protected]'],
receivedDomain: ['[email protected]'],
receivedIp: ['1.1.1.1'],
receivedSrc: undefined,
received: [
{
by: ["mx.google.com"],
date: "2020-06-26T03:01:53-07:00",
for: ["[email protected]"],
from: ["bmmph0401.jpx1.mta.foo.com", "1.1.1.1"],
src: "from bmmph0401.jpx1.mta.foo.com (bmmph0401.jpx1.mta.foo.com. [1.1.1.1]) by mx.google.com with esmtps id t23si17369479plr.47.2020.06.26.03.01.52 for <[email protected]> (version=tls1_2 cipher=ecdhe-ecdsa-aes128-gcm-sha256 bits=128/128); fri, 26 jun 2020 03:01:53 -0700 (pdt)",
with: "esmtps id t23si17369479plr.47.2020.06.26.03.01.52",
by: ['mx.google.com'],
date: '2020-06-26T03:01:53-07:00',
for: ['[email protected]'],
from: ['bmmph0401.jpx1.mta.foo.com', '1.1.1.1'],
src: 'from bmmph0401.jpx1.mta.foo.com (bmmph0401.jpx1.mta.foo.com. [1.1.1.1]) by mx.google.com with esmtps id t23si17369479plr.47.2020.06.26.03.01.52 for <[email protected]> (version=tls1_2 cipher=ecdhe-ecdsa-aes128-gcm-sha256 bits=128/128); fri, 26 jun 2020 03:01:53 -0700 (pdt)',
with: 'esmtps id t23si17369479plr.47.2020.06.26.03.01.52',
delay: 0
},
{
by: ["2002:a67:d211:0:0:0:0:0"],
date: "2020-06-26T03:01:53-07:00",
by: ['2002:a67:d211:0:0:0:0:0'],
date: '2020-06-26T03:01:53-07:00',
for: [],
from: [],
src: "by 2002:a67:d211:0:0:0:0:0 with smtp id y17csp352571vsi; fri, 26 jun 2020 03:01:53 -0700 (pdt)",
with: "smtp id y17csp352571vsi",
src: 'by 2002:a67:d211:0:0:0:0:0 with smtp id y17csp352571vsi; fri, 26 jun 2020 03:01:53 -0700 (pdt)',
with: 'smtp id y17csp352571vsi',
delay: 0
}
],
header: {
"received-spf": [
"pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) client-ip=1.1.1.1;"
'received-spf': [
'pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) client-ip=1.1.1.1;'
],
"x-google-smtp-source": [
"ABdhPJynAuSfgxdlFyZKa8N4JPifULWPwMyWEKsHolJ8pNC9GERVBXeb4+L0MhU9oBo8rNc3zQSJ"
'x-google-smtp-source': [
'ABdhPJynAuSfgxdlFyZKa8N4JPifULWPwMyWEKsHolJ8pNC9GERVBXeb4+L0MhU9oBo8rNc3zQSJ'
],
"message-id": ["<[email protected]>"],
'message-id': ['<[email protected]>'],
received: [
"by 2002:a67:d211:0:0:0:0:0 with SMTP id y17csp352571vsi; Fri, 26 Jun 2020 03:01:53 -0700 (PDT)",
"from bmmph0401.jpx1.mta.foo.com (bmmph0401.jpx1.mta.foo.com. [1.1.1.1]) by mx.google.com with ESMTPS id t23si17369479plr.47.2020.06.26.03.01.52 for <[email protected]> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2020 03:01:53 -0700 (PDT)"
'by 2002:a67:d211:0:0:0:0:0 with SMTP id y17csp352571vsi; Fri, 26 Jun 2020 03:01:53 -0700 (PDT)',
'from bmmph0401.jpx1.mta.foo.com (bmmph0401.jpx1.mta.foo.com. [1.1.1.1]) by mx.google.com with ESMTPS id t23si17369479plr.47.2020.06.26.03.01.52 for <[email protected]> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jun 2020 03:01:53 -0700 (PDT)'
],
"return-path": ["<[email protected]>"],
precedence: ["bulk"],
"arc-message-signature": [
"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=precedence:content-transfer-encoding:mime-version:subject :message-id:to:from:date:errors-to:dkim-signature; bh=5X/o+J4YmAran7geSjikplGuCf5NG3YpI+9GzTfzt34=; b=jHiB2xk5BKONH9V1GWizSSG6Se6s7p0lFR6t8IGweC3mpoi5FCsLYRNorTFl8xi2NS qy1aQAbd66dzi6DwAlFiOu8o1FH2lELz8OOttGUmCR4sVm9SZM/wN4QBe5Ws+3EXviWa MypP71tqM2w0ZztyO0TdeIlP//K9nGMqBw8PTnXFU8fxJ/USDPPBWpDb36py6/xYJ4+E FhR9GPY+bRhSLT8PZ4diYw7EJkDe5oNw1HDGMlpjLU6r1sXpeKOiAezfaA5mBuQ5Uovc Pe+QiemKOo5kQFIVw7KcBaAwYAHw9EVa5CFW6OwXs4Wo2+e3W3m9C2HFvVYK5QG/V3q5 AUeg=="
'return-path': ['<[email protected]>'],
precedence: ['bulk'],
'arc-message-signature': [
'i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=precedence:content-transfer-encoding:mime-version:subject :message-id:to:from:date:errors-to:dkim-signature; bh=5X/o+J4YmAran7geSjikplGuCf5NG3YpI+9GzTfzt34=; b=jHiB2xk5BKONH9V1GWizSSG6Se6s7p0lFR6t8IGweC3mpoi5FCsLYRNorTFl8xi2NS qy1aQAbd66dzi6DwAlFiOu8o1FH2lELz8OOttGUmCR4sVm9SZM/wN4QBe5Ws+3EXviWa MypP71tqM2w0ZztyO0TdeIlP//K9nGMqBw8PTnXFU8fxJ/USDPPBWpDb36py6/xYJ4+E FhR9GPY+bRhSLT8PZ4diYw7EJkDe5oNw1HDGMlpjLU6r1sXpeKOiAezfaA5mBuQ5Uovc Pe+QiemKOo5kQFIVw7KcBaAwYAHw9EVa5CFW6OwXs4Wo2+e3W3m9C2HFvVYK5QG/V3q5 AUeg=='
],
"content-transfer-encoding": ["7bit"],
"arc-authentication-results": [
"i=1; mx.google.com; dkim=pass [email protected] header.s=excite.201701 header.b=CTe5NYEx; spf=pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) [email protected]; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=excite.jp"
'content-transfer-encoding': ['7bit'],
'arc-authentication-results': [
'i=1; mx.google.com; dkim=pass [email protected] header.s=excite.201701 header.b=CTe5NYEx; spf=pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) [email protected]; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=excite.jp'
],
"mime-version": ["1.0"],
"errors-to": ["[email protected]"],
"authentication-results": [
"mx.google.com; dkim=pass [email protected] header.s=excite.201701 header.b=CTe5NYEx; spf=pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) [email protected]; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=excite.jp"
'mime-version': ['1.0'],
'errors-to': ['[email protected]'],
'authentication-results': [
'mx.google.com; dkim=pass [email protected] header.s=excite.201701 header.b=CTe5NYEx; spf=pass (google.com: domain of [email protected] designates 1.1.1.1 as permitted sender) [email protected]; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=excite.jp'
],
"delivered-to": ["[email protected]"],
"x-received": [
"by 2002:aa7:9473:: with SMTP id t19mr1999753pfq.148.1593165713699; Fri, 26 Jun 2020 03:01:53 -0700 (PDT)"
'delivered-to': ['[email protected]'],
'x-received': [
'by 2002:aa7:9473:: with SMTP id t19mr1999753pfq.148.1593165713699; Fri, 26 Jun 2020 03:01:53 -0700 (PDT)'
],
from: ["エキサイトからのお知らせ <[email protected]>"],
"content-type": ['multipart/alternative; boundary="-44e2071d5e8e429d7d1dc98f76e0fb07-1"'],
"dkim-signature": [
"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1593165713;\ts=excite.201701; d=excite.jp;\th=Date:From:To:Message-Id:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding;\tbh=5X/o+J4YmAran7geSjikplGuCf5NG3YpI+9GzTfzt34=;\tb=CTe5NYExX5M1pLnI5ivQ9aFL9zzE79ruSCe1H/AnjaTYlYAW3ik3PrmRBJU0YKpC\tl6qA6aKNdWH7Yraj3e42jQ0Xvb5d3SCSPvDa1EzYDtXHhn8vRZ+HPh00WByfeExjrC8\t9nLaj30P4YODjvH8oCMc8z79mz0hdlEvRR+fsBGs="
from: ['エキサイトからのお知らせ <[email protected]>'],
'content-type': ['multipart/alternative; boundary="-44e2071d5e8e429d7d1dc98f76e0fb07-1"'],
'dkim-signature': [
'v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1593165713;\ts=excite.201701; d=excite.jp;\th=Date:From:To:Message-Id:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding;\tbh=5X/o+J4YmAran7geSjikplGuCf5NG3YpI+9GzTfzt34=;\tb=CTe5NYExX5M1pLnI5ivQ9aFL9zzE79ruSCe1H/AnjaTYlYAW3ik3PrmRBJU0YKpC\tl6qA6aKNdWH7Yraj3e42jQ0Xvb5d3SCSPvDa1EzYDtXHhn8vRZ+HPh00WByfeExjrC8\t9nLaj30P4YODjvH8oCMc8z79mz0hdlEvRR+fsBGs='
],
date: ["Fri, 26 Jun 2020 19:01:46 +0900"],
subject: ["foo"],
"arc-seal": [
"i=1; a=rsa-sha256; t=1593165713; cv=none; d=google.com; s=arc-20160816; b=xeegMa+rviltYXtidrs3Y0HQHa8kz/UtJlxXuqi0BJjH6x1i5T2fu6mvQZE2UXvckL NNr6mKB8M80RsMeyVTlgGBch4VJde/1eMQuu6D02h6voPYT3yY2zSh/ILUopEgEHiJdG hab2+Ai/iPkYl0qef+fUr78+ei06Ke2/9zepsKIgbM7sjOPnpkK5ISA5jR5q7cKGxzeU qiHLRYP9cYokw1SQ/LGhpFQ5oQo0IPbM8SleRPvrqNNUob4/7oFcwMIi73qHRrLz4aNw bcEmVmtfyzfU5o5ZoykWyuyCKKHQYjZH5pUdZci9fVtkHY7FnpVr/nPtVj9620iBHfMP dHOg=="
date: ['Fri, 26 Jun 2020 19:01:46 +0900'],
subject: ['foo'],
'arc-seal': [
'i=1; a=rsa-sha256; t=1593165713; cv=none; d=google.com; s=arc-20160816; b=xeegMa+rviltYXtidrs3Y0HQHa8kz/UtJlxXuqi0BJjH6x1i5T2fu6mvQZE2UXvckL NNr6mKB8M80RsMeyVTlgGBch4VJde/1eMQuu6D02h6voPYT3yY2zSh/ILUopEgEHiJdG hab2+Ai/iPkYl0qef+fUr78+ei06Ke2/9zepsKIgbM7sjOPnpkK5ISA5jR5q7cKGxzeU qiHLRYP9cYokw1SQ/LGhpFQ5oQo0IPbM8SleRPvrqNNUob4/7oFcwMIi73qHRrLz4aNw bcEmVmtfyzfU5o5ZoykWyuyCKKHQYjZH5pUdZci9fVtkHY7FnpVr/nPtVj9620iBHfMP dHOg=='
],
to: ["[email protected]"]
to: ['[email protected]']
}
}
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/anyrun.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { AnyRun } from "@/links/anyrun"
import { AnyRun } from '@/links/anyrun'

describe("AnyRun", function () {
describe('AnyRun', function () {
const subject = new AnyRun()

describe("#type", function () {
it("equals to sha256", function () {
expect(subject.type).toEqual("sha256")
describe('#type', function () {
it('equals to sha256', function () {
expect(subject.type).toEqual('sha256')
})
})

describe("#href", function () {
it("returns URL", function () {
const hash = "8a8f93a0a4e4a709d73695accb2af068"
describe('#href', function () {
it('returns URL', function () {
const hash = '8a8f93a0a4e4a709d73695accb2af068'
expect(subject.href(hash)).toEqual(
"https://app.any.run/submissions/#filehash:8a8f93a0a4e4a709d73695accb2af068"
'https://app.any.run/submissions/#filehash:8a8f93a0a4e4a709d73695accb2af068'
)
})
})
Expand Down
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/browserling.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { Browserling } from "@/links/browserling"
import { Browserling } from '@/links/browserling'

describe("Browserling", function () {
describe('Browserling', function () {
const subject = new Browserling()

describe("#type", function () {
it("equals to url", function () {
expect(subject.type).toEqual("url")
describe('#type', function () {
it('equals to url', function () {
expect(subject.type).toEqual('url')
})
})

describe("#href", function () {
it("returns URL", function () {
const hash = "http://example.com"
describe('#href', function () {
it('returns URL', function () {
const hash = 'http://example.com'
expect(subject.href(hash)).toEqual(
"https://www.browserling.com/browse/win/7/ie/11/http%3A%2F%2Fexample.com"
'https://www.browserling.com/browse/win/7/ie/11/http%3A%2F%2Fexample.com'
)
})
})
Expand Down
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/crtsh.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { Crtsh } from "@/links/crtsh"
import { Crtsh } from '@/links/crtsh'

describe("Crtsh", function () {
describe('Crtsh', function () {
const subject = new Crtsh()

describe("#type", function () {
it("equals to domain", function () {
expect(subject.type).toEqual("domain")
describe('#type', function () {
it('equals to domain', function () {
expect(subject.type).toEqual('domain')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "example.com"
expect(subject.href(value)).toEqual("https://crt.sh/?q=example.com")
describe('#href', function () {
it('returns URL', function () {
const value = 'example.com'
expect(subject.href(value)).toEqual('https://crt.sh/?q=example.com')
})
})
})
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/emailrep.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { EmailRep } from "@/links/emailrep"
import { EmailRep } from '@/links/emailrep'

describe("EmailRep", function () {
describe('EmailRep', function () {
const subject = new EmailRep()

describe("#type", function () {
it("equals to email", function () {
expect(subject.type).toEqual("email")
describe('#type', function () {
it('equals to email', function () {
expect(subject.type).toEqual('email')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "[email protected]"
expect(subject.href(value)).toEqual("https://emailrep.io/[email protected]")
describe('#href', function () {
it('returns URL', function () {
const value = '[email protected]'
expect(subject.href(value)).toEqual('https://emailrep.io/[email protected]')
})
})
})
18 changes: 9 additions & 9 deletions frontend/tests/unit/links/hybridanalysis.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { HybridAnalysis } from "@/links/hybridanalysis"
import { HybridAnalysis } from '@/links/hybridanalysis'

describe("HybridAanalysis", function () {
describe('HybridAanalysis', function () {
const subject = new HybridAnalysis()

describe("#type", function () {
it("equals to sha256", function () {
expect(subject.type).toEqual("sha256")
describe('#type', function () {
it('equals to sha256', function () {
expect(subject.type).toEqual('sha256')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"
describe('#href', function () {
it('returns URL', function () {
const value = '275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f'
expect(subject.href(value)).toEqual(`https://www.hybrid-analysis.com/search?query=${value}`)
})
})
Expand Down
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/inquest.spec.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { InQuest } from "@/links/inquest"
import { InQuest } from '@/links/inquest'

describe("InQuest", function () {
describe('InQuest', function () {
const subject = new InQuest()

describe("#type", function () {
it("equals to sha256", function () {
expect(subject.type).toEqual("sha256")
describe('#type', function () {
it('equals to sha256', function () {
expect(subject.type).toEqual('sha256')
})
})

describe("#href", function () {
it("returns URL", function () {
const hash = "8a8f93a0a4e4a709d73695accb2af068"
describe('#href', function () {
it('returns URL', function () {
const hash = '8a8f93a0a4e4a709d73695accb2af068'
expect(subject.href(hash)).toEqual(
"https://labs.inquest.net/dfi/sha256/8a8f93a0a4e4a709d73695accb2af068"
'https://labs.inquest.net/dfi/sha256/8a8f93a0a4e4a709d73695accb2af068'
)
})
})
Expand Down
20 changes: 10 additions & 10 deletions frontend/tests/unit/links/securitytrails.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { SecurityTrails } from "@/links/securitytrails"
import { SecurityTrails } from '@/links/securitytrails'

describe("SecurityTrails", function () {
describe('SecurityTrails', function () {
const subject = new SecurityTrails()

describe("#type", function () {
it("equals to domain", function () {
expect(subject.type).toEqual("domain")
describe('#type', function () {
it('equals to domain', function () {
expect(subject.type).toEqual('domain')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "example.com"
expect(subject.href(value)).toEqual("https://securitytrails.com/domain/example.com")
describe('#href', function () {
it('returns URL', function () {
const value = 'example.com'
expect(subject.href(value)).toEqual('https://securitytrails.com/domain/example.com')
})
})
})
Loading

0 comments on commit e2e4b90

Please sign in to comment.