通过爬虫反查IP地址

加入你知道 对方的网络IP

71.112.190.213

抓取的链接: https://site.ip138.com/71.112.190.213/

python 复制代码
# !/usr/bin/env python
# -*-coding:utf-8 -*-

"""
# File       : two_spider_ip.py
# Time       :2024/1/30 9:34
# Author     :Jewel
# version    :python 3.9.8
# Description:
"""
import time

import pandas as pd
import requests
from icecream import ic
import re

def get_address(ip):
    ic(ip)
    url = f'https://site.ip138.com/{ip}/'

    data = {
        # 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
    }
    response = requests.get(url, headers=data)
    html_str = response.text
    address = re.findall('<h3>(.*?)</h3>', html_str)
    print(address)  # ['美国 犹他 盐湖城 Level3']
    return address[0]





if __name__ == '__main__':

    df_ips = pd.read_csv('./email_null.csv')

    df_all=df_ips.reset_index(drop=True)
    for ids, value in df_all.iterrows():
        ic(value)
        ip = value['user_ip'].split(',')[0]
        ips = get_address(ip)
        df_all.loc[ids, 'pi'] = ips
        time.sleep(1)

    df_all.to_csv('./two_ips.csv', index=False)


相关推荐
FPGA小迷弟1 天前
FPGA开发Vivado Block Design/Vitis/SDK/xlinx/开发教程,保姆级别,一看就会!
网络协议·tcp/ip·fpga开发·verilog·fpga
FPGA小迷弟1 天前
基于FPGA实现智能网卡的概念,什么是智能网卡
网络协议·tcp/ip·fpga开发·verilog·fpga
深圳恒讯1 天前
国外云服务器部署企业官网,怎样确定配置、IP 与后续扩容方案?
运维·服务器·tcp/ip
深蓝电商API2 天前
从爬虫到Agent:数据采集的下一个形态是什么
爬虫
xiangjiaodalishi2 天前
主流 AI 爬虫 User-Agent 清单大全:分组、配置与持续维护(2026 版)
人工智能·爬虫·python
jaysee-sjc2 天前
【苍穹外卖】Day10:定时任务与 WebSocket 实时提醒实战
java·开发语言·javascript·数据库·vue.js·websocket·网络协议
未来之窗软件服务2 天前
诡异的网络IP/域名/ICMP通应用层失败骨干网分层拦截分析-东方仙盟
网络·tcp/ip·智能路由器·dns劫持·仙盟创梦ide·东方仙盟
幻智星科技2 天前
我砍掉了FPGA里的ARM核项目反而提前交付了
arm开发·网络协议·fpga开发·硬件架构
cyf312 天前
半小时玩转RDMA:从零跑通高速网络通信
网络协议·rdma·高速通信·rocev2·wireshark抓包·ai 智算网络·入门实战
砺星Leetx2 天前
工业总线选型与对接实战:PROFINET、EtherCAT、EtherNet/IP、PROFIBUS、Modbus-TCP 与 CC-Link
网络·网络协议·tcp/ip·控制器·国产拧紧系统