forked from mrknow001/aliyun-accesskey-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OSSTools.py
411 lines (390 loc) · 18.8 KB
/
OSSTools.py
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
import function, sys
from functools import partial
from PyQt5.QtCore import QThread, pyqtSignal
import images
from PyQt5.Qt import QIcon
from PyQt5.QtWidgets import QTableWidgetItem
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1176, 740)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.pushButton.setFont(font)
self.pushButton.setObjectName("pushButton")
self.gridLayout.addWidget(self.pushButton, 0, 5, 2, 1)
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.pushButton_2.setFont(font)
self.pushButton_2.setObjectName("pushButton_2")
self.gridLayout.addWidget(self.pushButton_2, 10, 4, 1, 1)
self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.pushButton_3.setFont(font)
self.pushButton_3.setObjectName("pushButton_3")
self.gridLayout.addWidget(self.pushButton_3, 4, 9, 1, 1)
self.label_10 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_10.setFont(font)
self.label_10.setObjectName("label_10")
self.gridLayout.addWidget(self.label_10, 8, 6, 1, 1)
self.lineEdit_5 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_5.setFont(font)
self.lineEdit_5.setObjectName("lineEdit_5")
self.gridLayout.addWidget(self.lineEdit_5, 4, 6, 1, 3)
self.lineEdit_3 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_3.setFont(font)
self.lineEdit_3.setText("")
self.lineEdit_3.setObjectName("lineEdit_3")
self.gridLayout.addWidget(self.lineEdit_3, 8, 1, 1, 2)
self.label_4 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_4.setFont(font)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 9, 0, 1, 1)
self.label_6 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.label_6.setFont(font)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 2, 6, 1, 2)
self.label_5 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_5.setFont(font)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 10, 0, 1, 1)
self.lineEdit_6 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_6.setFont(font)
self.lineEdit_6.setText("")
self.lineEdit_6.setObjectName("lineEdit_6")
self.gridLayout.addWidget(self.lineEdit_6, 6, 7, 1, 3)
self.label_11 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_11.setFont(font)
self.label_11.setObjectName("label_11")
self.gridLayout.addWidget(self.label_11, 9, 6, 1, 1)
self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.pushButton_4.setFont(font)
self.pushButton_4.setObjectName("pushButton_4")
self.gridLayout.addWidget(self.pushButton_4, 9, 8, 1, 2)
self.label_8 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_8.setFont(font)
self.label_8.setObjectName("label_8")
self.gridLayout.addWidget(self.label_8, 6, 6, 1, 1)
self.label_2 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1)
self.comboBox_3 = QtWidgets.QComboBox(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.comboBox_3.setFont(font)
self.comboBox_3.setObjectName("comboBox_3")
self.comboBox_3.addItem("")
self.comboBox_3.addItem("")
self.gridLayout.addWidget(self.comboBox_3, 9, 7, 1, 1)
self.label_3 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_3.setFont(font)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 8, 0, 1, 1)
self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.tableWidget.setFont(font)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(12)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(7, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(8, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(9, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(10, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(11, item)
self.gridLayout.addWidget(self.tableWidget, 2, 0, 6, 6)
self.listWidget = QtWidgets.QListWidget(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.listWidget.setFont(font)
self.listWidget.setObjectName("listWidget")
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget.addItem(item)
self.gridLayout.addWidget(self.listWidget, 5, 6, 1, 4)
self.label = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label.setFont(font)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_2.setFont(font)
self.lineEdit_2.setObjectName("lineEdit_2")
self.gridLayout.addWidget(self.lineEdit_2, 1, 2, 1, 1)
self.label_7 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_7.setFont(font)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 3, 6, 1, 1)
self.lineEdit_4 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_4.setFont(font)
self.lineEdit_4.setText("")
self.lineEdit_4.setObjectName("lineEdit_4")
self.gridLayout.addWidget(self.lineEdit_4, 10, 1, 1, 3)
self.label_9 = QtWidgets.QLabel(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.label_9.setFont(font)
self.label_9.setObjectName("label_9")
self.gridLayout.addWidget(self.label_9, 7, 6, 1, 1)
self.lineEdit_7 = QtWidgets.QLineEdit(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit_7.setFont(font)
self.lineEdit_7.setText("")
self.lineEdit_7.setObjectName("lineEdit_7")
self.gridLayout.addWidget(self.lineEdit_7, 8, 7, 1, 3)
self.comboBox_2 = QtWidgets.QComboBox(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.comboBox_2.setFont(font)
self.comboBox_2.setObjectName("comboBox_2")
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.comboBox_2.addItem("")
self.gridLayout.addWidget(self.comboBox_2, 7, 7, 1, 3)
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setEnabled(True)
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit.setFont(font)
self.lineEdit.setObjectName("lineEdit")
self.gridLayout.addWidget(self.lineEdit, 0, 2, 1, 1)
self.comboBox = QtWidgets.QComboBox(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(10)
self.comboBox.setFont(font)
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.gridLayout.addWidget(self.comboBox, 9, 1, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1176, 26))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
#MainWindow.setWindowTitle(_translate("MainWindow", "OSS利用工具"))
#MainWindow.setWindowIcon(_translate("MainWindow", QIcon("Gamma.jpg")))
self.pushButton.setText(_translate("MainWindow", "查询"))
self.pushButton_2.setText(_translate("MainWindow", "执行"))
self.pushButton_3.setText(_translate("MainWindow", "查询"))
self.label_10.setText(_translate("MainWindow", "端口:"))
self.label_4.setText(_translate("MainWindow", "系统:"))
self.label_6.setText(_translate("MainWindow", "安全组策略操作"))
self.label_5.setText(_translate("MainWindow", "命令:"))
self.label_11.setText(_translate("MainWindow", "方向:"))
self.pushButton_4.setText(_translate("MainWindow", "修改策略"))
self.label_8.setText(_translate("MainWindow", "安全组名:"))
self.label_2.setText(_translate("MainWindow", "AccessKeySecret:"))
self.comboBox_3.setItemText(0, _translate("MainWindow", "入口"))
self.comboBox_3.setItemText(1, _translate("MainWindow", "出口"))
self.label_3.setText(_translate("MainWindow", "实例ID:"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "实例ID"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "服务器地区"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "主机名称"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "系统版本"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "运行状态"))
item = self.tableWidget.horizontalHeaderItem(5)
item.setText(_translate("MainWindow", "私有IP"))
item = self.tableWidget.horizontalHeaderItem(6)
item.setText(_translate("MainWindow", "公网IP"))
item = self.tableWidget.horizontalHeaderItem(7)
item.setText(_translate("MainWindow", "安全组"))
item = self.tableWidget.horizontalHeaderItem(8)
item.setText(_translate("MainWindow", "云助手"))
item = self.tableWidget.horizontalHeaderItem(9)
item.setText(_translate("MainWindow", "主机配置"))
item = self.tableWidget.horizontalHeaderItem(10)
item.setText(_translate("MainWindow", "创建时间"))
item = self.tableWidget.horizontalHeaderItem(11)
item.setText(_translate("MainWindow", "过期时间"))
__sortingEnabled = self.listWidget.isSortingEnabled()
self.listWidget.setSortingEnabled(False)
item = self.listWidget.item(0)
item.setText(_translate("MainWindow", "策略"))
item = self.listWidget.item(1)
item.setText(_translate("MainWindow", "描述"))
item = self.listWidget.item(2)
item.setText(_translate("MainWindow", "优先级"))
item = self.listWidget.item(3)
item.setText(_translate("MainWindow", "创建时间"))
item = self.listWidget.item(4)
item.setText(_translate("MainWindow", "IPv6"))
item = self.listWidget.item(5)
item.setText(_translate("MainWindow", "运行状态"))
item = self.listWidget.item(6)
item.setText(_translate("MainWindow", "方向"))
item = self.listWidget.item(7)
item.setText(_translate("MainWindow", "端口范围"))
item = self.listWidget.item(8)
item.setText(_translate("MainWindow", "源IP"))
item = self.listWidget.item(9)
item.setText(_translate("MainWindow", "协议"))
item = self.listWidget.item(10)
item.setText(_translate("MainWindow", "目标IP"))
item = self.listWidget.item(11)
item.setText(_translate("MainWindow", "源组所有者帐户"))
self.listWidget.setSortingEnabled(__sortingEnabled)
self.label.setText(_translate("MainWindow", "AccessKeyID:"))
self.label_7.setText(_translate("MainWindow", "安全组名:"))
self.label_9.setText(_translate("MainWindow", "协议:"))
self.lineEdit_7.setPlaceholderText(_translate("MainWindow", "例如:8080,1/200,-1/-1 "))
self.lineEdit_3.setPlaceholderText(_translate("MainWindow", "选择实例ID自动填入 "))
self.lineEdit_5.setPlaceholderText(_translate("MainWindow", "选择实例ID自动填入 "))
self.lineEdit_6.setPlaceholderText(_translate("MainWindow", "修改功能暂不支持"))
self.comboBox_2.setItemText(0, _translate("MainWindow", "ALL"))
self.comboBox_2.setItemText(1, _translate("MainWindow", "TCP"))
self.comboBox_2.setItemText(2, _translate("MainWindow", "UDP"))
self.comboBox_2.setItemText(3, _translate("MainWindow", "ICMP"))
self.comboBox_2.setItemText(4, _translate("MainWindow", "GRE"))
self.comboBox.setItemText(0, _translate("MainWindow", "默认"))
self.comboBox.setItemText(1, _translate("MainWindow", "Windows bat脚本"))
self.comboBox.setItemText(2, _translate("MainWindow", "Windows PowerShell"))
self.comboBox.setItemText(3, _translate("MainWindow", "Linux shell"))
def show_message(ui,msg):
QtWidgets.QMessageBox.information(ui.pushButton, "温馨提示", msg)
def err_message(ui, msg):
QtWidgets.QMessageBox.warning(ui.pushButton, "警告", msg)
def test(msg):
print(msg)
def incident_key(ui):
#ui.pushButton.clicked.connect(partial(server_check_input,ui))
#ui.pushButton_2.clicked.connect(partial(show_message, ui, '11111111'))
ui.pushButton_2.clicked.connect(partial(function.commad_check_input, ui))
#ui.pushButton_3.clicked.connect(partial(function.SecurityGroup_check, ui))
ui.pushButton_3.clicked.connect(partial(show_message, ui, '抱歉,功能暂不支持,作者努力完善中!'))
class Queryhost_MyThread(QThread):
my_signal = pyqtSignal(object,str)
def __init__(self):
super().__init__()
def run(self):
massage = function.server_check_input(ui)
if massage is not None:
self.my_signal.emit(massage[0],massage[1])
Queryhost_thread = Queryhost_MyThread()
Queryhost_thread.my_signal.connect(show_message)
ui.pushButton.clicked.connect(partial(Queryhost_thread.start))
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, *args, **kwargs):
QtWidgets.QMainWindow.__init__(self, *args, **kwargs)
self.setupUi(self)
if __name__=="__main__":
app=QtWidgets.QApplication(sys.argv)
widget= QtWidgets.QMainWindow()
ui= Ui_MainWindow()
ui.setupUi(widget)
widget.setWindowTitle("Aliyun- AK Tools by Gamma")
#widget.setWindowIcon(QtGui.QIcon(":/logo.png"))
widget.show()
incident_key(ui)
sys.exit(app.exec_())