【干货】利用云函数实现免费IP代理

  • A+
所属分类:安全闲碎

  本篇文章主要教各位白嫖玩家利用云函数实现免费IP代理。


1、注册腾讯云,搜索云函数。


2、新建云函数

【干货】利用云函数实现免费IP代理

【干货】利用云函数实现免费IP代理

【干货】利用云函数实现免费IP代理

【干货】利用云函数实现免费IP代理

3、以上操作完成后,接下来就需要填写代码,如下。

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import time
import random
import requests
import ssl
from urllib.parse import unquote

#忽略证书校验
requests.packages.urllib3.disable_warnings()
try:
    _create_unverified_https_context =ssl._create_unverified_context
except AttributeError:
   
pass
else
:
    ssl._create_default_https_context =_create_unverified_https_context

user_agent = ['Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.1)Gecko/20061010 Firefox/2.0',
                     
'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US) AppleWebKit/532.0 (KHTML,like Gecko) Chrome/3.0.195.6 Safari/532.0',
                     
'Mozilla/5.0 (Windows; U; Windows NT 5.1 ; x64; en-US; rv:1.9.1b2pre)Gecko/20081026 Firefox/3.1b2pre',
                     
'Opera/10.60 (Windows NT 5.1; U; zh-cn) Presto/2.6.30 Version/10.60',
                     
'Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4062; en; U; ssr)',
                     
'Mozilla/5.0 (Windows; U; Windows NT 5.1; ; rv:1.9.0.14)Gecko/2009082707 Firefox/3.0.14',
                     
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/51.0.2704.106 Safari/537.36',
                     
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, likeGecko) Chrome/57.0.2987.133 Safari/537.36',
                     
'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr; rv:1.9.2.4) Gecko/20100523Firefox/3.6.4 ( .NET CLR 3.5.30729)',
                     
'Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR) AppleWebKit/528.16(KHTML, like Gecko) Version/4.0 Safari/528.16',
                      
'Mozilla/5.0(Windows; U; Windows NT 6.0; fr-FR) AppleWebKit/533.18.1 (KHTML, like Gecko)Version/5.0.2 Safari/533.18.5',
                     
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;AcooBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
                     
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Acoo Browser;SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506)",
                     
"Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.35;Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
                     
"Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)",
                     
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64;Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; MediaCenter PC 6.0)",
                     
"Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0;WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
                     
"Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.2; .NET CLR1.1.4322; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.0.04506.30)",
                     
"Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN) AppleWebKit/523.15(KHTML, like Gecko, Safari/419.3) Arora/0.3 (Change: 287 c9dfb30)",
                     
"Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/527+ (KHTML, likeGecko, Safari/419.3) Arora/0.6",
                     
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre)Gecko/20070215 K-Ninja/2.1.1",
                     
"Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9)Gecko/20080705 Firefox/3.0 Kapiko/3.0",
                     
"Mozilla/5.0 (X11; Linux i686; U;) Gecko/20070322 Kazehakase/0.4.5",
                     
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) GeckoFedora/1.9.0.8-1.fc10 Kazehakase/0.5.6",
                     
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML,like Gecko) Chrome/17.0.963.56 Safari/535.11",
                     
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20(KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20",
                     
"Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr)Presto/2.9.168 Version/11.52",
                      
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML,like Gecko) Chrome/20.0.1132.11 TaoBrowser/2.0 Safari/536.11",
                     
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, likeGecko) Chrome/21.0.1180.71 Safari/537.1 LBBROWSER",
                     
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;Media Center PC 6.0; .NET4.0C; .NET4.0E; LBBROWSER)",
                     
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload732; .NET4.0C; .NET4.0E; LBBROWSER)",
                     
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML,like Gecko) Chrome/17.0.963.84 Safari/535.11 LBBROWSER",
                     
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64;Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;Media Center PC 6.0; .NET4.0C; .NET4.0E)",
                     
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64;Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;Media Center PC 6.0; .NET4.0C; .NET4.0E; QQBrowser/7.0.3698.400)",
                     
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload732; .NET4.0C; .NET4.0E)",
                     
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0;SV1; QQDownload 732; .NET4.0C; .NET4.0E; 360SE)",
                     
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; QQDownload732; .NET4.0C; .NET4.0E)",
                     
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64;Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;Media Center PC 6.0; .NET4.0C; .NET4.0E)",
                     
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.1 (KHTML, like Gecko)Chrome/21.0.1180.89 Safari/537.1",
                     
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, likeGecko) Chrome/21.0.1180.89 Safari/537.1",
                     
"Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn)AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148Safari/6533.18.5",
                     
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b13pre)Gecko/20110307 Firefox/4.0b13pre",
                     
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101Firefox/16.0",
                     
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML,like Gecko) Chrome/23.0.1271.64 Safari/537.11",
                     
"Mozilla/5.0 (X11; U; Linux x86_64; zh-CN; rv:1.9.2.10)Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
                     
]

def requests_headers():
    UA = random.choice(user_agent)
    headers = {
        
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
       
'User-Agent': UA,
       
'X-Forwarded-For': '10.10.{}.{}'.format(str(random.randint(0, 255)), str(random.randint(0, 255))),
       
}
   
return headers


def main_handler(event, context):
   
#url = unquote(event['queryString']['url'])
   
url = event['queryString']['url']
    agrs = event[
'queryString']
   
for key in agrs.keys():
       
if key != "url":
            url +=
"&" +  key + "=" + agrs[key]
    method = event[
'httpMethod']
    headers = requests_headers()
   
#headers = event['headers']
   
timeout = 60
   
try:
        data = event[
'body']
   
except:
        data =
None
    if
method == "POST":
        html = requests.post(
url=url, headers=headers, timeout=timeout, verify=False, data=data)
   
elif method == "GET":
        html = requests.get(
url=url, headers=headers, timeout=timeout, verify=False, data=data)
   
print(len(html.text))
   
return {
       
"isBase64Encoded": False,
       
"statusCode": html.status_code,
       
"headers": {'Content-Type': 'text/html; charset=utf-8'},
       
"body": html.text
    }

4、触发配置选择API网关触发,点击完成

【干货】利用云函数实现免费IP代理

5、执行超时时间建议填写60秒,默认3秒容易超时

【干货】利用云函数实现免费IP代理

6、触发管理处获取访问路径

【干货】利用云函数实现免费IP代理

7、在访问路径后拼接需要访问的url地址测试返回IP

测试返回公网地址IP,每次刷新访问不同IP地址

【干货】利用云函数实现免费IP代理

【干货】利用云函数实现免费IP代理

8、拼接URL地址访问百度,成功返回

【干货】利用云函数实现免费IP代理

查看后台日志:

【干货】利用云函数实现免费IP代理

进行sqlmap测试能判断出注入点,但mysql版本识别时未能成功,还需改进代码,欢迎各位一起参与呀


本文始发于微信公众号(黑云信息安全):【干货】利用云函数实现免费IP代理

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: