Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
coco
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
ops
coco
Commits
80afe455
Commit
80afe455
authored
Jul 06, 2018
by
BaiJiangJie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 在线会话,历史会话显示登录来源 Web/SSH Terminal
parent
f6ca83c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
7 deletions
+9
-7
connection.py
coco/connection.py
+1
-1
httpd.py
coco/httpd.py
+1
-1
interactive.py
coco/interactive.py
+1
-1
proxy.py
coco/proxy.py
+3
-2
session.py
coco/session.py
+3
-2
No files found.
coco/connection.py
View file @
80afe455
...
...
@@ -166,7 +166,7 @@ class TelnetConnection:
self
.
sock
=
None
self
.
sel
=
selectors
.
DefaultSelector
()
self
.
incorrect_pattern
=
re
.
compile
(
r'incorrect|failed|失败'
,
re
.
I
r'incorrect|failed|失败
|错误
'
,
re
.
I
)
self
.
username_pattern
=
re
.
compile
(
r'login:\s*$|username:\s*$|用户名:\s*$|账\s*号:\s*$'
,
re
.
I
...
...
coco/httpd.py
View file @
80afe455
...
...
@@ -127,7 +127,7 @@ class ProxyNamespace(BaseNamespace):
child
,
parent
=
socket
.
socketpair
()
client
=
Client
(
parent
,
room
[
"request"
])
forwarder
=
ProxyServer
(
client
)
forwarder
=
ProxyServer
(
client
,
login_from
=
'WT'
)
room
[
"client"
]
=
client
room
[
"forwarder"
]
=
forwarder
room
[
"proxy"
]
=
WSProxy
(
self
,
child
,
room
[
"id"
])
...
...
coco/interactive.py
View file @
80afe455
...
...
@@ -260,7 +260,7 @@ class InteractiveServer:
if
system_user
is
None
:
self
.
client
.
send
(
_
(
"没有系统用户"
))
return
forwarder
=
ProxyServer
(
self
.
client
)
forwarder
=
ProxyServer
(
self
.
client
,
login_from
=
'ST'
)
forwarder
.
proxy
(
asset
,
system_user
)
def
interact
(
self
):
...
...
coco/proxy.py
View file @
80afe455
...
...
@@ -23,9 +23,10 @@ AUTO_LOGIN = 'auto'
class
ProxyServer
:
def
__init__
(
self
,
client
):
def
__init__
(
self
,
client
,
login_from
):
self
.
client
=
client
self
.
server
=
None
self
.
login_from
=
login_from
self
.
connecting
=
True
self
.
stop_event
=
threading
.
Event
()
...
...
@@ -62,7 +63,7 @@ class ProxyServer:
command_recorder
=
current_app
.
new_command_recorder
()
replay_recorder
=
current_app
.
new_replay_recorder
()
session
=
Session
(
self
.
client
,
self
.
server
,
self
.
client
,
self
.
server
,
self
.
login_from
,
command_recorder
=
command_recorder
,
replay_recorder
=
replay_recorder
,
)
...
...
coco/session.py
View file @
80afe455
...
...
@@ -14,10 +14,11 @@ logger = get_logger(__file__)
class
Session
:
def
__init__
(
self
,
client
,
server
,
command_recorder
=
None
,
replay_recorder
=
None
):
def
__init__
(
self
,
client
,
server
,
login_from
,
command_recorder
=
None
,
replay_recorder
=
None
):
self
.
id
=
str
(
uuid
.
uuid4
())
self
.
client
=
client
# Master of the session, it's a client sock
self
.
server
=
server
# Server channel
self
.
login_from
=
login_from
# Login from
self
.
_watchers
=
[]
# Only watch session
self
.
_sharers
=
[]
# Join to the session, read and write
self
.
replaying
=
True
...
...
@@ -174,7 +175,7 @@ class Session:
"user"
:
self
.
client
.
user
.
username
,
"asset"
:
self
.
server
.
asset
.
hostname
,
"system_user"
:
self
.
server
.
system_user
.
username
,
"login_from"
:
"ST"
,
"login_from"
:
self
.
login_from
,
"remote_addr"
:
self
.
client
.
addr
[
0
],
"is_finished"
:
True
if
self
.
stop_evt
.
is_set
()
else
False
,
"date_last_active"
:
self
.
date_last_active
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
+
" +0000"
,
...
...
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