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

feat: add Spyse lookup #355

Merged
merged 1 commit into from
Jan 5, 2020
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
1 change: 1 addition & 0 deletions src/lib/searcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export { SecurityTrails } from "./securitytrails";
export { Shodan } from "./shodan";
export { Sploitus } from "./sploitus";
export { SpyOnWeb } from "./spyonweb";
export { Spyse } from "./spyse";
export { Talos } from "./talos";
export { ThreatConnect } from "./threatconnect";
export { ThreatCrowd } from "./threatcrowd";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/searcher/searchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
Shodan,
Sploitus,
SpyOnWeb,
Spyse,
Talos,
ThreatConnect,
ThreatCrowd,
Expand Down Expand Up @@ -112,6 +113,7 @@ export const Searchers: Searcher[] = [
new Shodan(),
new Sploitus(),
new SpyOnWeb(),
new Spyse(),
new Talos(),
new ThreatConnect(),
new ThreatCrowd(),
Expand Down
27 changes: 27 additions & 0 deletions src/lib/searcher/spyse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { buildURL } from "../url_builder";
import { Searcher, SearchableType } from "../types";
import { extractASNumber } from "../utility";

export class Spyse implements Searcher {
public baseURL: string;
public name: string;
public supportedTypes: SearchableType[] = ["ip", "domain", "asn"];

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

public searchByIP(query: string): string {
return buildURL(this.baseURL, `/target/ip/${query}`);
}

public searchByDomain(query: string): string {
return buildURL(this.baseURL, `/target/domain/${query}`);
}

public searchByASN(query: string): string {
const asn = extractASNumber(query);
return buildURL(this.baseURL, `/target/as/${asn}`);
}
}
35 changes: 35 additions & 0 deletions test/searcher/spyse.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from "chai";
import "mocha";
import { Spyse } from "../../src/lib/searcher";

describe("Spyse", function() {
const subject = new Spyse();

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

describe("#searchByIP", function() {
it("should return URL", function() {
expect(subject.searchByIP("1.1.1.1")).to.equal(
"https://spyse.com/target/ip/1.1.1.1"
);
});
});

describe("#searchByDomain", function() {
it("should return URL", function() {
expect(subject.searchByDomain("example.com")).to.equal(
"https://spyse.com/target/domain/example.com"
);
});
});

describe("#searchByASN", function() {
it("should return URL", function() {
expect(subject.searchByASN("AS13335")).to.equal(
"https://spyse.com/target/as/13335"
);
});
});
});