easy_whitelist 1.0.27__py2.py3-none-any.whl → 1.0.29__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- easy_whitelist/__init__.py +2 -2
- easy_whitelist/{easy.py → __main__.py} +6 -3
- easy_whitelist/config/arg.py +4 -4
- easy_whitelist/ip/ip.py +1 -1
- easy_whitelist/tcloud/template.py +1 -1
- {easy_whitelist-1.0.27.dist-info → easy_whitelist-1.0.29.dist-info}/METADATA +11 -5
- easy_whitelist-1.0.29.dist-info/RECORD +17 -0
- easy_whitelist-1.0.29.dist-info/entry_points.txt +3 -0
- easy_whitelist-1.0.27.dist-info/RECORD +0 -16
- {easy_whitelist-1.0.27.dist-info → easy_whitelist-1.0.29.dist-info}/LICENSE +0 -0
- {easy_whitelist-1.0.27.dist-info → easy_whitelist-1.0.29.dist-info}/WHEEL +0 -0
easy_whitelist/__init__.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
r"""Easy_whitelist is a
|
1
|
+
r"""Easy_whitelist is a smart tool that detects the local Internet IP address and automatically updates the local Internet IP address to the cloud security group whitelist. The tool is written in Python.
|
2
2
|
"""
|
3
|
-
__version__ = '1.0.
|
3
|
+
__version__ = '1.0.29'
|
4
4
|
# __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
|
5
5
|
|
6
6
|
__all__ = []
|
@@ -11,6 +11,7 @@ from easy_whitelist.config import arg
|
|
11
11
|
from easy_whitelist.tcloud import client
|
12
12
|
from easy_whitelist.tcloud.template import list_template, set_template, create_template
|
13
13
|
|
14
|
+
|
14
15
|
def loop_list(common_client):
|
15
16
|
template_ids = list_template(common_client)
|
16
17
|
last_input = None
|
@@ -24,13 +25,15 @@ def loop_list(common_client):
|
|
24
25
|
if (a := int(input_from_user)) > 0 and a <= len(template_ids):
|
25
26
|
set_template(common_client, template_ids[a - 1])
|
26
27
|
else:
|
27
|
-
print('Wrong
|
28
|
+
print('Wrong index, please input right index from the list.')
|
28
29
|
elif input_from_user == 'l' or input_from_user == 'L':
|
29
30
|
list_template(common_client)
|
30
31
|
elif input_from_user == 'q' or input_from_user == 'Q':
|
31
32
|
break
|
33
|
+
elif input_from_user == '':
|
34
|
+
continue
|
32
35
|
else:
|
33
|
-
print('Input error
|
36
|
+
print('Input error.')
|
34
37
|
|
35
38
|
def main():
|
36
39
|
tencent, alibaba, action, target, target_id, proxy = arg.init_arg()
|
@@ -48,6 +51,6 @@ def main():
|
|
48
51
|
else:
|
49
52
|
print('Wrong postion, shall not be here.')
|
50
53
|
|
51
|
-
if __name__ == '__main__':
|
52
54
|
|
55
|
+
if __name__ == '__main__':
|
53
56
|
main()
|
easy_whitelist/config/arg.py
CHANGED
@@ -3,15 +3,15 @@ import argparse
|
|
3
3
|
def init_arg():
|
4
4
|
'''parse parameter from command line.'''
|
5
5
|
|
6
|
-
parser = argparse.ArgumentParser(prog='
|
6
|
+
parser = argparse.ArgumentParser(prog='easy', description='This is a cloud acl auto whitelist tool.', epilog='Enjoy the tool. :) ')
|
7
7
|
|
8
|
-
my_group = parser.add_mutually_exclusive_group(required=
|
9
|
-
my_group.add_argument('-t', '-T', '--tencent', action='store_true', help='tencent cloud')
|
8
|
+
my_group = parser.add_mutually_exclusive_group(required=False)
|
9
|
+
my_group.add_argument('-t', '-T', '--tencent', action='store_true', default=True, help='tencent cloud')
|
10
10
|
my_group.add_argument('-a', '-A', '--alibaba', action='store_true', help='alibaba cloud')
|
11
11
|
|
12
12
|
parser.add_argument('-p', '-P', '--proxy', action='store', default=-1, type=int, help ='local HTTP proxy port')
|
13
13
|
|
14
|
-
parser.add_argument('target', help='template or
|
14
|
+
parser.add_argument('target', help='template or rule_id', choices=['template', 'rule_id'])
|
15
15
|
parser.add_argument('action', help='list', choices=['list', 'set', 'create'])
|
16
16
|
parser.add_argument('target_id', help='template id or rule id', nargs='?')
|
17
17
|
|
easy_whitelist/ip/ip.py
CHANGED
@@ -10,7 +10,7 @@ def get_local_ip_from_url_and_parse(u, patt, ag):
|
|
10
10
|
headers = {'user-agent': ag}
|
11
11
|
# print(f'user_agent:{ag}')
|
12
12
|
try:
|
13
|
-
response = requests.get(u, headers=headers, timeout=
|
13
|
+
response = requests.get(u, headers=headers, timeout=5)
|
14
14
|
# 获取响应内容
|
15
15
|
respon = response.text
|
16
16
|
l_ip = url.parse_ip_from_response(respon, patt)
|
@@ -39,7 +39,7 @@ def list_template(common_client):
|
|
39
39
|
# print(template_ids)
|
40
40
|
addreset = ' ~ '.join(template['AddressSet'][:3])
|
41
41
|
if len(template['AddressSet']) > 3:
|
42
|
-
addreset += f' ~~~{len(template["AddressSet"])-3} more...'
|
42
|
+
addreset += f' ~~~ {len(template["AddressSet"])-3} more...'
|
43
43
|
print(f"{str(i):10}"
|
44
44
|
f"{template['AddressTemplateId']:20}"
|
45
45
|
f"{template['CreatedTime']:30}"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: easy_whitelist
|
3
|
-
Version: 1.0.
|
4
|
-
Summary: Easy_whitelist is a
|
3
|
+
Version: 1.0.29
|
4
|
+
Summary: Easy_whitelist is a smart tool that detects the local Internet IP address and automatically updates the local Internet IP address to the cloud security group whitelist. The tool is written in Python.
|
5
5
|
Keywords: automation,whitelist,acl,security-groups,alibaba-cloud,tencent-cloud,security-tools,security-group-rule
|
6
6
|
Author: qiqilelebaobao
|
7
7
|
Author-email: qiqilelebaobao <qiqilelebaobao@163.com>
|
@@ -26,7 +26,7 @@ Project-URL: Homepage, https://github.com/qiqilelebaobao/easy_whitelist
|
|
26
26
|
|
27
27
|
Easy_whitelist 是一个探测本机互联网 IP 地址,将并本机互联网IP地址,自动更新到云安全组白名单的小工具。工具使用 Python 编写。
|
28
28
|
|
29
|
-
Easy_whitelist is a
|
29
|
+
Easy_whitelist is a smart tool that detects the local Internet IP address and automatically updates the local Internet IP address to the cloud security group whitelist. The tool is written in Python.
|
30
30
|
|
31
31
|
主要功能包括:
|
32
32
|
* 自动探测本机互联网 IP 地址
|
@@ -53,9 +53,15 @@ Main functions include:
|
|
53
53
|
需要 Python3 环境
|
54
54
|
Python3 is required
|
55
55
|
|
56
|
-
## 使用说明
|
56
|
+
## 使用说明 Basic Usage
|
57
57
|
|
58
|
+
* 通过列表选择模版,设置白名单
|
58
59
|
```shell
|
59
|
-
$
|
60
|
+
$ easy template list
|
61
|
+
```
|
62
|
+
|
63
|
+
* 通过新创建模版,设置白名单。需要指定关联的安全组ID
|
64
|
+
```shell
|
65
|
+
$ easy template create rule_id
|
60
66
|
```
|
61
67
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
easy_whitelist/__init__.py,sha256=B9ePwbNJaL7BecbFcwmoPT7MM91G4AukZwlJzW7QlMQ,303
|
2
|
+
easy_whitelist/__main__.py,sha256=8N3DqF3_9JNiq1qgZcOubPyUA0v7jmnz2deBBtMLdEQ,1801
|
3
|
+
easy_whitelist/config/__init__.py,sha256=fK-lJ3GD4u1_FGkZfPf-f7fxjMwb1t0AZcG7mfIHLks,19
|
4
|
+
easy_whitelist/config/arg.py,sha256=hB1CSpDfbIPykf8e-OqeKHStDujXGNaFk2guxdupAnE,1024
|
5
|
+
easy_whitelist/ip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
easy_whitelist/ip/agent.py,sha256=dJDkw1mipazcOyldbBZW5Mhjr17UqDlaBn2jUo80C7I,487
|
7
|
+
easy_whitelist/ip/ip.py,sha256=ri4KcamYJY3WRhOIPrtctlrhs2WO5Q_qDy661-dizb0,1595
|
8
|
+
easy_whitelist/ip/pattern.py,sha256=184XTlT0087eBZbm9LC5AB38PMLazQueW8E7l4jSwkM,149
|
9
|
+
easy_whitelist/ip/url.py,sha256=pZeexIQfJFWv-KdlOIAOVVk5aap4dyLsu2CiV8i9ofw,438
|
10
|
+
easy_whitelist/tcloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
+
easy_whitelist/tcloud/client.py,sha256=Cbx66K8S7fAMto9GJMynOplbgk1m-QWg863BxeO0D24,785
|
12
|
+
easy_whitelist/tcloud/template.py,sha256=Q2RX6uZVMMS0EhwVPXn1Ume5hBDQDslgaxXIic-cEvQ,5854
|
13
|
+
easy_whitelist-1.0.29.dist-info/entry_points.txt,sha256=-URzXdGXqVTDQm_AhH9k0u4Qm9G0s4ZDXcnA-XQt73Q,53
|
14
|
+
easy_whitelist-1.0.29.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
|
15
|
+
easy_whitelist-1.0.29.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
16
|
+
easy_whitelist-1.0.29.dist-info/METADATA,sha256=4wlj2ZJlJLaFYfQR7NI3JFRMiB5W_DhPTtp2Mu1cFYA,3301
|
17
|
+
easy_whitelist-1.0.29.dist-info/RECORD,,
|
@@ -1,16 +0,0 @@
|
|
1
|
-
easy_whitelist/__init__.py,sha256=3SuS3TMcAfJh0kBoPFQh_kPQl5DUiFWbNPQ80yxUa14,303
|
2
|
-
easy_whitelist/easy.py,sha256=_dUY-U_y0k2IFgQwq5KTauOcKXBF5T1ARC_Vl82eyPw,1727
|
3
|
-
easy_whitelist/config/__init__.py,sha256=fK-lJ3GD4u1_FGkZfPf-f7fxjMwb1t0AZcG7mfIHLks,19
|
4
|
-
easy_whitelist/config/arg.py,sha256=Ytk9fKXd2-k0C01SHGtbYJGYVz2VqR8eDanJExZrPi4,1017
|
5
|
-
easy_whitelist/ip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
easy_whitelist/ip/agent.py,sha256=dJDkw1mipazcOyldbBZW5Mhjr17UqDlaBn2jUo80C7I,487
|
7
|
-
easy_whitelist/ip/ip.py,sha256=osThmW339MiJZ2R7h0YGkyKDIDINu9yItA5X4ghUw88,1596
|
8
|
-
easy_whitelist/ip/pattern.py,sha256=184XTlT0087eBZbm9LC5AB38PMLazQueW8E7l4jSwkM,149
|
9
|
-
easy_whitelist/ip/url.py,sha256=pZeexIQfJFWv-KdlOIAOVVk5aap4dyLsu2CiV8i9ofw,438
|
10
|
-
easy_whitelist/tcloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
easy_whitelist/tcloud/client.py,sha256=Cbx66K8S7fAMto9GJMynOplbgk1m-QWg863BxeO0D24,785
|
12
|
-
easy_whitelist/tcloud/template.py,sha256=8SuN2oLiYzgfySb3-Bc5EEuZon8sE5ea3n0QFdnM8Ys,5853
|
13
|
-
easy_whitelist-1.0.27.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
|
14
|
-
easy_whitelist-1.0.27.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
15
|
-
easy_whitelist-1.0.27.dist-info/METADATA,sha256=jw6fyVS-MrAqI9D2pVIpHNfXbMiS7vv5uFYwwy3VGkI,3149
|
16
|
-
easy_whitelist-1.0.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|