зеркало из https://github.com/mozilla/MozDef.git
PEP 8
This commit is contained in:
Родитель
1dbba52cc3
Коммит
2cdc5f1f8b
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
|
|
||||||
from lib.alerttask import AlertTask
|
from lib.alerttask import AlertTask
|
||||||
from mozdef_util.query_models import SearchQuery, PhraseMatch, TermsMatch, QueryStringMatch
|
from mozdef_util.query_models import SearchQuery, QueryStringMatch
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
@ -27,7 +27,7 @@ class AlertWatchList(AlertTask):
|
||||||
jwt_token = JWTAuth(self.config.jwt_secret)
|
jwt_token = JWTAuth(self.config.jwt_secret)
|
||||||
jwt_token.set_header_format('Bearer %s')
|
jwt_token.set_header_format('Bearer %s')
|
||||||
|
|
||||||
#Connect to rest api and grab response
|
# Connect to rest api and grab response
|
||||||
r = requests.get(self.config.api_url, auth=jwt_token)
|
r = requests.get(self.config.api_url, auth=jwt_token)
|
||||||
status = r.status_code
|
status = r.status_code
|
||||||
index = 0
|
index = 0
|
||||||
|
|
|
@ -554,12 +554,12 @@ def getWatchlist():
|
||||||
watchlist = mozdefdb['watchlist']
|
watchlist = mozdefdb['watchlist']
|
||||||
|
|
||||||
# Log the entries we are removing to maintain an audit log
|
# Log the entries we are removing to maintain an audit log
|
||||||
expired = watchlist.find({'dateExpiring': {"$lte": datetime.utcnow()-timedelta(hours=1)}})
|
expired = watchlist.find({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
|
||||||
for entry in expired:
|
for entry in expired:
|
||||||
sys.stdout.write('Deleting entry {0} from watchlist /n'.format(entry))
|
sys.stdout.write('Deleting entry {0} from watchlist /n'.format(entry))
|
||||||
|
|
||||||
# delete any that expired
|
# delete any that expired
|
||||||
watchlist.delete_many({'dateExpiring': {"$lte": datetime.utcnow()-timedelta(hours=1)}})
|
watchlist.delete_many({'dateExpiring': {"$lte": datetime.utcnow() - timedelta(hours=1)}})
|
||||||
|
|
||||||
# Lastly, export the combined watchlist
|
# Lastly, export the combined watchlist
|
||||||
watchCursor=mozdefdb['watchlist'].aggregate([
|
watchCursor=mozdefdb['watchlist'].aggregate([
|
||||||
|
|
|
@ -7,7 +7,6 @@ import os
|
||||||
import random
|
import random
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
import re
|
|
||||||
from configlib import getConfig, OptionParser
|
from configlib import getConfig, OptionParser
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
|
Загрузка…
Ссылка в новой задаче