Skip to content

Commit

Permalink
Fixed ThreatBook and incorrect indent in some data source scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
shelld3v committed Jun 1, 2022
1 parent 7357986 commit fe8dd52
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions resources/scripts/api/bgptools.ads
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end

function origin(ctx, addr)
local conn, err = socket.connect(ctx, bgptoolsWhoisAddress, 43, "tcp")
if (err ~= nil and err ~= "") then
if (err ~= nil and err ~= "") then
log(ctx, "failed to connect to the whois server: " .. err)
return nil
end
Expand All @@ -66,9 +66,9 @@ function origin(ctx, addr)
end

local data
data, err = conn:recv_all()
data, err = conn:recv_all()
conn:close()
if (err ~= nil and err ~= "") then
if (err ~= nil and err ~= "") then
log(ctx, "failed to read the whois server response: " .. err)
return nil
end
Expand Down
6 changes: 3 additions & 3 deletions resources/scripts/api/threatbook.ads
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ function vertical(ctx, domain)
return
end

local d = json.decode(resp)
if (d == nil or d.response_code ~= 0 or #(d.sub_domains.data) == 0) then
local j = json.decode(resp)
if (j == nil or j.response_code ~= 0) then
return
end

for i, sub in pairs(d.sub_domains.data) do
for _, sub in pairs(j['data']['sub_domains']['data']) do
new_name(ctx, sub)
end
end
Expand Down
10 changes: 5 additions & 5 deletions resources/scripts/api/urlscan.ads
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ function submission(ctx, domain)
end

-- Keep this data source active while waiting for the scan to complete
while(true) do
while(true) do
_, err = request(ctx, {['url']=d.api})
if (err == nil or err ~= "404 Not Found") then
break
if (err == nil or err ~= "404 Not Found") then
break
end
-- A large pause between these requests
for _=1,3 do check_rate_limit() end
end
end

return d.uuid
return d.uuid
end
6 changes: 3 additions & 3 deletions resources/scripts/misc/shadowserver.ads
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ end

function netblocks(ctx, asn)
local conn, err = socket.connect(ctx, shadowServerWhoisAddress, 43, "tcp")
if (err ~= nil and err ~= "") then return nil end
if (err ~= nil and err ~= "") then return nil end

_, err = conn:send("prefix " .. tostring(asn) .. "\n")
if (err ~= nil and err ~= "") then
Expand All @@ -75,8 +75,8 @@ function netblocks(ctx, asn)
end

local data
data, err = conn:recv_all()
if (err ~= nil and err ~= "") then
data, err = conn:recv_all()
if (err ~= nil and err ~= "") then
conn:close()
return nil
end
Expand Down
2 changes: 1 addition & 1 deletion resources/scripts/scrape/dnsdumpster.ads
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function vertical(ctx, domain)

local params = {
['csrfmiddlewaretoken']=token,
['targetip']=domain,
['targetip']=domain,
['user']="free"
}

Expand Down

0 comments on commit fe8dd52

Please sign in to comment.