Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
585e1b10
Commit
585e1b10
authored
Jan 29, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ids) obey configured output filename is source is different
parent
0d7e02e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
downloader.py
src/opnsense/scripts/suricata/lib/downloader.py
+3
-2
rule-updater.py
src/opnsense/scripts/suricata/rule-updater.py
+3
-1
No files found.
src/opnsense/scripts/suricata/lib/downloader.py
View file @
585e1b10
...
...
@@ -62,18 +62,19 @@ class Downloader(object):
output
.
append
(
line
)
return
'
\n
'
.
join
(
output
)
def
download
(
self
,
proto
,
url
,
input_filter
):
def
download
(
self
,
proto
,
url
,
filename
,
input_filter
):
""" download ruleset file
:param proto: protocol (http,https)
:param url: download url
:param filename: target filename
:param input_filter: filter to use on received data before save
"""
if
proto
in
(
'http'
,
'https'
):
frm_url
=
url
.
replace
(
'//'
,
'/'
)
.
replace
(
':/'
,
'://'
)
req
=
requests
.
get
(
url
=
frm_url
)
if
req
.
status_code
==
200
:
target_filename
=
(
'
%
s/
%
s'
%
(
self
.
_target_dir
,
frm_url
.
split
(
'/'
)[
-
1
]))
.
replace
(
'//'
,
'/'
)
try
:
target_filename
=
'
%
s/
%
s'
%
(
self
.
_target_dir
,
filename
)
save_data
=
self
.
filter
(
req
.
text
,
input_filter
)
open
(
target_filename
,
'wb'
)
.
write
(
save_data
)
except
IOError
:
...
...
src/opnsense/scripts/suricata/rule-updater.py
View file @
585e1b10
...
...
@@ -62,6 +62,7 @@ if __name__ == '__main__':
else
:
enabled_rulefiles
[
section
.
strip
()][
'filter'
]
=
""
# download / remove rules
md
=
metadata
.
Metadata
()
dl
=
downloader
.
Downloader
(
target_dir
=
rule_source_directory
)
...
...
@@ -77,4 +78,5 @@ if __name__ == '__main__':
pass
else
:
input_filter
=
enabled_rulefiles
[
rule
[
'filename'
]][
'filter'
]
dl
.
download
(
proto
=
download_proto
,
url
=
rule
[
'url'
],
input_filter
=
input_filter
)
dl
.
download
(
proto
=
download_proto
,
url
=
rule
[
'url'
],
filename
=
rule
[
'filename'
],
input_filter
=
input_filter
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment