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

Function main

python3_cron_scripts/search_censys_files_new.py:145–272  ·  view source on GitHub ↗

Begin main...

(logger=None)

Source from the content-addressed store, hash-verified

143
144
145def main(logger=None):
146 """
147 Begin main...
148 """
149 if logger is None:
150 logger = LoggingUtil.create_log(__name__)
151
152 if is_running("get_censys_files.py"):
153 """
154 Check to see if a download is in process...
155 """
156 logger.warning("Can't run due to get_files running. Goodbye!")
157 exit(0)
158
159 if is_running(os.path.basename(__file__)):
160 """
161 Check to see if a previous attempt to parse is still running...
162 """
163 logger.warning("I am already running! Goodbye!")
164 exit(0)
165
166 # Make the relevant database connections
167 RMC = RemoteMongoConnector.RemoteMongoConnector()
168
169 ip_manager = IPManager.IPManager(RMC)
170
171 # Verify that the get_files script has a recent file in need of parsing.
172 jobs_collection = RMC.get_jobs_connection()
173
174 status = jobs_collection.find_one({"job_name": "censys"})
175 if status["status"] != "DOWNLOADED":
176 logger.warning("The status is not set to DOWNLOADED. Goodbye!")
177 exit(0)
178
179 now = datetime.now()
180 print("Starting: " + str(now))
181 logger.info("Starting...")
182
183 # Collect the list of available zones
184 zones = ZoneManager.get_distinct_zones(RMC)
185
186 logger.info("Zones: " + str(len(zones)))
187
188 # Get the current configuration information for Marinus.
189 config_collection = RMC.get_config_connection()
190
191 configs = config_collection.find({})
192 orgs = []
193 for org in configs[0]["SSL_Orgs"]:
194 orgs.append(org)
195
196 logger.info("Orgs: " + str(len(orgs)))
197
198 # Obtain the name of the decompressed file.
199 filename_f = open(FILENAME_FILE, "r")
200 decompressed_file = filename_f.readline()
201 filename_f.close()
202

Callers 1

Calls 15

get_jobs_connectionMethod · 0.95
get_config_connectionMethod · 0.95
is_tracked_ipMethod · 0.95
find_splunk_dataMethod · 0.95
is_aws_ipMethod · 0.95
is_azure_ipMethod · 0.95
check_in_orgFunction · 0.85
lookup_domainFunction · 0.85
create_logMethod · 0.80
find_oneMethod · 0.80

Tested by

no test coverage detected