aku1 发表于 2008-7-4 9:45:56 |
导出来的是
Client IP Address Name Lease Expiration Type Unique ID Description 10.16.1.31 SZ-PE-Betty.xxx.com 7/4/2008 7:23:39 AM DHCP RAS 10.16.1.32 7/4/2008 3:08:45 AM DHCP 0011f9ffa8483930333131393132 10.16.1.33 SZ-PE-Betty.xxx.com 7/4/2008 7:23:40 AM DHCP RAS 10.16.1.34 7/4/2008 7:19:02 AM DHCP 636973636f2d303031322e643930352e376538302d566c31 10.16.1.35 SZ-PM03-Kris.xxx.com 7/4/2008 10:12:10 AM DHCP 001c2314ba27 10.16.1.36 SZ-STEC-JIShen.xxx.com 7/4/2008 8:24:55 AM DHCP 0016e60fb01f 10.16.1.37 SZ-PM03-Andy.xxx.com 7/4/2008 8:17:53 AM DHCP 0016e60ee048 10.16.1.38 SZ-PE-Pager.xxx.com 7/4/2008 9:03:53 AM DHCP 0013205bbba3 10.16.1.39 STEC-GabrielNB.xxx.com 7/4/2008 8:26:27 AM DHCP 001422bd020e 10.16.1.40 SZ-HRMS-GraceNB.xxx.com 7/4/2008 8:21:06 AM DHCP 00188bb2bb29 10.16.1.41 SZ-PM02-larryNb.xxx.com 7/4/2008 2:45:49 PM DHCP 001c2333845b 10.16.1.42 SZ-PE-Derek.xxx.com 7/4/2008 7:59:06 AM DHCP 0016e60ed048 10.16.1.43 SZ-MKTG-JanNB.xxx.com 7/4/2008 8:23:22 AM DHCP 00061bda2c93 10.16.1.44 SZ-PUMA-Sailor.xxx.com 7/4/2008 2:11:47 PM DHCP 0016e67c72ab 10.16.1.45 SZ-QASY-MARNB.xxx.com 7/4/2008 8:10:08 AM DHCP 000d6077bc03 10.16.1.46 SZ-PM04-HOllyNB.xxx.com 7/4/2008 8:19:17 AM DHCP 001c230984a0 10.16.1.47 SZ-STEC-Kris.xxx.com 7/4/2008 8:08:16 AM DHCP 0013205bba3f 10.16.1.48 SZ-PM02-Janet.xxx.com 7/4/2008 8:37:29 AM DHCP 0016e60f32c8 10.16.1.49 SZ-Public-PD.xxx.com 7/4/2008 6:52:07 AM DHCP 0014856f2a60 10.16.1.50 SZ-PM02-KC.xxx.com 7/4/2008 8:25:25 AM DHCP 0010c6a587ba
...............
利用里三个脚本
'Get-Dhcp
Const ForReading = 1 Const ForWriting = 2 ScriptPath="C:\FSO\DHCP.txt"
Set oFSO = CreateObject("Scripting.FileSystemObject") Set objFile = oFSO.OpenTextFile(ScriptPath, ForReading)
Do Until objFile.AtEndOfStream strLine = objFile.ReadLine if instr(1,strline,"DHCP",1)>0 then
strNewText = strnewtext&strLine &VbCrlf end if Loop
objFile.Close
Set objFile = oFSO.OpenTextFile("C:\FSo\file1.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
'Get-mac.vbs
Const ForReading = 1 Const ForWriting = 2
Set oFSO = CreateObject("Scripting.FileSystemObject") Set objFile = oFSO.OpenTextFile("C:\FSo\file1.txt", ForReading)
Do Until objFile.AtEndOfStream strLine = objFile.ReadLine strline = Right(strline,14)
For i=1 to len(strline)/2
strline1=mid(strline,2*i,2)& ":" StrnewText=strnewText&strline1 Next StrnewText=strnewText&VbCrlf Loop
objFile.Close
Set objFile = oFSO.OpenTextFile("C:\FSo\file2.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
'Get-iptables
Const ForReading = 1 Const ForWriting = 2
Set oFSO = CreateObject("Scripting.FileSystemObject") Set objFile = oFSO.OpenTextFile("C:\FSo\file2.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine strline ="iptables -A FORWARD -i $IF_PRV -m mac --mac-source "&left(strline,17)&" -j DROP" strnewtext=strnewtext&strline&VbCrlf
Loop
objFile.Close
Set objFile = oFSO.OpenTextFile("C:\FSo\iptables.txt", ForWriting)
objFile.WriteLine strNewText
objFile.Close
最后结果如下,非常好的导入lptables里,用手下也痛啊 :)
iptables -A FORWARD -i $IF_PRV -m mac --mac-source A:M :DH:CP: R:AS -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 33:31:31:39:31:32 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source A:M :DH:CP: R:AS -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 38:30:2d:56:6c:31 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:1c:23:14:ba:27 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:0f:b0:1f -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:0e:e0:48 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:13:20:5b:bb:a3 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:14:22:bd:02:0e -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:18:8b:b2:bb:29 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:1c:23:33:84:5b -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:0e:d0:48 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:06:1b:da:2c:93 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:7c:72:ab -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:0d:60:77:bc:03 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:1c:23:09:84:a0 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:13:20:5b:ba:3f -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:0f:32:c8 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:14:85:6f:2a:60 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:10:c6:a5:87:ba -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:13:20:5b:b6:95 -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:10:c6:ab:2b:ce -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:0d:60:f9:cf:0f -j DROP iptables -A FORWARD -i $IF_PRV -m mac --mac-source 00:16:e6:0e:76:1e -j DROP
.................
|