中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-10 23:04
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Discussion on improving the acquisition of new external network IPs
Printable Version  1,579 / 9
Floor1 hackiller Posted 2008-01-07 11:00
初级用户 Posts 16 Credits 39
The original that the external network IP acquisition was through the swz8.com website extraction
Now this website has been closed. The younger brother found its IP acquisition page from ip138
But I don't know much about text processing. Please help improve it

@echo off
title Get local intranet and external network IP
if exist ip2city.asp del ip2city.asp
if exist ip.txt del ip.txt
if exist 1.txt del 1.txt
if exist 2.txt del 2.txt
wget http://www.ip138.com/ip2city.asp
ren ip2city.asp 1.txt
At this time, the content of 1.txt is



The following is to extract with SED

sed -r "s/(+\.+\.+\.+).*/\n\1/;s/^.*\n//" 1.txt >2.txt
for /f %%i in (2.txt) do set i=%%i
echo %i% >ip.txt
start ip.txt

The content of IP.txt is


I'm a novice. Please help the master to simplify and improve, and remove the space followed by carriage return in IP.TXT
Floor2 hackiller Posted 2008-01-07 11:03
初级用户 Posts 16 Credits 39
Many codes for removing spaces and line breaks, I tried them, but they didn't work
Floor3 junchen2 Posted 2008-01-07 11:18
高级用户 Posts 219 Credits 537 From 杭州--半山
sed "s/[ |\t]\+$//" ip.txt
Floor4 hackiller Posted 2008-01-07 11:21
初级用户 Posts 16 Credits 39
Originally posted by junchen2 at 2008-1-7 11:18 AM:
sed "s/\+$//" ip.txt

sed "s/\+$//" ip.txt >1.txt
The space becomes a black block, and the carriage return remains a carriage return
Floor5 hackiller Posted 2008-01-07 11:33
初级用户 Posts 16 Credits 39
Found a VBS online
But the result is not all numbers

Floor6 lxmxn Posted 2008-01-07 12:44
版主 Posts 4,938 Credits 11,386
```batch
for /f "delims= tokens=2" %a in ('wget -qO- http://www.ip138.com/ip2city.asp^|findstr /rc:"\*\]"') do @set/p=my ip is <nul>1.txt
```
Floor7 zh159 Posted 2008-01-07 13:44
金牌会员 Posts 1,467 Credits 3,687
Get IP using VBS:

The VBS part is ( There must be a WScript.sleep 200 delay part, otherwise it will occupy 99% system resources and not get data for a long time ):


[ Last edited by zh159 on 2008-1-7 at 01:49 PM ]
Floor8 yagu1648 Posted 2008-08-29 23:30
新手上路 Posts 1 Credits 2
for /f "skip=6 delims= tokens=2" %%a in ('wget -qO- http://www.ip138.com/ip2city.asp') do set IP=%%a&echo %IP:~0,-2%>IP.txt

Carriage return is not easy to remove...
Floor9 pighead123 Posted 2008-12-08 19:06
初级用户 Posts 23 Credits 42


Pure numbers

The moderator has already given the answer

[ Last edited by pighead123 on 2008-12-8 at 19:16 ]
Floor10 ily2013 Posted 2008-12-09 15:19
中级用户 Posts 83 Credits 247
Mine is like this
curl http://members.3322.org/dyndns/getip
I used to get it on ip138 before, but it was a bit troublesome to analyze the ip.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023