From fe8dd52c1e5e527d973d1cd025e0d4ee6ea224e1 Mon Sep 17 00:00:00 2001 From: shelld3v <59408894+shelld3v@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:43:34 +0700 Subject: [PATCH] Fixed ThreatBook and incorrect indent in some data source scripts --- resources/scripts/api/bgptools.ads | 6 +++--- resources/scripts/api/threatbook.ads | 6 +++--- resources/scripts/api/urlscan.ads | 10 +++++----- resources/scripts/misc/shadowserver.ads | 6 +++--- resources/scripts/scrape/dnsdumpster.ads | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/resources/scripts/api/bgptools.ads b/resources/scripts/api/bgptools.ads index d9264c347..5526f7e06 100644 --- a/resources/scripts/api/bgptools.ads +++ b/resources/scripts/api/bgptools.ads @@ -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 @@ -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 diff --git a/resources/scripts/api/threatbook.ads b/resources/scripts/api/threatbook.ads index 02475bb69..c9963245b 100644 --- a/resources/scripts/api/threatbook.ads +++ b/resources/scripts/api/threatbook.ads @@ -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 diff --git a/resources/scripts/api/urlscan.ads b/resources/scripts/api/urlscan.ads index 4a29891de..e498e85b8 100644 --- a/resources/scripts/api/urlscan.ads +++ b/resources/scripts/api/urlscan.ads @@ -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 diff --git a/resources/scripts/misc/shadowserver.ads b/resources/scripts/misc/shadowserver.ads index 2c0bf557b..0c802796b 100644 --- a/resources/scripts/misc/shadowserver.ads +++ b/resources/scripts/misc/shadowserver.ads @@ -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 @@ -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 diff --git a/resources/scripts/scrape/dnsdumpster.ads b/resources/scripts/scrape/dnsdumpster.ads index a5e5d3faf..82cf4857f 100644 --- a/resources/scripts/scrape/dnsdumpster.ads +++ b/resources/scripts/scrape/dnsdumpster.ads @@ -26,7 +26,7 @@ function vertical(ctx, domain) local params = { ['csrfmiddlewaretoken']=token, - ['targetip']=domain, + ['targetip']=domain, ['user']="free" }