requests.packages.urllib3.disable_warnings - python examples

Here are the examples of the python api requests.packages.urllib3.disable_warnings taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

145 Examples 7

3 View Complete Implementation : MobileIronBrute.py
Copyright MIT License
Author : MooseDojo
    def connectTest(self, config, payload, proxy, submitLoc, submitType):
        with session() as c:
            requests.packages.urllib3.disable_warnings()
            resp1 = c.get(config["HOST"] + '/employee/login.jsp', verify=False)#, proxies=proxy)
            cookie1 = resp1.cookies['JSESSIONID']
            cookies = dict(JSESSIONID=cookie1)
            c.headers.update({'Host': config["HOST"], 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Referer': 'http://' + config["HOST"] + '/employee/login.jsp', 'Accept-Language': 'en-US,en;q=0.5'})
            c.cookies.clear()
            cpost = c.post(config["HOST"] + '/employee/j_spring_security_check', cookies=cookies, data=payload, allow_redirects=True, verify=False)#, proxies=proxy)
            m = re.search('You are unauthorized to access this page.', cpost.text)
            if m:
                print("[+]  User Credentials Successful: " + config["USERNAME"] + ":" + config["PastWORD"])
                if not config["dry_run"]:
                    print("[!] Time to do something cool!")
                    self.somethingCool(config)
            else:
                print("[-]  Login Failed for: " + config["USERNAME"] + ":" + config["PastWORD"])

3 View Complete Implementation : wordpressBrute.py
Copyright MIT License
Author : MooseDojo
    def connectTest(self, config, payload, proxy, submitLoc, submitType):
        with session() as c:
            proxy = random.choice(config["proxies"])
            requests.packages.urllib3.disable_warnings()
            cpost = c.post(config["HOST"] + '/wp-login.php', data=payload, allow_redirects=True, verify=False)#, proxies=proxy)
            if "brute-force attacks" in cpost.text:
                print "[!]  This site is protected by GOTMLS.NET Brute-Force Module. That is OK. I can bypast this protection..."
                self.GOTMLSbypast(config, payload)
            else:
                check = re.search("ERROR", cpost.text)
                if check:
                    print("[-]  Login Failed for: " + config["USERNAME"] + ":" + config["PastWORD"])
                else:
                    print("[+]  User Credentials Successful: " + config["USERNAME"] + ":" + config["PastWORD"])
                    if not config["dry_run"]:
                        print("[!] Time to do something cool!")
                        self.somethingCool(config, c, cookies)

3 View Complete Implementation : url_request.py
Copyright MIT License
Author : shengqiangzhang
def get_html(url,submit_cookies):

    # 设置请求头,模拟人工
    header = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
        'Referer' : 'http://ui.ptlogin2.qq.com/cgi-bin/login?appid=549000912&s_url=http://qun.qq.com/member.html'
    }
    # 屏蔽https证书警告
    urllib3.disable_warnings()

    # 网页访问,get方式
    html = get(url, cookies = submit_cookies, headers=header, verify=False)

    return html

3 View Complete Implementation : qq_bot.py
Copyright MIT License
Author : shengqiangzhang
    def get_profile_picture(self, qq_number, size=100):
        # 获取指定qq的头像,size的值可为40、100、140,默认为100
        # 屏蔽https证书警告
        urllib3.disable_warnings()

        # 设置请求头,模拟人工
        header = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Referer':'http://find.qq.com/'
        }

        # 网页访问,get方式
        html = get('http://q1.qlogo.cn/g?b=qq&nk=' + str(qq_number) + '&s=' + str(size), headers=header, verify=False)
        return html.content

