Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: revamp hashdd #551

Merged
merged 1 commit into from
Mar 4, 2021
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Mitaka is a browser extension for OSINT (open source intelligence) search which
| FortiGuard | https://fortiguard.com | IP, URL, CVE |
| Google Safe Browsing | https://transparencyreport.google.com | Domain, URL |
| GreyNoise | https://viz.greynoise.io | IP, domain, ASN, CVE |
| Hashdd | https://hashdd.com | IP, domain, hash |
| Hashdd | https://hashdd.com | Hash |
| Hurricane Electric | https://bgp.he.net/ | IP, domain, ASN |
| HybridAnalysis | https://www.hybrid-analysis.com | IP, domain, hash |
| Intelligence X | https://intelx.io | IP, domain, URL, email, BTC |
Expand Down
12 changes: 2 additions & 10 deletions src/searcher/hashdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,18 @@ import { buildURL } from "@/url_builder";
export class Hashdd implements Searcher {
public baseURL: string;
public name: string;
public supportedTypes: SearchableType[] = ["ip", "domain", "hash"];
public supportedTypes: SearchableType[] = ["hash"];

public constructor() {
this.baseURL = "https://hashdd.com";
this.name = "Hashdd";
}

public searchByIP(query: string): string {
return this.search(query);
}

public searchByDomain(query: string): string {
return this.search(query);
}

public searchByHash(query: string): string {
return this.search(query);
}

private search(query: string): string {
return buildURL(this.baseURL, `/i/${query}`);
return buildURL(this.baseURL, `/search/${query}`);
}
}
20 changes: 2 additions & 18 deletions test/searcher/hashdd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,14 @@ describe("Hashdd", function () {
const subject = new Hashdd();

it("should support ip, domain and hash", function () {
expect(subject.supportedTypes).to.deep.equal(["ip", "domain", "hash"]);
});

describe("#searchByIP", function () {
const ip = "1.1.1.1";
it("should return a URL", function () {
expect(subject.searchByIP(ip)).to.equal(`https://hashdd.com/i/${ip}`);
});
});

describe("#searchByDomain", function () {
const domain = "github.com";
it("should return a URL", function () {
expect(subject.searchByDomain(domain)).to.equal(
`https://hashdd.com/i/${domain}`
);
});
expect(subject.supportedTypes).to.deep.equal(["hash"]);
});

describe("#searchByHash", function () {
const hash = "44d88612fea8a8f36de82e1278abb02f";
it("should return a URL", function () {
expect(subject.searchByHash(hash)).to.equal(
`https://hashdd.com/i/${hash}`
`https://hashdd.com/search/${hash}`
);
});
});
Expand Down