Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
surykatka
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
surykatka
Commits
bb3d5e5c
Commit
bb3d5e5c
authored
Dec 06, 2021
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test root url with the ending /
This is the default Chrome behaviour
parent
389b5eba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
27 deletions
+29
-27
src/surykatka/bot.py
src/surykatka/bot.py
+7
-5
src/surykatka/http.py
src/surykatka/http.py
+1
-1
tests/test_bot.py
tests/test_bot.py
+20
-20
tests/test_http.py
tests/test_http.py
+1
-1
No files found.
src/surykatka/bot.py
View file @
bb3d5e5c
...
...
@@ -173,7 +173,7 @@ def filterWarningStatus(
domain_list
=
[
x
for
x
in
domain_list
if
"%s%s"
%
(
prefix
,
x
)
not
in
not_critical_url_list
if
"%s%s
/
"
%
(
prefix
,
x
)
not
in
not_critical_url_list
]
if
status_dict
[
"tcp_server"
][
i
][
"port"
]
==
25
:
has_intersection
=
(
...
...
@@ -199,7 +199,7 @@ def filterWarningStatus(
<
(
parsedate_to_datetime
(
not_after
)
-
now
).
total_seconds
()
)
)
or
(
(
"https://%s"
%
status_dict
[
"ssl_certificate"
][
i
][
"hostname"
])
(
"https://%s
/
"
%
status_dict
[
"ssl_certificate"
][
i
][
"hostname"
])
in
not_critical_url_list
):
# Warn 2 weeks before expiration
...
...
@@ -291,7 +291,7 @@ class WebBot:
# Domain not explicitely checked
# Skip both root url
for
protocol
in
(
"http"
,
"https"
):
not_critical_url
=
"%s://%s"
%
(
protocol
,
hostname
)
not_critical_url
=
"%s://%s
/
"
%
(
protocol
,
hostname
)
if
not_critical_url
not
in
url_list
:
not_critical_url_list
.
append
(
not_critical_url
)
return
not_critical_url_list
...
...
@@ -373,7 +373,7 @@ class WebBot:
# If certificate is not valid,
# no need to do another query
continue
url
=
"%s://%s"
%
(
protocol
,
hostname
)
url
=
"%s://%s
/
"
%
(
protocol
,
hostname
)
if
url
not
in
url_dict
:
url_dict
[
url
]
=
[]
url_dict
[
url
].
append
(
server_ip
)
...
...
@@ -637,7 +637,9 @@ class WebBot:
protocol
=
{
80
:
"http"
,
443
:
"https"
,
25
:
"smtp"
}[
network_change
[
"port"
]
]
url
=
"%s://%s"
%
(
protocol
,
hostname
)
# Chrome automatically add the trailing /
# when user enter the domain name
url
=
"%s://%s/"
%
(
protocol
,
hostname
)
if
url
not
in
url_dict
:
url_dict
[
url
]
=
[]
url_dict
[
url
].
append
(
network_change
[
"ip"
])
...
...
src/surykatka/http.py
View file @
bb3d5e5c
...
...
@@ -37,7 +37,7 @@ def getUrlHostname(url):
def
getRootUrl
(
url
):
parsed_url
=
urlparse
(
url
)
return
"%s://%s"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
return
"%s://%s
/
"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
def
getUserAgent
(
version
):
...
...
tests/test_bot.py
View file @
bb3d5e5c
...
...
@@ -212,8 +212,8 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://example.org"
),
(
"1.2.3.4"
,
"https://example.org"
),
(
"1.2.3.4"
,
"http://example.org
/
"
),
(
"1.2.3.4"
,
"https://example.org
/
"
),
],
)
...
...
@@ -323,8 +323,8 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://example.org"
),
(
"1.2.3.4"
,
"https://example.org"
),
(
"1.2.3.4"
,
"http://example.org
/
"
),
(
"1.2.3.4"
,
"https://example.org
/
"
),
],
)
...
...
@@ -440,10 +440,10 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://%s"
%
domain_1
),
(
"1.2.3.4"
,
"http://%s"
%
domain_2
),
(
"1.2.3.4"
,
"https://%s"
%
domain_1
),
(
"1.2.3.4"
,
"https://%s"
%
domain_2
),
(
"1.2.3.4"
,
"http://%s
/
"
%
domain_1
),
(
"1.2.3.4"
,
"http://%s
/
"
%
domain_2
),
(
"1.2.3.4"
,
"https://%s
/
"
%
domain_1
),
(
"1.2.3.4"
,
"https://%s
/
"
%
domain_2
),
],
)
...
...
@@ -558,10 +558,10 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://%s"
%
domain
),
(
"1.2.3.5"
,
"http://%s"
%
domain
),
(
"1.2.3.4"
,
"https://%s"
%
domain
),
(
"1.2.3.5"
,
"https://%s"
%
domain
),
(
"1.2.3.4"
,
"http://%s
/
"
%
domain
),
(
"1.2.3.5"
,
"http://%s
/
"
%
domain
),
(
"1.2.3.4"
,
"https://%s
/
"
%
domain
),
(
"1.2.3.5"
,
"https://%s
/
"
%
domain
),
],
)
...
...
@@ -677,10 +677,10 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://%s"
%
domain
),
(
"1.2.3.4"
,
"http://%s"
%
sub_domain
),
(
"1.2.3.4"
,
"https://%s"
%
domain
),
(
"1.2.3.4"
,
"https://%s"
%
sub_domain
),
(
"1.2.3.4"
,
"http://%s
/
"
%
domain
),
(
"1.2.3.4"
,
"http://%s
/
"
%
sub_domain
),
(
"1.2.3.4"
,
"https://%s
/
"
%
domain
),
(
"1.2.3.4"
,
"https://%s
/
"
%
sub_domain
),
],
)
...
...
@@ -783,8 +783,8 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://%s"
%
sub_domain
),
(
"1.2.3.4"
,
"https://%s"
%
sub_domain
),
(
"1.2.3.4"
,
"http://%s
/
"
%
sub_domain
),
(
"1.2.3.4"
,
"https://%s
/
"
%
sub_domain
),
],
)
...
...
@@ -883,8 +883,8 @@ class SurykatkaBotTestCase(unittest.TestCase):
checkHttpCodeChange
(
bot
,
[
(
"1.2.3.4"
,
"http://%s"
%
domain
),
(
"1.2.3.4"
,
"https://%s"
%
domain
),
(
"1.2.3.4"
,
"http://%s
/
"
%
domain
),
(
"1.2.3.4"
,
"https://%s
/
"
%
domain
),
(
"1.2.3.4"
,
"https://example.org/foo"
),
],
)
...
...
tests/test_http.py
View file @
bb3d5e5c
...
...
@@ -52,7 +52,7 @@ class SurykatkaHttpTestCase(unittest.TestCase):
################################################
def
test_getRootUrl
(
self
):
result
=
getRootUrl
(
"https://example.org/foo?bar=1"
)
assert
result
==
"https://example.org"
assert
result
==
"https://example.org
/
"
################################################
# getUserAgent
...
...
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