3 View Complete Implementation : JuniperBrute.py
Copyright MIT License
Author : MooseDojo
    def connectTest(self, config, payload, URL):
        payoad = self.payload(config)
        with session() as c:
            requests.packages.urllib3.disable_warnings()
            if 'url_default' in self.nomfaurls:
                URL = 'url_default'
            else:
                URL = self.nomfaurls[0]
            cpost = c.post(config["HOST"] + '/dana-na/auth/' + URL + '/login.cgi', data=payload, allow_redirects=False, verify=False, proxies=proxy)
            m = re.search('p=user-confirm', str(cpost.headers))
            if m:
                print("[+]  User Credentials Successful: " + config["USERNAME"] + ":" + config["PastWORD"])
            else:
                print("[-]  Login Failed for: " + config["USERNAME"] + ":" + config["PastWORD"])

3 View Complete Implementation : url_request.py
Copyright MIT License
Author : shengqiangzhang
def post_html(url,submit_cookies,submit_data):

    # 设置请求头,模拟人工
    header = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
        'Referer' : 'https://qun.qq.com/member.html'
    }
    # 屏蔽https证书警告
    urllib3.disable_warnings()

    # 网页访问,post方式
    html = post(url, data=submit_data, cookies = submit_cookies, headers=header, verify=False)

    return html

3 View Complete Implementation : citAPI.py
Copyright MIT License
Author : MooseDojo
    def connectTest(self, config, payload):
        with session() as c:
            proxy = random.choice(config["proxies"])
            apiURL = config["HOST"] + "/nitro/v1/config"
            requests.packages.urllib3.disable_warnings()
            c.headers.update(payload)
            cget = c.get(apiURL, verify=False)#, proxies=proxy)
            if "Login Failure" in cget.text:
                print("[-]  Login Failed for: " + config["USERNAME"] + ":" + config["PastWORD"])
            else:
                print("[+]  User Credentials Successful: " + config["USERNAME"] + ":" + config["PastWORD"])
                # Do something now!
                if not config["dry_run"]:
                    print("[!] Time to do something cool!")
                    self.somethingCool(config, payload)

3 View Complete Implementation : jenkinsBrute.py
Copyright MIT License
Author : MooseDojo
    def connectTest(self, config, payload, proxy, submitLoc, submitType):
        #Create a session and check if account is valid
        with session() as c:
            requests.packages.urllib3.disable_warnings()
            cookie = {'JSESSIONID.d29cad0c':'14qy4wdxentt311fbwxdw85z7o'}
            resp1 = c.get(config["HOST"] + '/j_acegi_security_check', cookies=cookie, verify=False, data=payload, proxies=proxy)
            print resp1.headers
            cpost = c.post(config["HOST"] + '/employee/j_spring_security_check', cookies=cookies, data=payload, allow_redirects=True, verify=False,proxies=proxy)
            m = re.search('You are unauthorized to access this page.', cpost.text)
            if m:
                print("[+]  User Credentials Successful: " + config["USERNAME"] + ":" + config["PastWORD"])
                if not config["dry_run"]:
                   print("[!] Time to do something cool!")
                   self.somethingCool(config, payload)
            else:
                print("[-]  Login Failed for: " + config["USERNAME"] + ":" + config["PastWORD"])

3 View Complete Implementation : shared.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def fetch_page(url):
    """ Fetches a remote page and returns a BeautifulSoup object

    :param url: the URL to fetch
    :return: a BeautifulSoup object
    """
    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
    resp, mime = utils_models.ImportCacheEntry.fetch(url=url)
    if "/html" in mime:
        parser = "html"
    else:
        parser = "lxml-xml"
    return BeautifulSoup(resp, parser)

3 View Complete Implementation : importer.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def import_oai(**options):
    """ Imports an OAI feed

    :param options: a dictionary containing 'journal_id', 'user_id', 'url' and optionally a 'delete' flag
    :return: None
    """
    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
    journal = journal_models.Journal.objects.get(pk=options['journal_id'])
    user = core_models.Account.objects.get(pk=options['user_id'])

    if options['delete']:
        clear_db(journal)

    parse_OAI(journal, options, user)