You love me, I love you. It's a headache for IP to be blocked [Python crawler practice: IP proxy JS reverse collection]

Five packs of spicy strips! 2021-09-15 12:45:53
love love you. headache ip


Hello everyone , I'm spicy .

It's hard to see ... It should be a day gone, I miss 【 I'm on the stage , This is the stem of teacher Guo Degang's crosstalk 】.

Go straight to today's theme , I believe that friends who have studied reptile know that reptile seal ip I have a headache , Spicy strips get you free today ip agent

Climb to the target

website : Standing master

 Insert picture description here

Tool use

development environment :win10、python3.7 development tool :pycharm、Chrome tool kit :requests,lxml

Analysis of project ideas

Request target web address Extract... From static web pages ip Address ( Port images will not be processed for the time being )

  Insert picture description here adopt xpath Extract the corresponding web page data The extracted data is encrypted

 Insert picture description here

Code for extracting data

session = requests.session()  
url = 'https://www.zdaye.com/FreeIPList.html'
response = session.get(url, headers=headers)
data = response.content.decode()
html_object = etree.HTML(data)
data_list = html_object.xpath('//*[@id="ipc"]/tbody/tr')
​
ip_list = []
for tr in data_list:
   ipnum = tr.xpath('./td[1]/text()')[0]
   ipnum2 = tr.xpath('./td[1]/@v')[0]
   ip_list.append((ipnum, ipnum2))

Find the data encryption method Check whether it is dynamically loaded data

 Insert picture description here

Not dynamic data Found encrypted js file

 Insert picture description here

Break point debugging js Code

 Insert picture description here  Insert picture description here

Parse the corresponding encryption function

def sdfsgfdg(s):
   s2 = s.split('m')
   ts = ''
   for i in range(len(s2) - 1, -1, -1):
       ts += chr(int(s2[i]) - 352)
   return ts
​
​
def MD5(p):
   return hashlib.md5((p).encode()).hexdigest().upper()
​
​
def get_keyurl(mk, ak):
   url = 'https://www.zdaye.com/' + mk + "_" + MD5(MD5(sdfsgfdg(mk) + "beiji" + ak)) + '.gif'
   return url
​
​
def dsfgsd(s, kk):
   s2 = s.split('#')
   ts = ''
   for i in range(len(s2) - 1, -1, -1):
       ts += chr(int(s2[i]) - kk)
​
   return ts
​
​
t = str(time.strftime('%Y/%m/%d %H:%M:%S',time.localtime())).replace(' ', "%20").replace("/0", "/")
new_url = 'https://www.zdaye.com/js/base.js?' + t
pp = session.get(new_url, headers=headers)
mk = re.findall('mk = "(.*?)";', pp.text)[0]
ak = re.findall('ak = "(.*?)";', pp.text)[0]
key_url = get_keyurl(mk, ak)
key = session.get(key_url, headers=headers)

out Function from html Page access to td Of v Analyze the tag data showm by MD5 Encryption method of

Easy source sharing

import re
import time
import requests  
from lxml import etree  
import hashlib
​
headers = {
   'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36',
   'Referer': 'https://www.zdaye.com/FreeIPList.html',
}
​
def sdfsgfdg(s):
   s2 = s.split('m')
   ts = ''
   for i in range(len(s2) - 1, -1, -1):
       ts += chr(int(s2[i]) - 352)
   return ts
​
​
def MD5(p):
   return hashlib.md5((p).encode()).hexdigest().upper()
​
​
def get_keyurl(mk, ak):
   url = 'https://www.zdaye.com/' + mk + "_" + MD5(MD5(sdfsgfdg(mk) + "beiji" + ak)) + '.gif'
   return url
​
​
def dsfgsd(s, kk):
   s2 = s.split('#')
   ts = ''
   for i in range(len(s2) - 1, -1, -1):
       ts += chr(int(s2[i]) - kk)
   return ts
​
session = requests.session()
url = 'https://www.zdaye.com/FreeIPList.html'
response = session.get(url, headers=headers)
data = response.content.decode()
html_object = etree.HTML(data)
data_list = html_object.xpath('//*[@id="ipc"]/tbody/tr')
ip_list = []
for tr in data_list:
   ipnum = tr.xpath('./td[1]/text()')[0]
   ipnum2 = tr.xpath('./td[1]/@v')[0]
   ip_list.append((ipnum, ipnum2))
t = str(time.strftime('%Y/%m/%d %H:%M:%S',time.localtime())).replace(' ', "%20").replace("/0", "/")
new_url = 'https://www.zdaye.com/js/base.js?' + t
pp = session.get(new_url, headers=headers)
# print(pp.text)
mk = re.findall('mk = "(.*?)";', pp.text)[0]
ak = re.findall('ak = "(.*?)";', pp.text)[0]
key_url = get_keyurl(mk, ak)
key = session.get(key_url, headers=headers)
key = int(key.text)
new_ip = []
for info in ip_list:
   ip = info[0].replace("wait", (dsfgsd(info[1], key)))
   new_ip.append(ip)
