wireguard公私钥批量生成脚本

Posted on 2 days ago  11 Views


#!/bin/bash

# 定义要生成的密钥对数量
NUM_KEYS=10

# 批量生成密钥对并输出到控制台
for i in $(seq 1 $NUM_KEYS); do
    # 生成私钥
    private_key=$(wg genkey)
    
    # 生成公钥
    public_key=$(echo "$private_key" | wg pubkey)
    
    # 输出密钥对
    echo "Key Pair $i:"
    echo "Private Key: $private_key"
    echo "Public Key: $public_key"
    echo "--------------------------"
done