救救小妹!这样的文件怎么读~~

dmgywan 2008-07-26 01:34:08
Building configuration...

Current configuration:
!
version 12.1
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
no service dhcp
!
hostname ym
!
logging buffered 4096 debugging
no logging console
enable secret 5 $1$aYLE$NH7uaNI11VrMHVNnzxZcg0
enable password 7 140E1F1314557C73
!
!
!
!
!
ip subnet-zero
no ip finger
no ip domain-lookup
!
lane client flush
!
!
!
!
!
!
!
interface FastEthernet0/0
ip address 61.241.171.149 255.255.255.252
ip access-group 100 in
no ip proxy-arp
ip nat outside
no ip mroute-cache
full-duplex
no cdp enable
!
interface Serial1/0
no ip address
no ip mroute-cache
shutdown
no cdp enable
!
interface Serial1/1
no ip address
no ip mroute-cache
shutdown
no cdp enable
!
interface Serial1/2
no ip address
no ip mroute-cache
shutdown
no cdp enable
!
interface Serial1/3
no ip address
no ip mroute-cache
shutdown
no cdp enable
!
interface FastEthernet2/0
ip address 61.241.172.2 255.255.255.192
ip access-group 100 in
no ip proxy-arp
ip nat inside
no ip mroute-cache
full-duplex
no cdp enable
!
ip nat pool ymxx 61.241.172.8 61.241.172.8 netmask 255.255.255.192
ip nat inside source list 1 pool ymxx overload
ip classless
ip route 0.0.0.0 0.0.0.0 61.241.171.150
ip route 10.87.0.0 255.255.240.0 10.87.0.1
no ip http server
!
access-list 1 permit 10.87.0.0 0.0.255.255
access-list 1 deny any
access-list 100 deny icmp any any
access-list 100 deny tcp any any eq 135
access-list 100 deny tcp any any range 136 139
access-list 100 deny udp any any eq 135
access-list 100 deny udp any any range 136 netbios-ss
access-list 100 deny tcp any any eq 445
access-list 100 deny tcp any any eq 4444
access-list 100 deny tcp any any eq 1434
access-list 100 deny tcp any any eq 5554
access-list 100 deny tcp any any eq 5354
access-list 100 deny tcp any any eq 7205
access-list 100 permit ip any any
no cdp run
snmp-server engineID local 0000000902000006D6BB6C00
snmp-server community ymxx RO
snmp-server community ymxw RW
snmp-server packetsize 2048
!
!
line con 0
transport input none
line aux 0
line vty 0 4
exec-timeout 4 0
password 7 1419171F1B0B3820272D3D212701
login
!
scheduler allocate 3000 1000
end

===========
要读出ip address iproute等数据
...全文
188 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
dmgywan 2008-07-26
  • 打赏
  • 举报
回复
谢谢开心大哥~~ 我去试试
嗷嗷叫的老马 2008-07-26
  • 打赏
  • 举报
回复
来看MM............
happy_sea 2008-07-26
  • 打赏
  • 举报
回复
而且上面的代码是把没有ip地址的网卡名称也给记录下来了,如果不需要楼主自己加个判断就行了。
happy_sea 2008-07-26
  • 打赏
  • 举报
回复
open "c:\input.dat" for input as #1
dim sTemp as string,sGet as string
do while not eof(1)
line input #1,sTemp
if sTemp like "interface *" then
sGet=mid(sTemp,len("interface ")+1,len(sTemp))
debug.print "interface:" & sGet
'这里添加存入数据库的代码
elseif sTemp like "ip address *" then
sGet=mid(sTemp,len("ip address ")+1,len(sTemp))
debug.print "ip address:" & sGet
'这里添加存入数据库的代码
elseif ......... '其余的你自己写吧
'.........
end if
loop
close #1

以上代码是用笨方法随手写的,哪位会正则表达式的麻烦给来个简单的。
dmgywan 2008-07-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 happy_sea 的回复:]
你说的数据仅指61.241.171.149等等这些IP地址和路由经过的地址?还是包括网卡名称FastEthernet0/0等?
[/Quote]
包括网卡名称
happy_sea 2008-07-26
  • 打赏
  • 举报
回复
你说的数据仅指61.241.171.149等等这些IP地址和路由经过的地址?还是包括网卡名称FastEthernet0/0等?
dmgywan 2008-07-26
  • 打赏
  • 举报
回复
interface FastEthernet0/0
ip address 61.241.171.149 255.255.255.252
ip access-group 100 in

ip route 0.0.0.0 0.0.0.0 61.241.171.150
ip route 10.87.0.0 255.255.240.0 10.87.0.1

将这些语句中的数据提取出来放到一个数据库中
sonic_andy 2008-07-26
  • 打赏
  • 举报
回复
可以用正则表达式regexp
happy_sea 2008-07-26
  • 打赏
  • 举报
回复
打开文件,逐行读取,逐行分析呗。
用正则表达式应该很简单,可惜我不会,不过用笨方法分析字符串应该也能实现。
请楼主把要求再说得具体一些,不然不好写代码。
dmgywan 2008-07-26
  • 打赏
  • 举报
回复
爱,分太少了,没人理
55555555555
dmgywan 2008-07-26
  • 打赏
  • 举报
回复
怎么没法给分啊

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