Skip to content

Commit

Permalink
Merge pull request #283 from NCAR/nginx-server
Browse files Browse the repository at this point in the history
Add nginx WAF server
  • Loading branch information
amercader authored Aug 25, 2022
2 parents cd6667d + 8648312 commit 6507845
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ckanext/spatial/harvesters/waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ def fetch_stage(self, harvest_object):
,adjacent=False, joinString=' ').setResultsName('date')
)

nginx = parse.SkipTo(parse.CaselessLiteral("<a href="), include=True).suppress() \
+ parse.quotedString.setParseAction(parse.removeQuotes).setResultsName('url') \
+ parse.SkipTo("</a>", include=True).suppress() \
+ parse.Optional(parse.Literal('</td><td align="right">')).suppress() \
+ parse.Optional(parse.Combine(
parse.Word(parse.alphanums+'-') +
parse.Word(parse.alphanums+':')
,adjacent=False, joinString=' ').setResultsName('date')
)

iis = parse.SkipTo("<br>").suppress() \
+ parse.OneOrMore("<br>").suppress() \
+ parse.Optional(parse.Combine(
Expand All @@ -252,12 +262,15 @@ def fetch_stage(self, harvest_object):


scrapers = {'apache': parse.OneOrMore(parse.Group(apache)),
'nginx': parse.OneOrMore(parse.Group(nginx)),
'other': parse.OneOrMore(parse.Group(other)),
'iis': parse.OneOrMore(parse.Group(iis))}

def _get_scraper(server):
if not server or 'apache' in server.lower():
return 'apache'
if 'nginx' in server.lower():
return 'nginx'
if server == 'Microsoft-IIS/7.5':
return 'iis'
else:
Expand Down

0 comments on commit 6507845

Please sign in to comment.