Python3對IP進行查詢

2021-10-04 10:07:04 字數 1186 閱讀 7910

日常學習記錄,大佬勿噴,侵權請私聊我,我會立即處理

#!/usr/bin/python3

# -*- coding: utf-8 -*-

# --author:valecalida--

from bs4 import beautifulsoup

import requests

import random

import time

import re

def process_website(data):

url = ""#查詢ip位址是通過這個平台,只適應於少量查詢

res = requests.post(url=url, headers=header, data=data)

res.encoding = 'utf-8'

soup = beautifulsoup(res.text, 'lxml')

trs = soup.find_all(['td'])[2:10]

params = re.findall('(.*?)', str(trs))

values = re.findall('(.*?)', str(trs))

return params, values

def main(input_ip):

data =

params, values = process_website(data)

print("\t", str.center('ip_address', 16), str.center(params[0], 16), str.center(params[1],24), str.center(params[2], 24), str.center(params[3],24))

print("\t%s\t%4s\t%s\t%s\t%2s" % (input_ip, values[0], values[1], values[2], values[3]))

if __name__ == '__main__':

print(banner)

count = 1

while true:

input_ip = input("[%d] 請輸入您想要查詢的ip位址 >> " % count)

main(input_ip)

count += 1

time.sleep(3)

python3模擬IP進行刷投票

現在各種投票活動,各個做投票的公司都為公平性,增加了每個ip只能投一票。但是python拿到 這個 提供的高匿ip,就能模仿ip,進行投票了。coding utf 8 import re import random import sys import time import datetime imp...

python3進行excel操作

只要有需求,就會找出解決問題的方法 pip install xlrd 讀取 pip install xlwt 寫入 首先先初始化 import xlwt excel xlwt.workbook encoding utf 8 建立excel sheet excel.add sheet member 建...

python3進行物件中元素屬性查詢所帶來的開銷

coding utf 8 classa def init self self.dic defdicindinclass obj,k for i in range 1000000 a obj.dic k defdicind d,k for i in range 1000000 a d k obj a ...