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
Show 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):
...
@@ -117,7 +117,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
"example.org"
,
"DOMAIN"
:
"example.org"
,
"
DNS
"
:
"
\
n
"
.
join
([
resolver_ip
,
resolver_ip_2
]),
"
NAMESERVER
"
:
"
\
n
"
.
join
([
resolver_ip
,
resolver_ip_2
]),
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
...
@@ -169,7 +169,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
"
\
n
"
.
join
([
domain_1
,
domain_2
]),
"DOMAIN"
:
"
\
n
"
.
join
([
domain_1
,
domain_2
]),
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
...
@@ -214,7 +214,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
domain
,
"DOMAIN"
:
domain
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
...
@@ -270,7 +270,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"DOMAIN"
:
sub_domain
,
"DOMAIN"
:
sub_domain
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
...
@@ -315,7 +315,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"URL"
:
"https://example.org/foo"
,
"URL"
:
"https://example.org/foo"
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
...
@@ -358,7 +358,7 @@ class UrlCheckerBotTestCase(unittest.TestCase):
mapping
=
{
mapping
=
{
"SQLITE"
:
":memory:"
,
"SQLITE"
:
":memory:"
,
"URL"
:
"https://example2.org/foo"
,
"URL"
:
"https://example2.org/foo"
,
"
DNS
"
:
resolver_ip
,
"
NAMESERVER
"
:
resolver_ip
,
}
}
)
)
bot
.
initDB
()
bot
.
initDB
()
...
...
urlchecker_bot.py
View file @
74e39c3d
...
@@ -58,7 +58,7 @@ class WebBot:
...
@@ -58,7 +58,7 @@ class WebBot:
# Calculate the resolver list
# Calculate the resolver list
resolver_ip_list
=
getReachableResolverList
(
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
:
if
not
resolver_ip_list
:
return
return
...
@@ -109,7 +109,10 @@ class WebBot:
...
@@ -109,7 +109,10 @@ class WebBot:
# Report the list of DNS server status
# Report the list of DNS server status
query
=
reportNetwork
(
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"
)
print
(
"# DNS SERVER"
)
resolver_ip_list
=
[]
resolver_ip_list
=
[]
...
...
urlchecker_cli.py
View file @
74e39c3d
...
@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot
...
@@ -15,13 +15,13 @@ from urlchecker_bot import create_bot
@
click
.
option
(
@
click
.
option
(
"--sqlite"
,
"-s"
,
help
=
"The path of the sqlite DB. (default: :memory:)"
"--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
(
"--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
(
@
click
.
option
(
"--configuration"
,
"-f"
,
help
=
"The path of the configuration file."
"--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")
# click.echo("Running url checker bot")
mapping
=
{}
mapping
=
{}
...
@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration):
...
@@ -34,8 +34,8 @@ def runUrlChecker(run, sqlite, dns, url, domain, configuration):
mapping
[
"URL"
]
=
""
mapping
[
"URL"
]
=
""
if
sqlite
:
if
sqlite
:
mapping
[
"SQLITE"
]
=
sqlite
mapping
[
"SQLITE"
]
=
sqlite
if
dns
:
if
nameserver
:
mapping
[
"
DNS"
]
=
dns
mapping
[
"
NAMESERVER"
]
=
nameserver
bot
=
create_bot
(
cfgfile
=
configuration
,
mapping
=
mapping
)
bot
=
create_bot
(
cfgfile
=
configuration
,
mapping
=
mapping
)
return
bot
.
run
(
run
)
return
bot
.
run
(
run
)
...
...
urlchecker_configuration.py
View file @
74e39c3d
...
@@ -24,8 +24,8 @@ def createConfiguration(
...
@@ -24,8 +24,8 @@ def createConfiguration(
# Required values
# Required values
if
"SQLITE"
not
in
config
[
CONFIG_SECTION
]:
if
"SQLITE"
not
in
config
[
CONFIG_SECTION
]:
config
[
CONFIG_SECTION
][
"SQLITE"
]
=
":memory:"
config
[
CONFIG_SECTION
][
"SQLITE"
]
=
":memory:"
if
"
DNS
"
not
in
config
[
CONFIG_SECTION
]:
if
"
NAMESERVER
"
not
in
config
[
CONFIG_SECTION
]:
config
[
CONFIG_SECTION
][
"
DNS
"
]
=
"
\
n
"
.
join
(
config
[
CONFIG_SECTION
][
"
NAMESERVER
"
]
=
"
\
n
"
.
join
(
get_default_resolver
().
nameservers
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