Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
Add sleeping time between NVD API call (temporary solution for #22)
Browse files Browse the repository at this point in the history
  • Loading branch information
alb-uss committed Nov 16, 2021
1 parent f2da700 commit 1b07ce3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions secmon_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ def deleteProduct(ptype, key_or_cpe):
return "NOK"

def registerNewCve(cve_id,reason,product):
time.sleep(5)
try:
now_date = str(datetime.now()).split(" ")[0].split("-")
idx_date = now_date[2]+"/"+now_date[1]+"/"+now_date[0]
Expand Down Expand Up @@ -661,6 +662,7 @@ def registerNewCve(cve_id,reason,product):
print("ERROR when SECMON would to register this CVE : ",cve_id)
handleException(e)
def addProduct(ptype, key_or_cpe):
time.sleep(10)
task_id = random.randint(10000,99999)
writeTaskLog("secmon_web",task_id,"loaded",f"Adding the following product : {key_or_cpe}....")
if ptype == "CPE":
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def buildCVEList(language):
if cpes != []:
for cpe in cpes:
try:
time.sleep(20)
cve_ids = pollCveIdFromCpe(cpe)
except:
print("Unable to find CVE related to this product : "+cpe)
Expand Down Expand Up @@ -223,7 +224,7 @@ def configBuilder(smtp_login, smtp_passwd, smtpsrv, port, tls, sender, receiver,
print("Github API authentication failed. You can add this config on the web UI after installation...")
else:
con.execute("INSERT INTO config (github_api_key,github_username,cvss_alert_limit,no_score_cve_alert) VALUES (?,?,?,?);", ("None","None","no_limit","True"))
con.commit()
con.commit()
print()
username = ""
password = ""
Expand Down

0 comments on commit 1b07ce3

Please sign in to comment.