​
print(new_ip)

Welcome to discuss communication technology in the comments , If you can help, remember to give spicy strips for three times !

版权声明
本文为[Five packs of spicy strips!]所创,转载请带上原文链接,感谢
https://pythonmana.com/2021/09/20210909161448821M.html

  1. Python - Programmation orientée objet - pratique (6)
  2. Python - Programmation orientée objet - réflexion hasattr, GetAttr, GetAttr, delattr
  3. Python - Programmation orientée objet - _Dict
  4. Python - pydantic (2) Modèle imbriqué
  5. Non-ASCII character ‘\xe5‘ in file kf1.py on line 4, but no encoding declared; see http://python.or
  6. python笔记(一)
  7. Non - ASCII character 'xe5' in file kf1.py on Line 4, but no Encoding declared;Voirhttp://python.or
  8. Notes Python (1)
  9. Talk about how JMeter executes Python scripts concurrently
  10. In Beijing, you can't see the moon in the Mid Autumn Festival. Draw a blood red moon in Python
  11. Un des pandas crée un objet
  12. Machine learning | unitary regression model Python practical case
  13. Draw a "Lollipop chart" with Excel and python
  14. Python uses scikit learn to calculate TF-IDF
  15. Getting started with Python Basics_ 3 conditional statements and iterative loops
  16. Python dynamic properties and features
  17. 云计算开发:Python内置函数-min()函数详解
  18. [Python skill] how to speed up loop operation and numpy array operation
  19. 雲計算開發:Python內置函數-min()函數詳解
  20. Développement de l'informatique en nuage: explication détaillée de la fonction intégrée python - min ()
  21. 从0起步学Python(附程序实例讲解)第1讲
  22. 从0起步学Python(附程序实例讲解)第1讲
  23. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  24. Apprendre Python à partir de 0 (avec des exemples de programme) leçon 1
  25. With Python, I'll take you to enjoy it for a month when the Mid Autumn Festival is coming
  26. You can't write interface software in Python! Which software on sale has no UI?
  27. Python国内外原题解析及源码1~15
  28. Python实现长篇英文自动纠错~
  29. Python implémente la correction automatique des erreurs en anglais long
  30. Analyse des problèmes originaux et code source de Python au pays et à l'étranger 1 ~ 15
  31. 一张思维导图学Python之表白
  32. Python教学中课程思政建设的研究探索2
  33. Recherche sur la construction idéologique et politique du Programme d'études dans l'enseignement Python 2
  34. Une présentation de la cartographie mentale Python
  35. Python高级用法总结(8)-函数式编程
  36. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  37. Python Advanced use Summary (8) - functional Programming
  38. How to get started with Python and share learning methods for free. All you want to know is here
  39. Python + Mirai development QQ robot starting tutorial (2021.9.9 test is valid)
  40. Python趣味编程中(PPT适合青少儿和零基础学习Python)
  41. Python基础第1讲(含代码、Python最新安装包、父与子的编程之旅:与小卡特一起学Python中文版)
  42. 用 Python 增强 Git
  43. Python基礎第1講(含代碼、Python最新安裝包、父與子的編程之旅:與小卡特一起學Python中文版)
  44. Base Python leçon 1 (y compris le Code, le dernier paquet d'installation Python, le voyage de programmation parent - enfant: apprendre la version chinoise de python avec le petit Carter)
  45. Dans la programmation amusante Python (ppt pour les jeunes enfants et l'apprentissage de base zéro Python)
  46. 非常好的题目详解Python字典的用法
  47. Python teaches you to build wechat push live Betta reminder from 0 (single room simplified version)
  48. Python 协程与 JavaScript 协程的对比
  49. 手把手带你用Python实现一个量化炒股策略
  50. Main dans la main pour mettre en œuvre une stratégie quantitative de spéculation boursière en python
  51. Comparaison des coproductions Python et JavaScript
  52. 【python种子项目ppc】一行代码生成项目与开发详细指导
  53. Docker 部署一个用 Python 编写的 Web 应用
  54. Python - poetry(4)管理环境
  55. Python - poetry(2)命令介绍
  56. [Python Seed Project PPC] a line of Code Generation Project and Development detailed guidance
  57. Introduction à la commande python - Poetry (2)
  58. Python - Poetry (4) Management Environment
  59. I collected Banhua's spatial data set in Python. In addition to meizhao, I found her other secrets again!
  60. I modified ban Hua's boot password in Python and found her secret after logging in again!