-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
187 lines (180 loc) · 5.22 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown>
<script type="text/template">
## Python在运维领域的运用
#### by:蓝雪
</script>
</section>
<section data-markdown>
<script type="text/template">
## 一切基于需求
* 选择技术栈
* 选择框架
* 丰富的Python库
* 常用开发技巧
* 技能升级拓展
</script>
</section>
<section>
<section>选择技术栈</section>
<section data-markdown>
<script type="text/template">
- 部署
- 监控
- 管理
- 维护
- 优化
- 防护
</script>
</section>
</section>
<section>
<section>选择框架</section>
<section data-markdown>
<script type="text/template">
- Saltstack :模块多,可扩展性强
- Openstack :云计算平台,管理虚拟机与存储资源
- Puppet(Ruby):支持资源之间的关系配置
- Ansible :类似远程命令执行,只需在主控端部署
- ……
</script>
</section>
</section>
<section>丰富的Python库
<section data-markdown>
<script type="text/template">
## 获取Windows系统信息——wmi
```python
c = wmi.WMI ()
c.Win32_Service ()
c.Win32_DiskDrive ()
c.Win32_Processor()
```
</script>
</section>
<section data-markdown>
<script type="text/template">
## 操作windows窗体——
### win32api,win32con,win32gui
```python
FindWindow(lpClassName=None, lpWindowName=None)
FindWindowEx(hwndParent=0, hwndChildAfter=0, lpszClass=None, lpszWindow=None)
win32gui.SendMessage(tid, win32con.WM_SETTEXT, None, 'hello')
win32gui.PostMessage(tid, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0)
win32gui.PostMessage(tid, win32con.WM_KEYUP, win32con.VK_RETURN, 0)
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### 操作注册表——winreg
```python
root = winreg.HKEY_LOCAL_MACHINE
subkey = r'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
winreg.OpenKey(root, subkey, 0, winreg.KEY_READ)}}
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### 读写配置文件 ——ConfigParser
```python
import ConfigParser
cf = ConfigParser.ConfigParser()
cf.read("test.conf")
s = cf.sections()
db_host = cf.get("db", "db_host")
```
</script>
</section>
</section>
<section>常用的开发技巧
<section data-markdown>
<script type="text/template">
### 应对版本差异
##### 方法一:
```python
if sys.hexversion > 0x03000000:
import winreg
else:
import _winreg as winreg
```
##### 方法二:
```python
try:
import winreg
except:
import _winreg as winreg
```
</script>
</section>
<section data-markdown>
<script type="text/template">
### 应对系统差异
- 换行符差异:
- linux:\n
- windows: \r\n
- 后台运行的方式
- linux: &
- windows: start /B
</script>
</section>
</section>
<section>技能升级拓展
<section data-markdown>
<script type="text/template">
### 运维管理->安全管理
- 弱密码
- 使用默认配置
- 端口开放不当
- 预置账户与密码
- 字符串处理不当:Tornado框架缺陷
- 备份文件或测试文件未删除
</script>
</section>
<!-- <section data-markdown> -->
<!-- <script type="text/template"> -->
<!-- # 谢谢! -->
<!-- </script> -->
<!-- </section> -->
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>