easy_whitelist 1.0.27__tar.gz → 1.0.29__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.
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/.gitignore +3 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/PKG-INFO +11 -5
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/README.md +9 -3
- easy_whitelist-1.0.29/SECURITY.md +13 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/__init__.py +2 -2
- easy_whitelist-1.0.27/easy_whitelist/easy.py → easy_whitelist-1.0.29/easy_whitelist/__main__.py +6 -3
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/config/arg.py +4 -4
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/ip/ip.py +1 -1
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/tcloud/template.py +1 -1
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/pyproject.toml +11 -2
- easy_whitelist-1.0.29/sample/cvm_sample_detail.py +75 -0
- easy_whitelist-1.0.27/SECURITY.md +0 -21
- easy_whitelist-1.0.27/sample/__init__.py +0 -2
- easy_whitelist-1.0.27/sample/aa.py +0 -7
- easy_whitelist-1.0.27/sample/memo.md +0 -23
- easy_whitelist-1.0.27/sample/test.py +0 -30
- easy_whitelist-1.0.27/sample/test2.py +0 -14
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/CODE_OF_CONDUCT.md +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/LICENSE +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/config/__init__.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/ip/__init__.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/ip/agent.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/ip/pattern.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/ip/url.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/tcloud/__init__.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/easy_whitelist/tcloud/client.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/sample/common_client_sample.py +0 -0
- /easy_whitelist-1.0.27/sample/sample.py → /easy_whitelist-1.0.29/sample/cvm_sample_simple.py +0 -0
- {easy_whitelist-1.0.27 → easy_whitelist-1.0.29}/setup.py +0 -0
@@ -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
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Easy_whitelist 是一个探测本机互联网 IP 地址,将并本机互联网IP地址,自动更新到云安全组白名单的小工具。工具使用 Python 编写。
|
4
4
|
|
5
|
-
Easy_whitelist is a
|
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
|
* 自动探测本机互联网 IP 地址
|
@@ -29,8 +29,14 @@ Main functions include:
|
|
29
29
|
需要 Python3 环境
|
30
30
|
Python3 is required
|
31
31
|
|
32
|
-
## 使用说明
|
32
|
+
## 使用说明 Basic Usage
|
33
33
|
|
34
|
+
* 通过列表选择模版,设置白名单
|
34
35
|
```shell
|
35
|
-
$
|
36
|
+
$ easy template list
|
37
|
+
```
|
38
|
+
|
39
|
+
* 通过新创建模版,设置白名单。需要指定关联的安全组ID
|
40
|
+
```shell
|
41
|
+
$ easy template create rule_id
|
36
42
|
```
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Security Policy
|
2
|
+
|
3
|
+
## Supported Versions
|
4
|
+
|
5
|
+
Use this section to tell people about which versions of your project are
|
6
|
+
currently being supported with security updates.
|
7
|
+
|
8
|
+
|
9
|
+
## Reporting a Vulnerability
|
10
|
+
|
11
|
+
Please use https://github.com/qiqilelebaobao to report security vulnerabilities.
|
12
|
+
|
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).
|
@@ -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__ = []
|
easy_whitelist-1.0.27/easy_whitelist/easy.py → easy_whitelist-1.0.29/easy_whitelist/__main__.py
RENAMED
@@ -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()
|
@@ -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
|
|
@@ -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}"
|
@@ -4,7 +4,11 @@ build-backend = "flit_core.buildapi"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "easy_whitelist"
|
7
|
-
authors = [
|
7
|
+
authors = [
|
8
|
+
{name = "qiqilelebaobao"},
|
9
|
+
{name = "qiqilelebaobao", email = "qiqilelebaobao@163.com"}
|
10
|
+
]
|
11
|
+
|
8
12
|
readme = "README.md"
|
9
13
|
license = {text = "Apache License 2.0"}
|
10
14
|
classifiers = [
|
@@ -29,7 +33,12 @@ maintainers = [
|
|
29
33
|
{name = "qiqilelebaobao", email = "qiqilelebaobao@163.com"}
|
30
34
|
]
|
31
35
|
|
32
|
-
keywords = ["automation", "whitelist", "acl",
|
36
|
+
keywords = ["automation", "whitelist", "acl",
|
37
|
+
"security-groups", "alibaba-cloud", "tencent-cloud",
|
38
|
+
"security-tools", "security-group-rule"]
|
33
39
|
|
34
40
|
[project.urls]
|
35
41
|
Homepage = "https://github.com/qiqilelebaobao/easy_whitelist"
|
42
|
+
|
43
|
+
[project.scripts]
|
44
|
+
easy = "easy_whitelist.__main__:main"
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
import logging
|
5
|
+
|
6
|
+
from tencentcloud.common import credential
|
7
|
+
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
8
|
+
# 导入对应产品模块的client models。
|
9
|
+
from tencentcloud.cvm.v20170312 import cvm_client, models
|
10
|
+
|
11
|
+
# 导入可选配置类
|
12
|
+
from tencentcloud.common.profile.client_profile import ClientProfile
|
13
|
+
from tencentcloud.common.profile.http_profile import HttpProfile
|
14
|
+
try:
|
15
|
+
# 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey。
|
16
|
+
# 为了保护密钥安全,建议将密钥设置在环境变量中或者配置文件中,请参考本文凭证管理章节。
|
17
|
+
# 硬编码密钥到代码中有可能随代码泄露而暴露,有安全隐患,并不推荐。
|
18
|
+
# cred = credential.Credential("secretId", "secretKey")
|
19
|
+
cred = credential.Credential(
|
20
|
+
os.environ.get("TENCENTCLOUD_SECRET_ID"),
|
21
|
+
os.environ.get("TENCENTCLOUD_SECRET_KEY"))
|
22
|
+
cred = credential.Credential("SecretId", "SecretKey")
|
23
|
+
|
24
|
+
# 实例化一个http选项,可选的,没有特殊需求可以跳过。
|
25
|
+
httpProfile = HttpProfile()
|
26
|
+
# 如果需要指定proxy访问接口,可以按照如下方式初始化hp
|
27
|
+
# httpProfile = HttpProfile(proxy="http://用户名:密码@代理IP:代理端口")
|
28
|
+
httpProfile.protocol = "https" # 在外网互通的网络环境下支持http协议(默认是https协议),建议使用https协议
|
29
|
+
httpProfile.keepAlive = True # 状态保持,默认是False
|
30
|
+
httpProfile.reqMethod = "GET" # get请求(默认为post请求)
|
31
|
+
httpProfile.reqTimeout = 30 # 请求超时时间,单位为秒(默认60秒)
|
32
|
+
httpProfile.endpoint = "cvm.ap-shanghai.tencentcloudapi.com" # 指定接入地域域名(默认就近接入)
|
33
|
+
|
34
|
+
# 实例化一个client选项,可选的,没有特殊需求可以跳过。
|
35
|
+
clientProfile = ClientProfile()
|
36
|
+
clientProfile.signMethod = "TC3-HMAC-SHA256" # 指定签名算法
|
37
|
+
clientProfile.language = "en-US" # 指定展示英文(默认为中文)
|
38
|
+
clientProfile.httpProfile = httpProfile
|
39
|
+
|
40
|
+
# 实例化要请求产品(以cvm为例)的client对象,clientProfile是可选的。
|
41
|
+
client = cvm_client.CvmClient(cred, "ap-shanghai", clientProfile)
|
42
|
+
|
43
|
+
# 打印日志按照如下方式,也可以设置log_format,默认为 '%(asctime)s %(process)d %(filename)s L%(lineno)s %(levelname)s %(message)s'
|
44
|
+
# client.set_stream_logger(stream=sys.stdout, level=logging.DEBUG)
|
45
|
+
# client.set_file_logger(file_path="/log", level=logging.DEBUG) 日志文件滚动输出,最多10个文件,单个文件最大512MB
|
46
|
+
# client.set_default_logger() 去除所有log handler,默认不输出
|
47
|
+
|
48
|
+
# 实例化一个cvm实例信息查询请求对象,每个接口都会对应一个request对象。
|
49
|
+
req = models.DescribeInstancesRequest()
|
50
|
+
|
51
|
+
# 填充请求参数,这里request对象的成员变量即对应接口的入参。
|
52
|
+
# 您可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义。
|
53
|
+
respFilter = models.Filter() # 创建Filter对象, 以zone的维度来查询cvm实例。
|
54
|
+
respFilter.Name = "zone"
|
55
|
+
respFilter.Values = ["ap-shanghai-1", "ap-shanghai-2"]
|
56
|
+
req.Filters = [respFilter] # Filters 是成员为Filter对象的列表
|
57
|
+
|
58
|
+
# python sdk支持自定义header如 X-TC-TraceId、X-TC-Canary,可以按照如下方式指定,header必须是字典类型的
|
59
|
+
headers = {
|
60
|
+
"X-TC-TraceId": "ffe0c072-8a5d-4e17-8887-a8a60252abca"
|
61
|
+
}
|
62
|
+
req.headers = headers
|
63
|
+
|
64
|
+
# 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的,headers为可选参数。
|
65
|
+
# 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应。
|
66
|
+
resp = client.DescribeInstances(req)
|
67
|
+
|
68
|
+
# 输出json格式的字符串回包
|
69
|
+
print(resp.to_json_string(indent=2))
|
70
|
+
|
71
|
+
# 也可以取出单个值。
|
72
|
+
# 您可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义。
|
73
|
+
print(resp.TotalCount)
|
74
|
+
except TencentCloudSDKException as err:
|
75
|
+
print(err)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Security Policy
|
2
|
-
|
3
|
-
## Supported Versions
|
4
|
-
|
5
|
-
Use this section to tell people about which versions of your project are
|
6
|
-
currently being supported with security updates.
|
7
|
-
|
8
|
-
| Version | Supported |
|
9
|
-
| ------- | ------------------ |
|
10
|
-
| 5.1.x | :white_check_mark: |
|
11
|
-
| 5.0.x | :x: |
|
12
|
-
| 4.0.x | :white_check_mark: |
|
13
|
-
| < 4.0 | :x: |
|
14
|
-
|
15
|
-
## Reporting a Vulnerability
|
16
|
-
|
17
|
-
Use this section to tell people how to report a vulnerability.
|
18
|
-
|
19
|
-
Tell them where to go, how often they can expect to get an update on a
|
20
|
-
reported vulnerability, what to expect if the vulnerability is accepted or
|
21
|
-
declined, etc.
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Here is Hogan’s full memo:
|
2
|
-
、、、
|
3
|
-
At Microsoft, we deliver mission-critical infrastructure that the world depends on to achieve more. With that trust in us comes a great responsibility: to protect our customers, our company, and our world from cyber threats. As Microsoft employees, we all have a role in that responsibility.
|
4
|
-
|
5
|
-
As Satya referenced in his May 3 email and again during his FY25 kick off on July 9, security is our number-one priority, and everyone at Microsoft will have security as a Core Priority. When faced with a tradeoff, the answer is clear and simple: security above all else. Our commitment to security is enduring. New and novel attacks will require us to continue to learn, innovate, and defend. Yet working together, we will make nonlinear improvements, stay alert, and meet the expectations of our customers. They are counting on us, and our future depends on their trust.
|
6
|
-
|
7
|
-
Our new Security Core Priority reinforces our commitment to security and holds us accountable for building secure products and services. It is now available in the Connect tool for most employees, and we are partnering with geo HR teams to expand access to all employees globally. The Security Core Priority is not a check-the-box compliance exercise; it is a way for every employee and manager to commit to—and be accountable for—prioritizing security, and a way for us to codify your contributions and to recognize you for your impact. We all must act with a security-first mindset, speak up, and proactively look for opportunities to ensure security in everything we do.
|
8
|
-
|
9
|
-
The core priority will have two parts:
|
10
|
-
|
11
|
-
Core and common elements that apply to all employees
|
12
|
-
|
13
|
-
An optional section for employees to further specify how they will activate the Security Core Priority based on their role, team, org, etc.
|
14
|
-
|
15
|
-
All employees will set their Security Core Priority as part their first FY25 Connect, with the intent that during regular Connect conversations, you and your manager will discuss your Security Core Priority progress and impact. This process will follow the same approach as our other company-wide core priorities for Diversity & Inclusion and Managers. You can learn more about the Security Core Priority here, including FAQs and Security Core Priority activation examples for three main types of roles: technical, customer and partner-facing, and all other roles.
|
16
|
-
|
17
|
-
As we kick off our 50th year as a company, I know we all feel honored and humbled that we are still here—as a relevant and consequential company—pursuing our mission together. When we empower every person and organization on the planet to achieve more, we take on society’s biggest challenges and empower the world. What a big, bold, and meaningful mission we have, and yet none of us can take this for granted. We are here because our customers trust us, and we must continue to earn their trust every day.
|
18
|
-
|
19
|
-
Thank you for your commitment to our Security Core Priority that will help protect Microsoft, our customers, and our partners.
|
20
|
-
|
21
|
-
Kathleen
|
22
|
-
|
23
|
-
、、、
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
import json
|
3
|
-
import os
|
4
|
-
|
5
|
-
from tencentcloud.common.common_client import CommonClient
|
6
|
-
from tencentcloud.common import credential
|
7
|
-
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
8
|
-
from tencentcloud.common.profile.client_profile import ClientProfile
|
9
|
-
from tencentcloud.common.profile.http_profile import HttpProfile
|
10
|
-
|
11
|
-
try:
|
12
|
-
cred = credential.Credential(
|
13
|
-
os.environ.get("TENCENTCLOUD_SECRET_ID"),
|
14
|
-
os.environ.get("TENCENTCLOUD_SECRET_KEY"))
|
15
|
-
|
16
|
-
pass
|
17
|
-
|
18
|
-
httpProfile = HttpProfile()
|
19
|
-
httpProfile.endpoint = "vpc.tencentcloudapi.com"
|
20
|
-
httpProfile.proxy = '127.0.0.1:8080'
|
21
|
-
clientProfile = ClientProfile()
|
22
|
-
clientProfile.httpProfile = httpProfile
|
23
|
-
|
24
|
-
headers = {}
|
25
|
-
common_client = CommonClient("vpc", "2017-03-12", cred, "ap-nanjing", profile=clientProfile)
|
26
|
-
templates = common_client.call_json("DescribeAddressTemplates", headers)
|
27
|
-
print(json.dumps(templates, ensure_ascii=False))
|
28
|
-
|
29
|
-
except TencentCloudSDKException as err:
|
30
|
-
print(err)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/easy_whitelist-1.0.27/sample/sample.py → /easy_whitelist-1.0.29/sample/cvm_sample_simple.py
RENAMED
File without changes
|
File without changes
|