Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Anubis and SonarSearch as data sources #530
- Loading branch information
caffix
committed
Jan 15, 2021
1 parent
37257cc
commit 2db82d9
Showing
4 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- Copyright 2021 Jeff Foley. All rights reserved. | ||
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. | ||
|
||
name = "Anubis" | ||
type = "api" | ||
|
||
function start() | ||
setratelimit(1) | ||
end | ||
|
||
function vertical(ctx, domain) | ||
scrape(ctx, {url=buildurl(domain)}) | ||
end | ||
|
||
function buildurl(domain) | ||
return "https://jldc.me/anubis/subdomains/" .. domain | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- Copyright 2021 Jeff Foley. All rights reserved. | ||
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. | ||
|
||
local json = require("json") | ||
|
||
name = "SonarSearch" | ||
type = "api" | ||
|
||
function start() | ||
setratelimit(3) | ||
end | ||
|
||
function vertical(ctx, domain) | ||
local p = 0 | ||
local cfg = datasrc_config() | ||
|
||
while(true) do | ||
local resp | ||
local vurl = buildurl(domain, p) | ||
-- Check if the response data is in the graph database | ||
if (cfg.ttl ~= nil and cfg.ttl > 0) then | ||
resp = obtain_response(vurl, cfg.ttl) | ||
end | ||
|
||
if (resp == nil or resp == "") then | ||
resp, err = request({url=vurl}) | ||
if (err ~= nil and err ~= "") then | ||
return | ||
end | ||
|
||
if (cfg.ttl ~= nil and cfg.ttl > 0) then | ||
cache_response(vurl, resp) | ||
end | ||
end | ||
|
||
local d = json.decode(resp) | ||
if (d == nil or #d == 0) then | ||
return | ||
end | ||
|
||
sendnames(ctx, resp) | ||
checkratelimit() | ||
p = p + 1 | ||
end | ||
end | ||
|
||
function buildurl(domain, page) | ||
return "https://sonar.omnisint.io/subdomains/" .. domain .. "?page=" .. page | ||
end | ||
|
||
function sendnames(ctx, content) | ||
local names = find(content, subdomainre) | ||
if names == nil then | ||
return | ||
end | ||
|
||
for i, v in pairs(names) do | ||
newname(ctx, v) | ||
end | ||
end |