MCPcopy Create free account
hub / github.com/adobe/Marinus / download_amass_data

Function download_amass_data

python3_cron_scripts/download_from_remote_database.py:175–204  ·  view source on GitHub ↗

Download the latest OWASP Amass information.

(
    logger, amass_collection, remote_amass_collection, dns_manager, zones
)

Source from the content-addressed store, hash-verified

173
174
175def download_amass_data(
176 logger, amass_collection, remote_amass_collection, dns_manager, zones
177):
178 """
179 Download the latest OWASP Amass information.
180 """
181 logger.info("Beginning Amass download")
182 now = datetime.now()
183 mirror_date = datetime.now() - timedelta(days=7, hours=9)
184 amass_results = remote_amass_collection.find(
185 {"timestamp": {"$gt": mirror_date}}, {"_id": 0}
186 ).batch_size(50)
187
188 google_dns = GoogleDNS.GoogleDNS()
189
190 for result in amass_results:
191 zone = check_zones(result["name"], zones)
192 if zone is not None:
193 time.sleep(1)
194 if record_finding(logger, dns_manager, google_dns, zone, result):
195 amass_collection.replace_one(
196 {"name": result["name"]}, result, upsert=True
197 )
198
199 # Establish a date four months back
200 scrub_date = datetime.now() - timedelta(days=120, hours=9)
201
202 # Remove data from scrub_date
203 amass_collection.delete_many({"timestamp": {"$lte": scrub_date}})
204 remote_amass_collection.delete_many({"timestamp": {"$lte": now}})
205
206
207def download_jobs_status(logger, jobs_collection, remote_jobs_collection):

Callers 1

mainFunction · 0.85

Calls 2

record_findingFunction · 0.85
check_zonesFunction · 0.70

Tested by

no test coverage detected