Skip to main content

A smart tool that detects the local Internet IP address and automatically updates the local Internet IP address to the cloud security group whitelist.

Project description

EasyWhitelist

EasyWhitelist 是一个自动探测本机公网 IP 地址,并将其更新到云安全组白名单的命令行工具,使用 Python 编写。

EasyWhitelist is a CLI tool that detects the local public IP address and automatically updates cloud security group whitelists. Written in Python.

主要功能 / Features

  • 自动探测本机公网 IP(多源并发,自动去重)
  • 支持腾讯云地址模板(Address Template)和阿里云前缀列表(Prefix List)
  • 区域缓存:将 region 列表和安全组信息本地缓存到 SQLite,加速后续操作
  • 支持通过本地 HTTP 代理访问云 API
  • Auto-detects local public IP via multiple sources concurrently
  • Supports Tencent Cloud Address Templates and Alibaba Cloud Prefix Lists
  • Caches region / security-group info in local SQLite for faster subsequent runs
  • Supports routing cloud API calls through a local HTTP proxy

适用场景 / Applicable Scenarios

  • 场景一:不知道如何探测本机的公网IP的用户,通过本工具自动探测公网 IP,并添加云安全组白名单

  • 场景二:IP 地址因为 NAT 环境经常变化,包括家庭环境或者公司无固定出口 IP 的宽带环境,需要安全的使用云环境资源

  • 场景三:测试场景,频繁变换客户端环境,需要安全的使用云环境资源

  • Scene 1: 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

  • Scene 2: 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

  • Scene 3: Test scenarios, frequent changes in client environments, which require safe use of cloud environment resources

安装指南 Installation Guide

需要 Python 3.8+ 环境。Python 3.8+ is required.

pip install EasyWhitelist

凭据配置 Credentials

工具通过环境变量读取云厂商密钥,无需配置文件。 Credentials are read from environment variables; no config file is needed.

腾讯云 Tencent Cloud

export TENCENTCLOUD_SECRET_ID=your_secret_id
export TENCENTCLOUD_SECRET_KEY=your_secret_key

阿里云 Alibaba Cloud

export ALIBABA_CLOUD_ACCESS_KEY_ID=your_access_key_id
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your_access_key_secret

使用说明 Basic Usage

ew [-t | -a] [-p PORT] [-v] <init | list | set> [target_id]

选项 Options

参数 说明
-t, --tencent 使用腾讯云(默认) / Use Tencent Cloud (default)
-a, --alibaba 使用阿里云 / Use Alibaba Cloud
-p PORT, --proxy PORT 本地 HTTP 代理端口(1-65535)/ Local HTTP proxy port
-v, --verbose 增加日志详细程度 / Increase log verbosity

操作 Actions

命令 说明
init [target_id] 初始化:绑定地址模板或前缀列表到安全组规则 / Initialize and bind template/prefix to security group
list 列出已有模板或前缀列表,交互式选择 / List and interactively select existing template/prefix
set 探测当前公网 IP 并更新所有已绑定的模板 / Detect current public IP and update all bound templates

示例 Examples

# 腾讯云:初始化并绑定安全组规则
ew init sg-xxxxxxxx

# 腾讯云:查看地址模板列表并选择
ew list

# 腾讯云:更新所有已绑定模板为当前公网 IP
ew set

# 阿里云:初始化并绑定前缀列表
ew -a init sg-xxxxxxxx

# 阿里云:更新前缀列表
ew -a set

# 通过本地代理端口 7890 访问云 API
ew -p 7890 set

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easywhitelist-1.1.0.tar.gz (34.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easywhitelist-1.1.0-py3-none-any.whl (40.4 kB view details)

Uploaded Python 3

File details

Details for the file easywhitelist-1.1.0.tar.gz.

File metadata

  • Download URL: easywhitelist-1.1.0.tar.gz
  • Upload date:
  • Size: 34.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for easywhitelist-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9b49b3031c474a8348afe183a96159f0b795606eaa6988485164cdd7aa6f4f3e
MD5 e480dc9b2c527afe5ef5441d141e2610
BLAKE2b-256 7b4eca12667e0ba22307d442783a04362317a8455e98f2dfe463a83b3f716cec

See more details on using hashes here.

File details

Details for the file easywhitelist-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: easywhitelist-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for easywhitelist-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc39b4f0aa7687909bebef9a423e5ad2ff176f294df7eba23e1aff7919f7be79
MD5 2dbaa93d4f8151bac94d180327a8a85e
BLAKE2b-256 5bcf595db69c8fc109513496ec7ffcbf1d2d69e76f77008e06cdc6cbb5a4bf27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page