Submit Search
Upload
Learn python in 30 min - 3
•
1 like
•
502 views
Chia-Hao Tsai
Follow
Python Class - Remote object
Read less
Read more
Technology
Report
Share
Report
Share
1 of 47
Download now
Download to read offline
Recommended
RSpec 讓你愛上寫測試
RSpec 讓你愛上寫測試
Wen-Tien Chang
Agile meetup - user story mapping workshop
Agile meetup - user story mapping workshop
Jen-Chieh Ko
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
Andy Dai
110824 knoss-windows系统机制浅析
110824 knoss-windows系统机制浅析
Zoom Quiet
QCon - 一次 Clojure Web 编程实战
QCon - 一次 Clojure Web 编程实战
dennis zhuang
Learn python 2 - Real World Case
Learn python 2 - Real World Case
Chia-Hao Tsai
模块一-Go语言特性.pdf
模块一-Go语言特性.pdf
czzz1
Apk explorer1
Apk explorer1
Xiaoping Feng
Recommended
RSpec 讓你愛上寫測試
RSpec 讓你愛上寫測試
Wen-Tien Chang
Agile meetup - user story mapping workshop
Agile meetup - user story mapping workshop
Jen-Chieh Ko
該怎麼樣(認真的)部署你的 Python Web 應用程式?
該怎麼樣(認真的)部署你的 Python Web 應用程式?
Andy Dai
110824 knoss-windows系统机制浅析
110824 knoss-windows系统机制浅析
Zoom Quiet
QCon - 一次 Clojure Web 编程实战
QCon - 一次 Clojure Web 编程实战
dennis zhuang
Learn python 2 - Real World Case
Learn python 2 - Real World Case
Chia-Hao Tsai
模块一-Go语言特性.pdf
模块一-Go语言特性.pdf
czzz1
Apk explorer1
Apk explorer1
Xiaoping Feng
Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
Net 相依性注入 學習筆記 1.0
Net 相依性注入 學習筆記 1.0
智興 陳
Binary exploitation - AIS3
Binary exploitation - AIS3
Angel Boy
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Angel Boy
為什麼 App 卡卡的
為什麼 App 卡卡的
鈺翔 林
04 Delegation and Core Location
04 Delegation and Core Location
Tom Fan
Elastic stack day-1
Elastic stack day-1
YI-CHING WU
Ch3 basic command(2013 ncu-nos_nm)
Ch3 basic command(2013 ncu-nos_nm)
Kir Chou
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
Max Lai
[2019.05] HST - RegEx 101 ~ 1001
[2019.05] HST - RegEx 101 ~ 1001
Chia-Hao Tsai
[2019.02.16] hst - orm
[2019.02.16] hst - orm
Chia-Hao Tsai
[2019.01.12] hst iptables 101 to 301
[2019.01.12] hst iptables 101 to 301
Chia-Hao Tsai
[2018.12.15] hst python object 102
[2018.12.15] hst python object 102
Chia-Hao Tsai
[2018.11.16] Python Object 101
[2018.11.16] Python Object 101
Chia-Hao Tsai
[2017.03.18] hst binary training part 1
[2017.03.18] hst binary training part 1
Chia-Hao Tsai
Rootkit 102 - Kernel-Based Rootkit
Rootkit 102 - Kernel-Based Rootkit
Chia-Hao Tsai
Rootkit 101 - 2nd Edition
Rootkit 101 - 2nd Edition
Chia-Hao Tsai
ELF 101
ELF 101
Chia-Hao Tsai
Maker - WiFi AP
Maker - WiFi AP
Chia-Hao Tsai
Learn Python in 30 min - 4
Learn Python in 30 min - 4
Chia-Hao Tsai
Learn python 1
Learn python 1
Chia-Hao Tsai
HoneyCon 2014
HoneyCon 2014
Chia-Hao Tsai
More Related Content
Similar to Learn python in 30 min - 3
Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
Net 相依性注入 學習筆記 1.0
Net 相依性注入 學習筆記 1.0
智興 陳
Binary exploitation - AIS3
Binary exploitation - AIS3
Angel Boy
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Angel Boy
為什麼 App 卡卡的
為什麼 App 卡卡的
鈺翔 林
04 Delegation and Core Location
04 Delegation and Core Location
Tom Fan
Elastic stack day-1
Elastic stack day-1
YI-CHING WU
Ch3 basic command(2013 ncu-nos_nm)
Ch3 basic command(2013 ncu-nos_nm)
Kir Chou
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
Max Lai
Similar to Learn python in 30 min - 3
(9)
Python 于 webgame 的应用
Python 于 webgame 的应用
Net 相依性注入 學習筆記 1.0
Net 相依性注入 學習筆記 1.0
Binary exploitation - AIS3
Binary exploitation - AIS3
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
為什麼 App 卡卡的
為什麼 App 卡卡的
04 Delegation and Core Location
04 Delegation and Core Location
Elastic stack day-1
Elastic stack day-1
Ch3 basic command(2013 ncu-nos_nm)
Ch3 basic command(2013 ncu-nos_nm)
使用 Pytest 進行單元測試 (PyCon TW 2021)
使用 Pytest 進行單元測試 (PyCon TW 2021)
More from Chia-Hao Tsai
[2019.05] HST - RegEx 101 ~ 1001
[2019.05] HST - RegEx 101 ~ 1001
Chia-Hao Tsai
[2019.02.16] hst - orm
[2019.02.16] hst - orm
Chia-Hao Tsai
[2019.01.12] hst iptables 101 to 301
[2019.01.12] hst iptables 101 to 301
Chia-Hao Tsai
[2018.12.15] hst python object 102
[2018.12.15] hst python object 102
Chia-Hao Tsai
[2018.11.16] Python Object 101
[2018.11.16] Python Object 101
Chia-Hao Tsai
[2017.03.18] hst binary training part 1
[2017.03.18] hst binary training part 1
Chia-Hao Tsai
Rootkit 102 - Kernel-Based Rootkit
Rootkit 102 - Kernel-Based Rootkit
Chia-Hao Tsai
Rootkit 101 - 2nd Edition
Rootkit 101 - 2nd Edition
Chia-Hao Tsai
ELF 101
ELF 101
Chia-Hao Tsai
Maker - WiFi AP
Maker - WiFi AP
Chia-Hao Tsai
Learn Python in 30 min - 4
Learn Python in 30 min - 4
Chia-Hao Tsai
Learn python 1
Learn python 1
Chia-Hao Tsai
HoneyCon 2014
HoneyCon 2014
Chia-Hao Tsai
Passwd crack introduction
Passwd crack introduction
Chia-Hao Tsai
Security coding c and c++ ch8(2)
Security coding c and c++ ch8(2)
Chia-Hao Tsai
Security coding c and c++ ch8 (1)
Security coding c and c++ ch8 (1)
Chia-Hao Tsai
Build web server
Build web server
Chia-Hao Tsai
Rootkit tw(0224)
Rootkit tw(0224)
Chia-Hao Tsai
More from Chia-Hao Tsai
(18)
[2019.05] HST - RegEx 101 ~ 1001
[2019.05] HST - RegEx 101 ~ 1001
[2019.02.16] hst - orm
[2019.02.16] hst - orm
[2019.01.12] hst iptables 101 to 301
[2019.01.12] hst iptables 101 to 301
[2018.12.15] hst python object 102
[2018.12.15] hst python object 102
[2018.11.16] Python Object 101
[2018.11.16] Python Object 101
[2017.03.18] hst binary training part 1
[2017.03.18] hst binary training part 1
Rootkit 102 - Kernel-Based Rootkit
Rootkit 102 - Kernel-Based Rootkit
Rootkit 101 - 2nd Edition
Rootkit 101 - 2nd Edition
ELF 101
ELF 101
Maker - WiFi AP
Maker - WiFi AP
Learn Python in 30 min - 4
Learn Python in 30 min - 4
Learn python 1
Learn python 1
HoneyCon 2014
HoneyCon 2014
Passwd crack introduction
Passwd crack introduction
Security coding c and c++ ch8(2)
Security coding c and c++ ch8(2)
Security coding c and c++ ch8 (1)
Security coding c and c++ ch8 (1)
Build web server
Build web server
Rootkit tw(0224)
Rootkit tw(0224)
Learn python in 30 min - 3
1.
Learn Python in
30 min -3 cmj 1
2.
接下來要教大家的是 2
3.
3
4.
• 沒有控制,你就不能 • 同時操作兩台以上機器 •
機器間的互動行為 • 擬人操作 4
5.
• 遠端控制有很多種 • 遠端指令
(Remote Command) • 遠端桌面 (Remote DeskTop) 5
6.
• 遠端控制有很多種 • 遠端指令
(Remote Command) • 遠端桌面 (Remote DeskTop) • 但這不是我們要的 6
7.
• 除非 • 你想要利用程式得到
UI 訊息 • 你想要確定 I/O 功能正常 • 或者你是真的要測試遠端桌面可以用 7
8.
• 所以我們需要的是:遠端操作機器,就跟在 local
一樣 • 遠端物件 (Remote Object) • 操作的是程式碼 • 程式碼在 remote 執行 === local 執行 8
9.
• 像是 • 開檔案 •
判斷檔案在不在 • 確定現在使用者身份 • … etc 9
10.
這樣的好處? 10
11.
遠端機器 === 你程式的參數 11
12.
所以你需要的是... 12
13.
• 定義一個函數:邏輯依舊,但是 • 機器變成參數的一部分 •
你可以一口氣在 n (n>2) 台機器上跑 • 輪流在個別機器執行 • 結果回存在執行的機器上 13
14.
14
15.
• PyRO (Python
Remote Object) • 好用的第三方套件 • 部署在支援 Python 的機器上 • 幾乎平台無關 15
16.
• 兩個部分 • Server
- 發出指令 • 指定特定一台 client 的特定 object • 給予參數執行並且得到結果 • Client - 接受指令 • 公開很多 object • 等待指令執行 16
17.
• Server • 我想要
client A 的 whoAmI 指令 • 表示我想呼叫 client A 的 whoAmI method • Client • 公開 whoAmI 指令 • 等著 server 說:我想要知道你是誰 17
18.
• Client Side
有以下重點 • 必須只能 exposed object • Server 只能呼叫 object 的 method • 要注意生命週期∼ 18
19.
• Client Side
有以下重點 • 必須只能 exposed object • Server 只能呼叫 object 的 method • 要注意生命週期∼ 開發的人腦海要有這句話 19
20.
Client Side 20
21.
Client Side 21 公開的物件
22.
• 執行 client.py
之後 • 會隨機產生一個聽 localhost 的 socket • 有相對應的 URI • Server 靠這個 URI 來判斷是哪一個 client 22
23.
run client.py 23
24.
• Server Side
有以下重點 • 確定這個 client exposed obj 的 URI 是對的 • 了解 client exposed 的 object 有啥能力 (method) • dir 在這時候是有用的 ! 24
25.
Server Side 25
26.
26 執⾏行的結果 ⽤用 dir 來偷看能⼒力
27.
但是這樣很不方便 27
28.
• 每次都要記錄 client
的 URI:沒人這麼無聊 • 每次都只能在 localhost:我就是要多台機器互動 28
29.
其實 Document 有教你 29
30.
• 注意看 Pyro4.Daemon
/ Pyro4.register 的 help • 表示 client 有自己的名稱:通常是IP:PORT • 相對的,object 也有相對也有特定的 URI • 就叫做 PYRO:OBJECT_NAME@IP:PORT 30
31.
重要的是... 31
32.
已經有人包成函示庫了 32
33.
33
34.
• 我已經寫成一個類別 • 你選擇需要
exposed object 就會處理後續工作,包含 • 聽特定的 Port • exposed 成固定的 FORMAT 34
35.
35 新增/刪除物件
36.
36 實際註冊物件/執⾏行 client
37.
37 實際註冊物件
38.
38 執⾏行 client 程式
39.
• 這樣,你就可以根據 • 定義得
FORMAT 來使用 Remote Object • 像是 • FORMAT = PYRO:obj_{name}@IP:PORT • name 是原本 class 該有的名稱 • Pyro4.Proxy(“PYRO:obj_{name}@{host}:{port}”) 39
40.
這樣,一切又變成函數了>.^ 40
41.
又不免俗的 41
42.
• Pyro 真的博大精深 •
不過不用讀完 document • 相對的,需要思考到底需要哪些遠端操作 • 而這些是程式可以完成的 42
43.
不然我也希望有程式可以幫我寫扣 43
44.
簡單的 Client/Server • Client
可以完成一件功能 • exposed 一個可以使用的 object • 不能是 Slides 上的範例 • 固定一個 object 的 URI • Server 可以 • 根據 client 的 IP,就可以使用 remote object 44
45.
複雜的 Client/Server • 多個
Client / 一個 Server 架構 • Client • Exposed object:目前機器的運行時間 (Second) • Exposed object:目前剩餘的使用空間 (MB) • Server • 給定所有 Client IP • 找到運行最久的機器 • 全部機器的剩餘空間 45
46.
• Ref • Pyro
[https://pythonhosted.org/Pyro4/] 46
47.
Thanks for your
attentions 47
Download now