Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
url-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
url-checker
Commits
74e39c3d
Commit
74e39c3d
authored
Dec 09, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CHange parameter name
parent
03b9e296
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
15 deletions
+18
-15
test_urlchecker_bot.py
test_urlchecker_bot.py
+6
-6
urlchecker_bot.py
urlchecker_bot.py
+5
-2
urlchecker_cli.py
urlchecker_cli.py
+5
-5
urlchecker_configuration.py
urlchecker_configuration.py
+2
-2
No files found.
test_urlchecker_bot.py
View file @
74e39c3d
...
...
@@ -117,7 +117,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
"example.org"
,
"
DNS
"
:
"
\
n
"
.
join
([
resolver_ip
,
resolver_ip_2
]),
"
NAMESERVER
"
:
"
\
n
"
.
join
([
resolver_ip
,
resolver_ip_2
]),
}
)
bot
.
initDB
()
...
...
@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
"
\
n
"
.
join
([
domain_1
,
domain_2
]),
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
)
bot
.
initDB
()
...
...
@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
domain
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
)
bot
.
initDB
()
...
...
@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
sub_domain
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
)
bot
.
initDB
()
...
...
@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"URL"
:
"https://example.org/foo"
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
)
bot
.
initDB
()
...
...
@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
"SQLITE"
:
":memory:"
,
"URL"
:
"https://example2.org/foo"
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
)
bot
.
initDB
()
...
...
urlchecker_bot.py
View file @
74e39c3d
...
...
@@ -58,7 +58,7 @@ class WebBot:
# Calculate the resolver list
resolver_ip_list
=
getReachableResolverList
(
self
.
_db
,
status_id
,
self
.
config
[
"
DNS
"
].
split
()
self
.
_db
,
status_id
,
self
.
config
[
"
NAMESERVER
"
].
split
()
)
if
not
resolver_ip_list
:
return
...
...
@@ -109,7 +109,10 @@ class WebBot:
# Report the list of DNS server status
query
=
reportNetwork
(
self
.
_db
,
port
=
"53"
,
transport
=
"UDP"
,
ip
=
self
.
config
[
"DNS"
].
split
()
self
.
_db
,
port
=
"53"
,
transport
=
"UDP"
,
ip
=
self
.
config
[
"NAMESERVER"
].
split
(),
)
print
(
"# DNS SERVER"
)
resolver_ip_list
=
[]
...
...
urlchecker_cli.py
View file @
74e39c3d
...
...
@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot
@
click
.
option
(
"--sqlite"
,
"-s"
,
help
=
"The path of the sqlite DB. (default: :memory:)"
)
@
click
.
option
(
"--
dns"
,
"-d
"
,
help
=
"The IP of the DNS server."
)
@
click
.
option
(
"--
nameserver"
,
"-n
"
,
help
=
"The IP of the DNS server."
)
@
click
.
option
(
"--url"
,
"-u"
,
help
=
"The url to check."
)
@
click
.
option
(
"--domain"
,
"-
m
"
,
help
=
"The domain to check."
)
@
click
.
option
(
"--domain"
,
"-
d
"
,
help
=
"The domain to check."
)
@
click
.
option
(
"--configuration"
,
"-f"
,
help
=
"The path of the configuration file."
)
def
runUrlChecker
(
run
,
sqlite
,
dns
,
url
,
domain
,
configuration
):
def
runUrlChecker
(
run
,
sqlite
,
nameserver
,
url
,
domain
,
configuration
):
# click.echo("Running url checker bot")
mapping
=
{}
...
...
@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration):
mapping
[
"URL"
]
=
""
if
sqlite
:
mapping
[
"SQLITE"
]
=
sqlite
if
dns
:
mapping
[
"
DNS"
]
=
dns
if
nameserver
:
mapping
[
"
NAMESERVER"
]
=
nameserver
bot
=
create_bot
(
cfgfile
=
configuration
,
mapping
=
mapping
)
return
bot
.
run
(
run
)
...
...
urlchecker_configuration.py
View file @
74e39c3d
...
...
@@ -24,8 +24,8 @@ def createConfiguration(
# Required values
if
"SQLITE"
not
in
config
[
CONFIG_SECTION
]:
config
[
CONFIG_SECTION
][
"SQLITE"
]
=
":memory:"
if
"
DNS
"
not
in
config
[
CONFIG_SECTION
]:
config
[
CONFIG_SECTION
][
"
DNS
"
]
=
"
\
n
"
.
join
(
if
"
NAMESERVER
"
not
in
config
[
CONFIG_SECTION
]:
config
[
CONFIG_SECTION
][
"
NAMESERVER
"
]
=
"
\
n
"
.
join
(
get_default_resolver
().
nameservers
)
...
...
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