easy_whitelist 1.0.30__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.
@@ -0,0 +1,6 @@
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.30'
4
+ # __author__ = 'qiqileleabaobao <qiqilelebaobao@163.com>'
5
+
6
+ __all__ = []
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import json
5
+ import os
6
+ import pprint
7
+ import string
8
+ import sys
9
+
10
+ from easy_whitelist.config import arg
11
+ from easy_whitelist.tcloud import client
12
+ from easy_whitelist.tcloud.template import list_template, set_template, create_template
13
+
14
+
15
+ def loop_list(common_client):
16
+ template_ids = list_template(common_client)
17
+ last_input = None
18
+ while True:
19
+ input_from_user = input('Please choose # template to set (or [L]ist or [Q]uit): ')
20
+ if last_input == '' and input_from_user == '':
21
+ break
22
+ last_input = input_from_user
23
+ if input_from_user.isdigit():
24
+ if template_ids:
25
+ if (a := int(input_from_user)) > 0 and a <= len(template_ids):
26
+ set_template(common_client, template_ids[a - 1])
27
+ else:
28
+ print('Wrong index, please input right index from the list.')
29
+ elif input_from_user == 'l' or input_from_user == 'L':
30
+ list_template(common_client)
31
+ elif input_from_user == 'q' or input_from_user == 'Q':
32
+ break
33
+ elif input_from_user == '':
34
+ continue
35
+ else:
36
+ print('Input error.')
37
+
38
+ def main():
39
+ tencent, alibaba, action, target, target_id, proxy = arg.init_arg()
40
+ # print(tencent, alibaba, action, target, target_id, proxy)
41
+
42
+ common_client = client.get_common_client(proxy)
43
+
44
+ if tencent and target == 'template':
45
+ if action == 'list':
46
+ loop_list(common_client)
47
+ elif action == 'set':
48
+ set_template(common_client, target_id)
49
+ elif action == 'create':
50
+ create_template(common_client, target_id)
51
+ else:
52
+ print('Wrong postion, shall not be here.')
53
+
54
+
55
+ if __name__ == '__main__':
56
+ main()
@@ -0,0 +1,2 @@
1
+
2
+ __all__ = ['arg']
@@ -0,0 +1,22 @@
1
+ import argparse
2
+
3
+ def init_arg():
4
+ '''parse parameter from command line.'''
5
+
6
+ parser = argparse.ArgumentParser(prog='easy', description='This is a cloud acl auto whitelist tool.', epilog='Enjoy the tool. :) ')
7
+
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
+ my_group.add_argument('-a', '-A', '--alibaba', action='store_true', help='alibaba cloud')
11
+
12
+ parser.add_argument('-p', '-P', '--proxy', action='store', default=-1, type=int, help ='local HTTP proxy port')
13
+
14
+ parser.add_argument('target', help='template or rule_id', choices=['template', 'rule_id'])
15
+ parser.add_argument('action', help='list', choices=['list', 'set', 'create'])
16
+ parser.add_argument('target_id', help='template id or rule id', nargs='?')
17
+
18
+ args = parser.parse_args()
19
+
20
+ # print(args)
21
+
22
+ return args.tencent, args.alibaba, args.action, args.target, args.target_id, args.proxy
File without changes
@@ -0,0 +1,5 @@
1
+
2
+ safari_user_ageent = ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15']
3
+ chrome_user_agent = ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36']
4
+ edge_user_agent = ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0']
5
+ curl_user_agent = ['curl/8.6.0', 'curl/7.29.0']
@@ -0,0 +1,57 @@
1
+ import requests
2
+ import sys
3
+ import random
4
+ import re
5
+
6
+ from . import url
7
+
8
+ def get_local_ip_from_url_and_parse(u, patt, ag):
9
+ # 发送GET请求
10
+ headers = {'user-agent': ag}
11
+ # print(f'user_agent:{ag}')
12
+ try:
13
+ response = requests.get(u, headers=headers, timeout=5)
14
+ # 获取响应内容
15
+ respon = response.text
16
+ l_ip = url.parse_ip_from_response(respon, patt)
17
+ return l_ip
18
+ except Exception:
19
+ return None
20
+
21
+ def validate_ip(l_ip):
22
+ if not l_ip:
23
+ return False
24
+
25
+ # r'(?:(?:25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[1]?[0-9][0-9]?)'
26
+ # r'(?:\d{1,3}\.){3}\d{1,3}'
27
+ # r'((?:[1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:[1-9]?\d|1\d\d|2[0-4]\d|25[0-5])'
28
+ # r'(?<![\.\d])(?:25[0-5]\.|2[0-4]\d\.|[01]?\d\d?\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)(?![\.\d])'
29
+ pat = r'((?:[1-9]?\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:[1-9]?\d|1\d\d|2[0-4]\d|25[0-5])'
30
+ if re.fullmatch(pat, l_ip):
31
+ return True
32
+ else:
33
+ return False
34
+
35
+ def get_local_ips():
36
+ ip_list = []
37
+ for i, u in enumerate(url.detect_url, 1):
38
+ l_ip = get_local_ip_from_url_and_parse(u[0], u[1], u[2])
39
+ if validate_ip(l_ip):
40
+ ip_list.append(l_ip)
41
+ return ip_list
42
+
43
+ def print_ip_list(ip_list):
44
+ number = 100
45
+ print(f'{"Detected Local IP List":=^{number}}\n'
46
+ f'{"#":<38}IP Address\n'
47
+ f'{"-" * number}'
48
+ )
49
+
50
+ for i, ip in enumerate(ip_list, 1):
51
+ print(f'{str(i):<38}{ip}')
52
+
53
+ print('-' * number)
54
+
55
+
56
+ if __name__ == '__main__':
57
+ print(validate_ip('1.0.0.0'))
@@ -0,0 +1,4 @@
1
+
2
+ IFCONFIG_ME_PATTERN = r'(.+)'
3
+ CIP_CC_PATTERN = r'URL\s+?:\s+?http://www.cip.cc/(.+)'
4
+ TOOL_LU_PATTERN = r'<p>你的外网IP地址是:\s*?(.+)</p>'
@@ -0,0 +1,16 @@
1
+ import re
2
+ import random
3
+
4
+ from .agent import *
5
+ from .pattern import *
6
+
7
+
8
+ def parse_ip_from_response(response, patt):
9
+ if result:=re.search(patt, response):
10
+ return result.group(1)
11
+
12
+ detect_url = [
13
+ ['https://ifconfig.me', IFCONFIG_ME_PATTERN, random.choice(curl_user_agent)],
14
+ ['https://cip.cc', CIP_CC_PATTERN, random.choice(curl_user_agent)],
15
+ ['https://tool.lu/ip/', TOOL_LU_PATTERN, random.choice(chrome_user_agent)]
16
+ ]
File without changes
@@ -0,0 +1,24 @@
1
+ import os
2
+
3
+ from tencentcloud.common import credential
4
+ from tencentcloud.common.profile.http_profile import HttpProfile
5
+ from tencentcloud.common.profile.client_profile import ClientProfile
6
+ from tencentcloud.common.common_client import CommonClient
7
+
8
+
9
+ def get_common_client(proxy):
10
+ cred = credential.Credential(
11
+ os.environ.get("TENCENTCLOUD_SECRET_ID"),
12
+ os.environ.get("TENCENTCLOUD_SECRET_KEY"))
13
+
14
+ httpProfile = HttpProfile()
15
+ httpProfile.endpoint = "vpc.tencentcloudapi.com"
16
+ if proxy != -1:
17
+ httpProfile.proxy = f'127.0.0.1:{proxy}'
18
+
19
+ clientProfile = ClientProfile()
20
+ clientProfile.httpProfile = httpProfile
21
+
22
+ common_client = CommonClient("vpc", "2017-03-12", cred, "ap-nanjing", profile=clientProfile)
23
+
24
+ return common_client
@@ -0,0 +1,155 @@
1
+ import json
2
+ import random
3
+
4
+
5
+ from ..ip import ip
6
+ from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
7
+
8
+
9
+ def write_template_list_to_temp_file(template_ids):
10
+
11
+ with open('/tmp/template_0000.txt', 'w') as temp_file:
12
+ json.dump(template_ids, temp_file)
13
+
14
+ return temp_file.name
15
+
16
+ def get_template(common_client):
17
+ try:
18
+ headers = {}
19
+ templates = common_client.call_json("DescribeAddressTemplates", headers)
20
+ return templates
21
+
22
+ except TencentCloudSDKException as err:
23
+ print(err)
24
+ return None
25
+
26
+ def list_template(common_client):
27
+ number = 150
28
+ print(f'{"Tencent Cloud Template List":=^{number}}\n' \
29
+ f'{"#":<10}{"Template ID":<20}{"CreatedTime":<30}{"Addresses":<60}{"AddressTemplateName":<30}\n' \
30
+ f'{"-" * number}'
31
+ )
32
+
33
+ template_ids = []
34
+ if not(templates := get_template(common_client)):
35
+ return template_ids
36
+
37
+ for i, template in enumerate(templates['Response']['AddressTemplateSet'], 1):
38
+ template_ids.append(template['AddressTemplateId'])
39
+ # print(template_ids)
40
+ addreset = ' ~ '.join(template['AddressSet'][:3])
41
+ if len(template['AddressSet']) > 3:
42
+ addreset += f' ~~~ {len(template["AddressSet"])-3} more...'
43
+ print(f"{str(i):10}"
44
+ f"{template['AddressTemplateId']:20}"
45
+ f"{template['CreatedTime']:30}"
46
+ f"{addreset:<60}"
47
+ f"{template['AddressTemplateName']:30}"
48
+ )
49
+ print('-' * number)
50
+
51
+ # write_template_list_to_temp_file(template_ids)
52
+
53
+ return template_ids
54
+
55
+ def format_addres_extra_string_from_list(client_ips):
56
+ cs = '"AddressesExtra":['
57
+ for client_ip in client_ips:
58
+ cs += '{{"Address":"{}","Description":"client_ip"}},'.format(client_ip)
59
+ cs_format = cs.rstrip(',')
60
+ cs_format += ']'
61
+
62
+ return cs_format
63
+
64
+ def modify_template_address(common_client, client_ips, target_id):
65
+
66
+ if not target_id:
67
+ return False
68
+
69
+ # 增加描述校验,避免更改错误
70
+ params = f"{{\"Filters\":[{{\"Name\":\"address-template-id\",\"Values\":[\"{target_id}\"]}}]}}"
71
+ try:
72
+ respon = common_client.call_json("DescribeAddressTemplates", json.loads(params))
73
+ if (TemplateSet := respon['Response']['AddressTemplateSet']) and \
74
+ TemplateSet[0]['AddressTemplateName'].startswith('temp-open-'):
75
+ # print(respon)
76
+ pass
77
+ else:
78
+ print('This is not a template generated from this tool. Shall not be modified.')
79
+ return False
80
+ except (TencentCloudSDKException, IndexError) as err:
81
+ # IndexError catch when there is no match target.Example: 'AddressTemplateSet': []
82
+ print(f"{err=}, {type(err)=}, {respon=}")
83
+ return False
84
+
85
+ params = "{{\"AddressTemplateId\":\"{}\",{}}}".format(target_id, client_ips)
86
+ try:
87
+ respon = common_client.call_json("ModifyAddressTemplateAttribute", json.loads(params))
88
+ # print(respon)
89
+ # print('-' * 100)
90
+ except TencentCloudSDKException as err:
91
+ print(f"Unexpected {err=}, {type(err)=}")
92
+ return False
93
+
94
+ return True
95
+
96
+ def get_local_ip_and_format_addressesextra():
97
+ client_ip_list = ip.get_local_ips()
98
+ # ip.print_ip_list(client_ip_list)
99
+ client_ip_list = list(set(client_ip_list))
100
+ addresses_extra = format_addres_extra_string_from_list(client_ip_list)
101
+
102
+ return addresses_extra
103
+
104
+ def set_template(common_client, target_id):
105
+ # with open('/tmp/template_0000.txt', 'r') as temp_file:
106
+ # data = json.load(temp_file)
107
+ # print(data)
108
+ if target_id:
109
+ if target_id.startswith('ipm-'):
110
+ addresses_extra = get_local_ip_and_format_addressesextra()
111
+ if modify_template_address(common_client, addresses_extra, target_id):
112
+ print(f'Successfully set {{{target_id}}} to {{{addresses_extra}}}')
113
+ else:
114
+ print('Wrong template id.')
115
+ else:
116
+ print('Set template shall input template id.')
117
+
118
+ def create_template(common_client, rule_id):
119
+
120
+ if not rule_id:
121
+ print('Create template shall input security group id.')
122
+ return False
123
+
124
+ params = "{}"
125
+ try:
126
+ templates = []
127
+ respon = common_client.call_json("DescribeAddressTemplates", json.loads(params))
128
+ print(json.dumps(respon, ensure_ascii=False))
129
+ for template in respon['Response']['AddressTemplateSet']:
130
+ if template['AddressTemplateName'].startswith('temp-open-'):
131
+ templates.append((template['AddressTemplateId'], template['AddressTemplateName'], template['CreatedTime']))
132
+ if templates:
133
+ print(f'Already have template without creation: {templates}')
134
+ return True
135
+
136
+ except TencentCloudSDKException as err:
137
+ print(f"{err=}, {type(err)=}")
138
+ return False
139
+
140
+ addresses_extra = get_local_ip_and_format_addressesextra()
141
+ params = f"{{\"AddressTemplateName\":\"temp-open-{random.randint(1,9999):04d}\",{addresses_extra}}}"
142
+ try:
143
+ respon = common_client.call_json("CreateAddressTemplate", json.loads(params))
144
+ print(json.dumps(respon, ensure_ascii=False))
145
+
146
+ if template_id := respon['Response']['AddressTemplate']['AddressTemplateId']:
147
+ params = f"{{\"SecurityGroupId\":\"{rule_id}\",\"SecurityGroupPolicySet\":{{\"Ingress\":[{{\"PolicyIndex\":0,\"Protocol\":\"ALL\",\"AddressTemplate\":{{\"AddressId\":\"{template_id}\"}},\"Action\":\"accept\",\"PolicyDescription\":\"temp-open\"}}]}}}}"
148
+ respon = common_client.call_json("CreateSecurityGroupPolicies", json.loads(params))
149
+ print(json.dumps(respon))
150
+
151
+ except TencentCloudSDKException as err:
152
+ print(f"{err=}, {type(err)=}")
153
+ return False
154
+
155
+ return True
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) qiqilelebaobao
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.1
2
+ Name: easy_whitelist
3
+ Version: 1.0.30
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
+ Keywords: automation,whitelist,acl,security-groups,alibaba-cloud,tencent-cloud,security-tools,security-group-rule
6
+ Author: qiqilelebaobao
7
+ Author-email: qiqilelebaobao <qiqilelebaobao@163.com>
8
+ Maintainer-email: qiqilelebaobao <qiqilelebaobao@163.com>
9
+ Requires-Python: >= 3.6
10
+ Description-Content-Type: text/markdown
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.6
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Requires-Dist: tencentcloud-sdk-python
24
+ Project-URL: Homepage, https://github.com/qiqilelebaobao/easy_whitelist
25
+
26
+ # Easy_whitelist
27
+
28
+ Easy_whitelist 是一个探测本机互联网 IP 地址,将并本机互联网IP地址,自动更新到云安全组白名单的小工具。工具使用 Python 编写。
29
+
30
+ 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.
31
+
32
+ 主要功能包括:
33
+ * 自动探测本机互联网 IP 地址
34
+ * 支持阿里云、腾讯云的安全组白名单更新
35
+ * 腾讯云支持地址模板更新
36
+
37
+ Main functions include:
38
+ * Automatically detect the local Internet IP address
39
+ * Support security group whitelist updates for Alibaba Cloud and Tencent Cloud
40
+ * Tencent Cloud supports address template updates
41
+
42
+ ## 适用场景 Applicable Scenarios
43
+
44
+ * 场景一:不知道如何探测本机的公网IP的用户,通过本工具自动探测公网 IP,并添加云安全组白名单
45
+ * 场景二:IP 地址因为 NAT 环境经常变化,包括家庭环境或者公司无固定出口 IP 的宽带环境,需要安全的使用云环境资源
46
+ * 场景三:测试场景,频繁变换客户端环境,需要安全的使用云环境资源
47
+
48
+ * Scene1: Users who do not know how to detect the public IP of their local machine can use this tool to automatically detect the public IP and add it to the cloud security group whitelist
49
+ * Scene2: IP addresses often change due to NAT environments, including home environments or broadband environments without fixed export IPs in companies, which require safe use of cloud environment resources
50
+ * Scene3: Test scenarios, frequent changes in client environments, which require safe use of cloud environment resources
51
+
52
+ ## 安装指南 Installation Guide
53
+
54
+ 需要 Python3 环境
55
+ Python3 is required
56
+
57
+ ## 使用说明 Basic Usage
58
+
59
+ * 通过列表选择模版,设置白名单
60
+ ```shell
61
+ $ easy template list
62
+ ```
63
+
64
+ * 通过新创建模版,设置白名单。需要指定关联的安全组ID
65
+ ```shell
66
+ $ easy template create rule_id
67
+ ```
68
+
@@ -0,0 +1,17 @@
1
+ easy_whitelist/__init__.py,sha256=ft39WR_Hfgmnn3FjcBtKu8TP78tg1-ftBoWG4JOK9w4,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.30.dist-info/entry_points.txt,sha256=-URzXdGXqVTDQm_AhH9k0u4Qm9G0s4ZDXcnA-XQt73Q,53
14
+ easy_whitelist-1.0.30.dist-info/LICENSE,sha256=sWhlh6jzXRpuhxIbCZfjCEX_YQI4mMK6iO1bfpgkfzM,11343
15
+ easy_whitelist-1.0.30.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
16
+ easy_whitelist-1.0.30.dist-info/METADATA,sha256=CjnxAwdvzSoXW-_W6SByR4PhlRSGrUwTtdJysRRZiek,3325
17
+ easy_whitelist-1.0.30.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: flit 3.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ easy=easy_whitelist.__main__:main
3
+