Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update main.py #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions suricata/update/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,26 @@ def load_dist_rules(files):
dist_rule_path)
return

if os.path.exists(dist_rule_path):
if not os.access(dist_rule_path, os.R_OK):
logger.warning("Distribution rule path not readable: %s",
dist_rule_path)
return
for filename in filenames:
path = os.path.join(dist_rule_path, filename)
if not os.path.exists(path):
continue
if not os.access(path, os.R_OK):
logger.warning("Distribution rule file not readable: %s",
path)
continue
logger.info("Loading distribution rule file %s", path)
try:
with open(path, "rb") as fileobj:
files.append(SourceFile(path, fileobj.read()))
except Exception as err:
logger.error("Failed to open {}: {}".format(path, err))
sys.exit(1)
if not os.access(dist_rule_path, os.R_OK):
logger.warning("Distribution rule path not readable: %s",
dist_rule_path)
return

for filename in filenames:
path = os.path.join(dist_rule_path, filename)
if not os.path.exists(path):
continue
if not os.access(path, os.R_OK):
logger.warning("Distribution rule file not readable: %s",
path)
continue
logger.info("Loading distribution rule file %s", path)
try:
with open(path, "rb") as fileobj:
files.append(SourceFile(path, fileobj.read()))
except Exception as err:
logger.error("Failed to open {}: {}".format(path, err))
sys.exit(1)

def load_classification(suriconf, files):
filename = os.path.join("suricata", "classification.config")
Expand Down