Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Capricelli
botfreak
Commits
b84a194b9964
Commit
da77df3b
authored
Jun 13, 2022
by
Thomas Capricelli
Browse files
cleaning
parent
ef809be88f02
Changes
1
Hide whitespace changes
Inline
Side-by-side
main/management/commands/check_db_against_whitelist.py
View file @
b84a194b
...
...
@@ -43,7 +43,7 @@ class Command(BaseCommand):
reports
=
ReportBadIP
.
objects
.
filter
(
server__user
=
user
).
distinct
().
order_by
(
'updated'
)
if
user
is
None
:
whitelist
=
IPWhiteList
.
objects
.
filter
(
user__isnull
=
True
)
info
=
"General, checking %d reports against general WhiteList (%
%
d items)"
info
=
"General, checking %d reports against general WhiteList (%d items)"
else
:
whitelist
=
user
.
ipwhitelist_set
info
=
"User %s, checking %%d reports against both user WhiteList (%%d items) and global one."
%
user
...
...
@@ -59,13 +59,14 @@ class Command(BaseCommand):
ipwl
=
IPWhiteList
.
check_against
(
ip_address
(
report
.
badip
.
ip
),
user
)
if
not
ipwl
:
continue
# Display
self
.
stdout
.
write
(
self
.
style
.
WARNING
(
'Report %d (ip=%s, reason=%s, updated=%s) fells in WhiteList %d (%s)'
%
(
self
.
stdout
.
write
(
self
.
style
.
WARNING
(
'Report %d (ip=%s, reason=%s, updated=%s) fells in WhiteList %d (
%s,
%s)'
%
(
report
.
id
,
str
(
report
.
badip
),
str
(
report
.
reason
),
str
(
report
.
updated
),
ipwl
.
id
,
str
(
ipwl
.
network
),
ipwl
.
explanation
,
)))
self
.
stdout
.
write
(
"
\t
%s%s"
%
(
baseurl
,
reverse
(
"info_ip"
,
args
=
[
report
.
badip
.
ip
,])))
self
.
stdout
.
write
(
"
\t
%s%s"
%
(
baseurl
,
reverse
(
"admin:main_ipwhitelist_change"
,
args
=
[
ipwl
.
id
])))
...
...
Write
Preview
Supports
Markdown
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