Skip to content

Commit 7c0d8a8

Browse files
authored
Merge pull request #572 from ninoseki/use-censys-search-v2
feat: use Censys search v2
2 parents 5f280fe + e7d0b65 commit 7c0d8a8

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Mitaka is a browser extension makes your OSINT search & scan easy.
6060
| Blockchain.com | https://www.blockchain.com | BTC |
6161
| Blockchair | https://blockchair.com | BTC, ETH |
6262
| BlockCypher | https://live.blockcypher.com | BTC |
63-
| Censys | https://censys.io | IP, domain, ASN |
63+
| Censys | https://censys.io | IP, ASN |
6464
| Checkphish | https://checkphish.ai | IP, domain |
6565
| crt.sh | https://crt.sh | Domain |
6666
| DNSlytics | https://dnslytics.com | IP, domain |

src/searcher/censys.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,22 @@ import { extractASNumber } from "@/utility";
55
export class Censys implements Searcher {
66
public baseURL: string;
77
public name: string;
8-
public supportedTypes: SearchableType[] = ["ip", "domain", "asn"];
8+
public supportedTypes: SearchableType[] = ["ip", "asn"];
99

1010
public constructor() {
11-
this.baseURL = "https://censys.io";
11+
this.baseURL = "https://search.censys.io";
1212
this.name = "Censys";
1313
}
1414

1515
public searchByIP(query: string): string {
16-
return buildURL(this.baseURL, `/ipv4/${query}`);
17-
}
18-
19-
public searchByDomain(query: string): string {
20-
return buildURL(this.baseURL, `/domain/${query}`);
16+
return buildURL(this.baseURL, `/hosts/${query}`);
2117
}
2218

2319
public searchByASN(query: string): string {
2420
const asn = extractASNumber(query);
25-
return buildURL(this.baseURL, "/ipv4", {
21+
return buildURL(this.baseURL, "/search", {
2622
q: `autonomous_system.asn:${asn}`,
23+
resource: "hosts",
2724
});
2825
}
2926
}

test/searcher/censys.spec.ts

+4-11
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,14 @@ describe("Censys", function () {
88
const subject = new Censys();
99

1010
it("should support ip, domain, asn", function () {
11-
expect(subject.supportedTypes).to.deep.equal(["ip", "domain", "asn"]);
11+
expect(subject.supportedTypes).to.deep.equal(["ip", "asn"]);
1212
});
1313

1414
describe("#searchByIP", function () {
1515
const ip = "1.1.1.1";
1616
it("should return a URL", function () {
17-
expect(subject.searchByIP(ip)).to.equal(`https://censys.io/ipv4/${ip}`);
18-
});
19-
});
20-
21-
describe("#searchByDomain", function () {
22-
const domain = "github.com";
23-
it("should return a URL", function () {
24-
expect(subject.searchByDomain(domain)).to.equal(
25-
`https://censys.io/domain/${domain}`
17+
expect(subject.searchByIP(ip)).to.equal(
18+
`https://search.censys.io/hosts/${ip}`
2619
);
2720
});
2821
});
@@ -31,7 +24,7 @@ describe("Censys", function () {
3124
const asn = "AS13335";
3225
it("should return a URL", function () {
3326
expect(subject.searchByASN(asn)).to.equal(
34-
"https://censys.io/ipv4?q=autonomous_system.asn%3A13335"
27+
"https://search.censys.io/search?q=autonomous_system.asn%3A13335&resource=hosts"
3528
);
3629
});
3730
});

0 commit comments

Comments
 (0)