easy_whitelist 1.0.44__tar.gz → 1.0.48__tar.gz

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.
Files changed (27) hide show
  1. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/.gitignore +2 -1
  2. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/PKG-INFO +7 -3
  3. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/README.md +6 -2
  4. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/SECURITY.md +2 -3
  5. easy_whitelist-1.0.48/easy_whitelist/__init__.py +7 -0
  6. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/config/arg.py +1 -1
  7. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/ip/ip.py +8 -4
  8. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/ip/pattern.py +1 -0
  9. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/ip/url.py +4 -3
  10. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/tcloud/template.py +3 -1
  11. easy_whitelist-1.0.48/note.md +5 -0
  12. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/pyproject.toml +12 -6
  13. easy_whitelist-1.0.48/tests/.gitkeep +0 -0
  14. easy_whitelist-1.0.48/tests/test.py +0 -0
  15. easy_whitelist-1.0.44/easy_whitelist/__init__.py +0 -6
  16. easy_whitelist-1.0.44/setup.py +0 -41
  17. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/CODE_OF_CONDUCT.md +0 -0
  18. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/LICENSE +0 -0
  19. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/__main__.py +0 -0
  20. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/config/__init__.py +0 -0
  21. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/ip/__init__.py +0 -0
  22. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/ip/agent.py +0 -0
  23. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/sample/common_client_sample.py +0 -0
  24. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/sample/cvm_sample_detail.py +0 -0
  25. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/sample/cvm_sample_simple.py +0 -0
  26. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/tcloud/__init__.py +0 -0
  27. {easy_whitelist-1.0.44 → easy_whitelist-1.0.48}/easy_whitelist/tcloud/client.py +0 -0
@@ -4,4 +4,5 @@
4
4
  dist/
5
5
  build/
6
6
  *.egg-info
7
- tests/
7
+ **/__pycache__
8
+ note.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easy_whitelist
3
- Version: 1.0.44
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
- $ easy template list
70
+ easy template list
68
71
  ```
69
72
 
70
73
  * 通过新创建模版,设置白名单。需要指定关联的安全组ID
74
+
71
75
  ```shell
72
- $ easy template create rule_id
76
+ easy template create rule_id
73
77
  ```
74
78
 
@@ -5,11 +5,13 @@ Easy_whitelist 是一个探测本机互联网 IP 地址,将并本机互联网I
5
5
  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.
6
6
 
7
7
  主要功能包括:
8
+
8
9
  * 自动探测本机互联网 IP 地址
9
10
  * 支持阿里云、腾讯云的安全组白名单更新
10
11
  * 腾讯云支持地址模板更新
11
12
 
12
13
  Main functions include:
14
+
13
15
  * Automatically detect the local Internet IP address
14
16
  * Support security group whitelist updates for Alibaba Cloud and Tencent Cloud
15
17
  * Tencent Cloud supports address template updates
@@ -32,11 +34,13 @@ Python3 is required
32
34
  ## 使用说明 Basic Usage
33
35
 
34
36
  * 通过列表选择模版,设置白名单
37
+
35
38
  ```shell
36
- $ easy template list
39
+ easy template list
37
40
  ```
38
41
 
39
42
  * 通过新创建模版,设置白名单。需要指定关联的安全组ID
43
+
40
44
  ```shell
