来源:Medium,作者:@bigb0ss
现在只对常读和星标的公众号才展示大图推送,建议大家把潇湘信安“设为星标”,否则可能看不到了!
介绍
cloud-proxy(创建虚拟机+建立SOCKS代理)
https://github.com/tomsteele/cloud-proxy
proxy-ng(以随机顺序使用多个SOCKS代理)
https://github.com/jamesbcook/proxy-ng
安装
AWS设置
2. 创建访问密钥
3. 安装 AWS CLI(*我正在使用 MacOS 进行此设置)
"https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" curl
unzip awscli-bundle.zip
local/aws -b /usr/local/bin/aws sudo ./awscli-bundle/install -i /usr/
4. 使用 AWS CLI 配置私有密钥
aws configure
AWS Access Key ID: <YOUR KEY ID>
AWS Secret Access Key: <YOUR SECRET ACCESS KEY>
Default region name [us-east-2]: us-east-2
Default output format [json]: json
5. 使用 AWS 配置 SSH 密钥
## Create a New Key Pair
## Download the .pem file to your $HOME directory
$HOME/.ssh/ mv ~/Downloads/bigb0ss_cloudproxy.pem
## Change the permission
$HOME/.ssh/bigb0ss_cloudproxy.pem chmod 600
## Create a Public Key associated with .pem
$HOME/.ssh/id_rsa_bigb0ss_cloudproxy.pub ssh-keygen -y -f bigb0ss_cloudproxy.pem >
-y: This option will read a private OpenSSH format file and print an OpenSSH public key to stdout.
6. 将所有 AWS 区域设置为环境变量
"$(aws ec2 describe-regions --query 'Regions[].RegionName' --output text)" AWS_REGIONS=
echo $AWS_REGIONS
eu-north-1 ap-south-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-2 ap-northeast-1 sa-east-1 ca-central-1 ap-southeast-1 ap-southeast-2 eu-central-1 us-east-1 us-east-2 us-west-1 us-west-2
7. 将 SSH 公有密钥部署到每个 AWS 区域
for each_region in ${AWS_REGIONS} ; do aws ec2 import-key-pair --key-name bigb0ss_cloudproxy --public-key-material fileb:///$HOME/.ssh/id_rsa_bigb0ss_cloudproxy.pub --region $each_region ; done
安装cloud-proxy
$ git clone https://github.com/tomsteele/cloud-proxy
$ go get golang.org/x/crypto/sha3
$ go build main.go regions.go templates.go
$ mv main cloud-proxy
安装proxy-ng
## Compile the Sourcecode
clone https://github.com/jamesbcook/proxy-ng.git git
make
or
## Download the Binary from the Release Page (https://github.com/jamesbcook/proxy-ng/releases)
wget https://github.com/jamesbcook/proxy-ng/releases/download/0.2.0/proxy-ng-darwin
安装Terraform
## Terraform Download: https://www.terraform.io/downloads.html
wget https://releases.hashicorp.com/terraform/0.12.24/terraform_0.12.24_darwin_amd64.zip
unzip terraform_0.12.24_darwin_amd64.zip
local/bin && sudo chmod +x /usr/local/bin/terraform sudo mv terraform /usr/
### Create secrets.tfvars
$ cd ~/tools/cloud-proxy/
$ vi secrets.tfvars
do_token = "YOUR_DO_TOKEN" # We don't need this
do_ssh_fingerprint = "YOUR:SSH:FINGERPRINT" # We don't need this
aws_access_key = <YOUR KEY ID>
aws_secret_key = <YOUR SECRET ACCESS KEY>
aws_key_name = "bigb0ss_cloudproxy"
## Necessary File Creation
./cloud-proxy -aws -count 3
This will fail and get you warning... Then run...
## Initiating Terraform
terraform init
This will initiate the form created by cloud-proxy: .tf files
## Creating 3 AWS EC2 Instances & Establish SOCKS
"$HOME/.ssh/bigb0ss_cloudproxy.pem" ./cloud-proxy -aws -count 3 -key-location
现在,我们已经成功创建了 3 个 EC2 云虚拟机,该工具通过 SSH 动态隧道功能为这些虚拟机建立了 SOCKS 代理隧道。
Netstat 检查:
### Config File (*If you ran more than 4 EC2 instances, you can add more proxy ports)
$ cat socks5-proxies.json
{
"Proxies": [
"127.0.0.1:55555",
"127.0.0.1:55556",
"127.0.0.1:55557",
"127.0.0.1:55558"
]
}
### Running proxy-ng
$ ./proxy-ng -socksFile socks5-proxies.json
Netstat 检查:
Proxy-ng opens the following ports:
* 9292 for the local socks proxy
* 9293 for the local http proxy
* You can also automatically rotate the user-agents by configuring the tool with "useragents.json" file
示例用法
要使用它,您可以使用proxychains工具,将socks代理添加到文件末尾。
vi /etc/proxychains.conf
...snip...
[ProxyList]
add proxy here ...
meanwile
set to "tor" defaults
socks5 127.0.0.1 9292
proxychains nmap -Pn --open -sV -sC -iL enemy_ips.txt
或允许您的浏览器使用本地 SOCKS 将您的流量传递到它们,Firefox浏览器使用FoxyProxy插件进行代理配置
最终测试
我创建了另一个云虚拟机,并启动了简单的Python Web服务器来托管一个简单的网页,该网页将显示“[+] Proxy Testing.”。
然后,当我的浏览器配置为使用云代理时,我通过虚拟机的公共 IP 浏览页面。你可以看到,当我浏览页面时,源IP正在被更改。
关注我们
还在等什么?赶紧点击下方名片开始学习吧!
信 安 考 证
CISP、PTE、PTS、DSG、IRE、IRS、NISP、PMP、CCSK、CISSP、ISO27001... |
推 荐 阅 读
文章引用微信公众号"潇湘信安",如有侵权,请联系管理员删除!