Skip to content

Commit

Permalink
changed last_seen to updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Nov 28, 2024
1 parent 77f6550 commit 7e17fa5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions initdb-assetdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$AMASS_DB" <<-EOSQ
AND r1.etype IN ('PrefDNSRelation', 'SRVDNSRelation') AND r2.etype = 'BasicDNSRelation'
AND r1.content->>'label' = 'dns_record' AND r2.conent->>'label' = 'dns_record'
AND r1.content->>'header.rr_type' IN (33, 2, 15) AND r2.content->>'header.rr_type' IN (1, 28)
AND r1.last_seen >= _from AND r1.last_seen <= _to AND r2.last_seen >= _from AND r2.last_seen <= _to
AND r1.updated_at >= _from AND r1.updated_at <= _to AND r2.updated_at >= _from AND r2.updated_at <= _to
AND fqdns.content->>'name' = ANY(_names)
) LOOP fqdn = _var_r.name;
ip_addr = _var_r.addr;
Expand All @@ -59,8 +59,8 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$AMASS_DB" <<-EOSQ
INNER JOIN entities AS ips ON edges.to_entity_id = ips.id)
WHERE fqdns.etype = 'FQDN' AND ips.etype = 'IPAddress'
AND edges.etype = 'BasicDNSRelation' AND edges.content->>'label' = 'dns_record'
AND edges.content->>'header.rr_type' IN (1, 28) AND edges.last_seen >= _from
AND edges.last_seen <= _to AND fqdns.content->>'name' = ANY(_names)
AND edges.content->>'header.rr_type' IN (1, 28) AND edges.updated_at >= _from
AND edges.updated_at <= _to AND fqdns.content->>'name' = ANY(_names)
) LOOP fqdn = _var_r.name;
ip_addr = _var_r.addr;
_names = array_remove(_names, _var_r.name);
Expand All @@ -76,15 +76,15 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$AMASS_DB" <<-EOSQ
INNER JOIN edges ON fqdns.id = edges.from_entity_id)
INNER JOIN entities AS cnames ON edges.to_entity_id = cnames.id), traverse_cname
WHERE fqdns.etype = 'FQDN' AND cnames.etype = 'FQDN'
AND edges.last_seen >= _from AND edges.last_seen <= _to
AND edges.updated_at >= _from AND edges.updated_at <= _to
AND edges.etype = 'BasicDNSRelation' AND edges.content->>'label' = 'dns_record'
AND edges.content->>'header.rr_type' = 5
AND fqdns.content->>'name' = traverse_cname._fqdn)
SELECT fqdns.content->>'name' AS "name", ips.content->>'address' AS "addr"
FROM ((entities AS fqdns INNER JOIN edges ON fqdns.id = edges.from_entity_id)
INNER JOIN entities AS ips ON edges.to_entity_id = ips.id)
WHERE fqdns.etype = 'FQDN' AND ips.etype = 'IPAddress'
AND edges.last_seen >= _from AND edges.last_seen <= _to
AND edges.updated_at >= _from AND edges.updated_at <= _to
AND edges.etype = 'BasicDNSRelation' AND edges.content->>'label' = 'dns_record'
AND edges.content->>'header.rr_type' IN (1, 28)
AND fqdns.content->>'name' IN (SELECT _fqdn FROM traverse_cname)
Expand Down

0 comments on commit 7e17fa5

Please sign in to comment.