Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aaPanel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
aaPanel
Commits
30f9dbbf
Commit
30f9dbbf
authored
Jul 03, 2019
by
jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize the BasicAuth response header information
parent
185502ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
2 deletions
+34
-2
__init__.py
BTPanel/__init__.py
+34
-2
No files found.
BTPanel/__init__.py
View file @
30f9dbbf
...
...
@@ -38,6 +38,7 @@ socketio.init_app(app)
import
common
,
db
,
jobs
,
uuid
jobs
.
control_init
()
app
.
secret_key
=
uuid
.
UUID
(
int
=
uuid
.
getnode
())
.
hex
[
-
12
:]
local_ip
=
None
try
:
...
...
@@ -89,7 +90,7 @@ def service_status():
@
app
.
before_request
def
basic_auth_check
():
if
app
.
config
[
'BASIC_AUTH_OPEN'
]:
if
request
.
path
in
[
'/public'
]:
return
;
if
request
.
path
in
[
'/public'
,
'/download'
]:
return
;
auth
=
request
.
authorization
if
not
comm
.
get_sk
():
return
;
if
not
auth
:
return
send_authenticated
()
...
...
@@ -99,7 +100,9 @@ def basic_auth_check():
def
send_authenticated
():
return
Response
(
''
,
401
,{
'WWW-Authenticate'
:
'Basic realm="Login Required"'
})
global
local_ip
if
not
local_ip
:
local_ip
=
public
.
GetLocalIp
()
return
Response
(
''
,
401
,{
'WWW-Authenticate'
:
'Basic realm="
%
s"'
%
local_ip
})
@
app
.
route
(
'/'
,
methods
=
method_all
)
def
home
():
...
...
@@ -311,6 +314,35 @@ def firewall_new(pdata = None):
return
publicObject
(
firewallObject
,
defs
,
None
,
pdata
);
@
app
.
route
(
'/monitor'
,
methods
=
method_all
)
def
panel_monitor
(
pdata
=
None
):
comReturn
=
comm
.
local
()
if
comReturn
:
return
comReturn
import
monitor
dataObject
=
monitor
.
Monitor
()
defs
=
(
'get_access_ip'
,
'get_exception'
,
'get_exception_logs'
,
'get_attack_nums'
,
'php_count'
,
'return_php'
,
'mysql_client_count'
)
return
publicObject
(
dataObject
,
defs
,
None
,
pdata
)
@
app
.
route
(
'/san'
,
methods
=
method_all
)
def
san_baseline
(
pdata
=
None
):
comReturn
=
comm
.
local
()
if
comReturn
:
return
comReturn
import
san_baseline
dataObject
=
san_baseline
.
san_baseline
()
defs
=
(
'start'
,
'get_api_log'
,
'get_resut'
,
'get_ssh_errorlogin'
)
return
publicObject
(
dataObject
,
defs
,
None
,
pdata
)
@
app
.
route
(
'/abnormal'
,
methods
=
method_all
)
def
abnormal
(
pdata
=
None
):
comReturn
=
comm
.
local
()
if
comReturn
:
return
comReturn
import
abnormal
dataObject
=
abnormal
.
abnormal
()
defs
=
(
'mysql_server'
,
'mysql_cpu'
,
'mysql_count'
,
'php_server'
,
'php_conn_max'
,
'php_cpu'
,
'CPU'
,
'Memory'
,
'disk'
,
'not_root_user'
,
'start'
)
return
publicObject
(
dataObject
,
defs
,
None
,
pdata
)
@
app
.
route
(
'/files'
,
methods
=
method_all
)
def
files
(
pdata
=
None
):
comReturn
=
comm
.
local
()
...
...
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