Skip to content

Commit

Permalink
Merge pull request #551 from ninoseki/revamp-hashdd
Browse files Browse the repository at this point in the history
refactor: revamp hashdd
  • Loading branch information
ninoseki authored Mar 4, 2021
2 parents e331cff + b34f11a commit bfc2b48
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
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

0 comments on commit bfc2b48

Please sign in to comment.