41
- $ easy template create rule_id
45
+ easy template create rule_id
42
46
  ```
@@ -5,9 +5,8 @@
5
5
  Use this section to tell people about which versions of your project are
6
6
  currently being supported with security updates.
7
7
 
8
-
9
8
  ## Reporting a Vulnerability
10
9
 
11
- Please use https://github.com/qiqilelebaobao to report security vulnerabilities.
10
+ Please use <https://github.com/qiqilelebaobao> to report security vulnerabilities.
12
11
 
13
- The Security Team will process your report within a week, and respond within a month (although it will depend on the severity of your report).
12
+ The Security Team will process your report within a week, and respond within a month (although it will depend on the severity of your report).
@@ -0,0 +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
+
4
+ #__version__ = '1.0.48'
5
+ # __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
6
+
7
+ __all__ = []
@@ -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 rule_id', choices=['template', 'rule_id'])
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
 
@@ -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
@@ -2,3 +2,4 @@
2
2
  IFCONFIG_ME_PATTERN = r'(.+)'
3
3
  CIP_CC_PATTERN = r'URL\s+?:\s+?http://www.cip.cc/(.+)'
4
4
  TOOL_LU_PATTERN = r'<p>你的外网IP地址是:\s*?(.+)</p>'
5
+ IP_SB_PATTERN = r'(.+)'
@@ -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:
@@ -0,0 +1,5 @@
1
+ # 小记录
2
+
3
+ ## Cache
4
+
5
+ /Users/yuyuan/Library/Caches/com.apple.python/Users/yuyuan/Gitlab
@@ -13,7 +13,7 @@ requires-python = ">= 3.6"
13
13
  readme = "README.md"
14
14
  license = {text = "Apache License 2.0"}
15
15
  classifiers = [
16
- "License :: OSI Approved :: Apache Software License",
16
+ "License :: OSI Approved :: Apache Software License",
17
17
  "Programming Language :: Python :: 3",
18
18
  "Programming Language :: Python :: 3 :: Only",
19
19
  "Programming Language :: Python :: 3.6",
@@ -34,15 +34,15 @@ maintainers = [
34
34
  {name = "qiqilelebaobao", email = "qiqilelebaobao@163.com"}
35
35
  ]
36
36
 
37
- keywords = ["automation", "whitelist", "acl",
38
- "security-groups", "alibaba-cloud", "tencent-cloud",
37
+ keywords = ["automation", "whitelist", "acl",
38
+ "security-groups", "alibaba-cloud", "tencent-cloud",
39
39
  "security-tools", "security-group-rule"]
40
40
 
41
- # description = '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.'
41
+ description = '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.'
42
42
 
43
- # version = '1.0.33'
43
+ version = '1.0.48'
44
44
 
45
- dynamic = ["version", "description"]
45
+ # dynamic = ["version", "description"]
46
46
 
47
47
  [project.urls]
48
48
  Homepage = "https://github.com/qiqilelebaobao/easy_whitelist"
@@ -57,3 +57,9 @@ cli = [
57
57
  "rich",
58
58
  "click",
59
59
  ]
60
+
61
+ [tool.flit.sdist]
62
+ include = [
63
+ "SECURITY.md",
64
+ "CODE_OF_CONDUCT.md",
65
+ ]
File without changes
File without changes
@@ -1,6 +0,0 @@
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
- __version__ = '1.0.44'
4
- # __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
5
-
6
- __all__ = []
@@ -1,41 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # import os
3
-
4
- from setuptools import setup, find_packages
5
-
6
- # import easy_whitelist
7
-
8
- # ROOT = os.path.dirname(__file__)
9
-
10
- setup(
11
- name='easy_whitelist',
12
- install_requires=[
13
- 'tencentcloud-sdk-python',
14
- ],
15
- description='Easy_whitelist is a small tool that detects the local Internet IP address and automatically updates the local Internet IP address to the cloud security group whitelist.',
16
- # long_description=open('README.md').read(),
17
- long_description = 'nihao',
18
- author='qiqilelebaobao',
19
- author_email='qiqilelebaobao@163.com',
20
- maintainer_email="qiqilelebaobao@163.com",
21
- version='1.0.34',
22
- # version=easy_whitelist.__version__,
23
- url='https://github.com/qiqilelebaobao/easy_whitelist',
24
- scripts=[],
25
- license="Apache License 2.0",
26
- platforms='any',
27
- packages=find_packages(exclude=[]),
28
- classifiers=[
29
- 'Development Status :: 5 - Production/Stable',
30
- 'Intended Audience :: Developers',
31
- 'License :: OSI Approved :: Apache Software License',
32
- 'Programming Language :: Python',
33
- 'Programming Language :: Python :: 3',
34
- 'Programming Language :: Python :: 3.6',
35
- 'Programming Language :: Python :: 3.7',
36
- 'Programming Language :: Python :: 3.8',
37
- 'Programming Language :: Python :: 3.9',
38
- 'Programming Language :: Python :: 3.10',
39
- ],
40
-
41
- )
File without changes