easy_whitelist 1.0.44__py3-none-any.whl → 1.0.45__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.
@@ -1,6 +1,6 @@
1
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.44'
3
+ __version__ = '1.0.45'
4
4
  # __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
5
5
 
6
6
  __all__ = []
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/url.py CHANGED
@@ -10,7 +10,7 @@ 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
16
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easy_whitelist
3
- Version: 1.0.44
3
+ Version: 1.0.45
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
@@ -1,20 +1,20 @@
1
- easy_whitelist/__init__.py,sha256=S1wYuxOzsXW5UBY5GOQSpCmcoJhtXu_KIgHUmh6c8Eg,303
1
+ easy_whitelist/__init__.py,sha256=EzzJJXwF7RvhwwS3xT8baXNXNSZV4-thxAoeZxt2JCI,303
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
4
  easy_whitelist/config/arg.py,sha256=efzlQSHK49MFhf0VAnVt6jkGxdwW3ae3yUJmDIKx9mY,1087
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=K34xjZsFWsSi70crQQ51k04x8H5StC-yE5ZMWDEm41I,2145
7
+ easy_whitelist/ip/ip.py,sha256=H_daXbZ67Crp9sDHdNeuIyZD3H1Z6DrPXQOMiahgxtg,2236
8
8
  easy_whitelist/ip/pattern.py,sha256=184XTlT0087eBZbm9LC5AB38PMLazQueW8E7l4jSwkM,149
9
- easy_whitelist/ip/url.py,sha256=kFBZ2E_AYQ-AYo7eeKQJ22kjviQ61bZMdQS4EOR5j-k,439
9
+ easy_whitelist/ip/url.py,sha256=xmma_JtcY7LS6fDvfH2RBXvn_3-KZktg-fQj-kxhE10,470
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
15
  easy_whitelist/tcloud/template.py,sha256=dLqFSunO8_wjZfCU0z5x9_G30pIDTT91qhJFYtlMRb4,6066
16
- easy_whitelist-1.0.44.dist-info/entry_points.txt,sha256=-URzXdGXqVTDQm_AhH9k0u4Qm9G0s4ZDXcnA-XQt73Q,53
17
- easy_whitelist-1.0.44.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
18
- easy_whitelist-1.0.44.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
19
- easy_whitelist-1.0.44.dist-info/METADATA,sha256=g3AMRmzX5gHBRh2gEqcKLusuSiHtEnK-CHGRLs6ttqo,3553
20
- easy_whitelist-1.0.44.dist-info/RECORD,,
16
+ easy_whitelist-1.0.45.dist-info/entry_points.txt,sha256=-URzXdGXqVTDQm_AhH9k0u4Qm9G0s4ZDXcnA-XQt73Q,53
17
+ easy_whitelist-1.0.45.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
18
+ easy_whitelist-1.0.45.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
19
+ easy_whitelist-1.0.45.dist-info/METADATA,sha256=-IF-TYEk7Ijf3cKWclazm2sTKJ6mUQbTl6EEBfcCaZY,3553
20
+ easy_whitelist-1.0.45.dist-info/RECORD,,