easy_whitelist 1.0.44__py3-none-any.whl → 1.0.48__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 +4 -3
- easy_whitelist/config/arg.py +1 -1
- easy_whitelist/ip/ip.py +8 -4
- easy_whitelist/ip/pattern.py +1 -0
- easy_whitelist/ip/url.py +4 -3
- easy_whitelist/tcloud/template.py +3 -1
- {easy_whitelist-1.0.44.dist-info → easy_whitelist-1.0.48.dist-info}/METADATA +7 -3
- {easy_whitelist-1.0.44.dist-info → easy_whitelist-1.0.48.dist-info}/RECORD +11 -11
- {easy_whitelist-1.0.44.dist-info → easy_whitelist-1.0.48.dist-info}/LICENSE +0 -0
- {easy_whitelist-1.0.44.dist-info → easy_whitelist-1.0.48.dist-info}/WHEEL +0 -0
- {easy_whitelist-1.0.44.dist-info → easy_whitelist-1.0.48.dist-info}/entry_points.txt +0 -0
easy_whitelist/__init__.py
CHANGED
@@ -1,6 +1,7 @@
|
|
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
|
-
"""
|
3
|
-
|
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
|
+
# """
|
3
|
+
|
4
|
+
#__version__ = '1.0.48'
|
4
5
|
# __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
|
5
6
|
|
6
7
|
__all__ = []
|
easy_whitelist/config/arg.py
CHANGED
@@ -12,7 +12,7 @@ def init_arg():
|
|
12
12
|
parser.add_argument('-p', '-P', '--proxy', action='store', default=None, type=int, help ='local HTTP proxy port')
|
13
13
|
parser.add_argument('-v', '--verbose', action='count', default=0)
|
14
14
|
|
15
|
-
parser.add_argument('target', help='template or
|
15
|
+
parser.add_argument('target', help='template or rule', choices=['template', 'rule'])
|
16
16
|
parser.add_argument('action', help='list', choices=['list', 'set', 'create'])
|
17
17
|
parser.add_argument('target_id', help='template id or rule id', nargs='?')
|
18
18
|
|
easy_whitelist/ip/ip.py
CHANGED
@@ -7,11 +7,15 @@ import logging
|
|
7
7
|
|
8
8
|
from . import url
|
9
9
|
|
10
|
-
def get_local_ip_from_url_and_parse(u, patt, ag, proxy=None):
|
10
|
+
def get_local_ip_from_url_and_parse(u, patt, ag, if_enable, proxy=None):
|
11
11
|
# 发送GET请求
|
12
12
|
headers = {'user-agent': ag}
|
13
|
+
|
14
|
+
if not re.search('enable', if_enable, re.IGNORECASE):
|
15
|
+
return None
|
16
|
+
|
13
17
|
try:
|
14
|
-
logging.info(f'Starting fetch local ip from {u} with proxy {proxy}')
|
18
|
+
logging.info(f'Starting fetch local ip from {u} with proxy "{proxy}"')
|
15
19
|
|
16
20
|
if proxy:
|
17
21
|
response = requests.get(u, headers=headers, timeout=(3,5),
|
@@ -20,7 +24,7 @@ def get_local_ip_from_url_and_parse(u, patt, ag, proxy=None):
|
|
20
24
|
})
|
21
25
|
else:
|
22
26
|
response = requests.get(u, headers=headers, timeout=(3, 5))
|
23
|
-
|
27
|
+
|
24
28
|
# 获取响应内容
|
25
29
|
respon = response.text
|
26
30
|
l_ip = url.parse_ip_from_response(respon, patt)
|
@@ -48,7 +52,7 @@ def validate_ip(l_ip):
|
|
48
52
|
def get_local_ips(proxy=None):
|
49
53
|
ip_list = []
|
50
54
|
for i, u in enumerate(url.detect_url, 1):
|
51
|
-
l_ip = get_local_ip_from_url_and_parse(u[0], u[1], u[2], proxy)
|
55
|
+
l_ip = get_local_ip_from_url_and_parse(u[0], u[1], u[2], u[3], proxy)
|
52
56
|
if l_ip and validate_ip(l_ip):
|
53
57
|
ip_list.append(l_ip)
|
54
58
|
return ip_list
|
easy_whitelist/ip/pattern.py
CHANGED
easy_whitelist/ip/url.py
CHANGED
@@ -10,7 +10,8 @@ def parse_ip_from_response(response, patt):
|
|
10
10
|
return result.group(1)
|
11
11
|
|
12
12
|
detect_url = [
|
13
|
-
['https://ifconfig.me', IFCONFIG_ME_PATTERN, random.choice(curl_user_agent)],
|
14
|
-
['http://cip.cc', CIP_CC_PATTERN, random.choice(chrome_user_agent)],
|
15
|
-
['https://tool.lu/ip/', TOOL_LU_PATTERN, random.choice(chrome_user_agent)]
|
13
|
+
['https://ifconfig.me', IFCONFIG_ME_PATTERN, random.choice(curl_user_agent), 'enable'],
|
14
|
+
['http://cip.cc', CIP_CC_PATTERN, random.choice(chrome_user_agent), 'DISABLE'],
|
15
|
+
['https://tool.lu/ip/', TOOL_LU_PATTERN, random.choice(chrome_user_agent), 'enable'],
|
16
|
+
['http://ip.sb/', IP_SB_PATTERN, random.choice(curl_user_agent), 'enable']
|
16
17
|
]
|
@@ -111,7 +111,9 @@ def set_template(common_client, target_id, proxy=None):
|
|
111
111
|
if target_id.startswith('ipm-'):
|
112
112
|
addresses_extra = get_local_ip_and_format_addressesextra(proxy)
|
113
113
|
if modify_template_address(common_client, addresses_extra, target_id):
|
114
|
-
logging.info(f'Successfully set {{{target_id}}} to {{{addresses_extra}}}')
|
114
|
+
# logging.info(f'Successfully set {{{target_id}}} to {{{addresses_extra}}}')
|
115
|
+
# print(f'Successfully set ({target_id}) to ({addresses_extra})')
|
116
|
+
print(f'成功将IP模版:{target_id} 设置为:({addresses_extra})')
|
115
117
|
else:
|
116
118
|
logging.warning('Wrong template id.')
|
117
119
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: easy_whitelist
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.48
|
4
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
|
@@ -36,11 +36,13 @@ Easy_whitelist 是一个探测本机互联网 IP 地址,将并本机互联网I
|
|
36
36
|
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.
|
37
37
|
|
38
38
|
主要功能包括:
|
39
|
+
|
39
40
|
* 自动探测本机互联网 IP 地址
|
40
41
|
* 支持阿里云、腾讯云的安全组白名单更新
|
41
42
|
* 腾讯云支持地址模板更新
|
42
43
|
|
43
44
|
Main functions include:
|
45
|
+
|
44
46
|
* Automatically detect the local Internet IP address
|
45
47
|
* Support security group whitelist updates for Alibaba Cloud and Tencent Cloud
|
46
48
|
* Tencent Cloud supports address template updates
|
@@ -63,12 +65,14 @@ Python3 is required
|
|
63
65
|
## 使用说明 Basic Usage
|
64
66
|
|
65
67
|
* 通过列表选择模版,设置白名单
|
68
|
+
|
66
69
|
```shell
|
67
|
-
|
70
|
+
easy template list
|
68
71
|
```
|
69
72
|
|
70
73
|
* 通过新创建模版,设置白名单。需要指定关联的安全组ID
|
74
|
+
|
71
75
|
```shell
|
72
|
-
|
76
|
+
easy template create rule_id
|
73
77
|
```
|
74
78
|
|
@@ -1,20 +1,20 @@
|
|
1
|
-
easy_whitelist/__init__.py,sha256=
|
1
|
+
easy_whitelist/__init__.py,sha256=gNo9C-Mtju0Mb3CGDdl-MH6ebTWsEb_vHUDzPfyCfYk,309
|
2
2
|
easy_whitelist/__main__.py,sha256=x5teqF_1OWhLujmBM37jYNJ9Ed1kF_xyzkYpJf4TCI0,2358
|
3
3
|
easy_whitelist/config/__init__.py,sha256=fK-lJ3GD4u1_FGkZfPf-f7fxjMwb1t0AZcG7mfIHLks,19
|
4
|
-
easy_whitelist/config/arg.py,sha256=
|
4
|
+
easy_whitelist/config/arg.py,sha256=lEet81UOfL4IhSEPC5AajrcWh9Q_tUecWkFp8Cxwr2Q,1081
|
5
5
|
easy_whitelist/ip/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
easy_whitelist/ip/agent.py,sha256=dJDkw1mipazcOyldbBZW5Mhjr17UqDlaBn2jUo80C7I,487
|
7
|
-
easy_whitelist/ip/ip.py,sha256=
|
8
|
-
easy_whitelist/ip/pattern.py,sha256=
|
9
|
-
easy_whitelist/ip/url.py,sha256=
|
7
|
+
easy_whitelist/ip/ip.py,sha256=H_daXbZ67Crp9sDHdNeuIyZD3H1Z6DrPXQOMiahgxtg,2236
|
8
|
+
easy_whitelist/ip/pattern.py,sha256=mIoYall_mLpNNmUX8jYjZ8tFsD064M9h1bbbok6CLGQ,172
|
9
|
+
easy_whitelist/ip/url.py,sha256=2PYkz1ofL_VzbdIvC7IlD4TQju81dzDSYCQdIqoocBs,550
|
10
10
|
easy_whitelist/sample/common_client_sample.py,sha256=kPde6JHuGLHapC7oSzoC_RdjS7Lxpqtp890NbGIVomc,1958
|
11
11
|
easy_whitelist/sample/cvm_sample_detail.py,sha256=sxsDJY2YvU6uwgbGBzWrl4tFZOKjGq9YMVEKIEjUNEI,4144
|
12
12
|
easy_whitelist/sample/cvm_sample_simple.py,sha256=g5rESUuRwcVqxemPct3QrWhZ4tnoRHh_hFkrqlHOTw0,871
|
13
13
|
easy_whitelist/tcloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
14
|
easy_whitelist/tcloud/client.py,sha256=eHevgHB1Y8C2Rwa8ztiIm-GkNTOJDlWU7RMNhw6oTmw,906
|
15
|
-
easy_whitelist/tcloud/template.py,sha256=
|
16
|
-
easy_whitelist-1.0.
|
17
|
-
easy_whitelist-1.0.
|
18
|
-
easy_whitelist-1.0.
|
19
|
-
easy_whitelist-1.0.
|
20
|
-
easy_whitelist-1.0.
|
15
|
+
easy_whitelist/tcloud/template.py,sha256=V36vppKsozsTns0uZ1Qv3f7ITrNqOzhdpNULBG7EU80,6240
|
16
|
+
easy_whitelist-1.0.48.dist-info/entry_points.txt,sha256=-URzXdGXqVTDQm_AhH9k0u4Qm9G0s4ZDXcnA-XQt73Q,53
|
17
|
+
easy_whitelist-1.0.48.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
|
18
|
+
easy_whitelist-1.0.48.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
19
|
+
easy_whitelist-1.0.48.dist-info/METADATA,sha256=T344pAnA8vxvRnq62R4MTJPPCxZcycZ0UoKA9HE2smo,3553
|
20
|
+
easy_whitelist-1.0.48.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|