Server:1 Client:*
┌────────────────┐ ┌────────────────┐
│ │ TCP connection │ │
│ │◄----------------------------│ │
│ pyrc.py │ │ pyrc.py │
│ │ Execute │ │
│ │ List │ │
│ │ Upload │ │
│ │ Download │ │
│ │ Message │ │
│ │ │ │
│ │◄---------------------------►│ │
└────────────────┘ └────────────────┘
- Supported three major operating systems,
Windows
,Linux
,macOS
. - Supported four major functions,
Execute
,List
,Update
,Download
, andMessage
(customized actions). - Inner command by
Message
:get_sysinfo
make_dir
def thread_routine(server: rcserver):
if server:
server.start()
if __name__ == '__main__':
server = rcserver(_HOST_, _PORT_, debug_enabled=True)
thread = threading.Thread(target=thread_routine, args=(server,))
thread.daemon = True
thread.start()
if __name__ == '__main__':
client = rcclient()
if client.connect(_HOST_, _PORT_):
result: rcresult = client.execute('ls')
result: rcresult = client.upload('id_rsa.pub', '~/.ssh')
result: rcresult = client.download('~/.ssh/id_rsa.pub', '.')
result: rcresult = client.list('.')
+--------------------------------------------------------------+
| Header | Payload |
0 1 2 3 | (data+chunk) |
0123456789'123456789'123456789'... |
|-------------------------------|------------------------------|
|a || || | | | |
^^^^^^^^|b || | | payload_data | payload_chunk |
^^^^|c | |d |e |
^^^^ |^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^|
a: signature [00:07]
b: header_size [08:11]
c: total_size [12:15]
d: payload_data [payload:length_payload_data]
e: payload_chunk [payload+length_payload_chunk:total_size]
Command Client Server
===============================
upload ask --->
data --->
done --->
<--- done
-------------------------------
download ask --->
<--- data
<--- done
-------------------------------
list ask --->
<--- data
<--- done
-------------------------------
execute ask --->
<--- data
<--- done
-------------------------------
class execute_subcmd(Enum):
unknown = 0
start = 1
query = 2
kill = 3
Apache