入口类:Fetch.java
配置文件类:Config.java
/*
* Main.java
*
* Created on 2007-9-4, 2:25:07
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package arpfetcher;
import java.util.*;
/**
*
* @author signx
*/
public class Fetch {
public Fetch() {
}
public static void main(String[] args) {
int total = 0;
Config config = new Config("target.conf");
ArrayList list = config.readConfig();
SqlDatabase db = null;
try {
ListIterator it = list.listIterator();
while (it.hasNext()) {
String[] s = (String[])it.next();
total += new FetchRunner(s[1],s[2],s[0]).run();
}
}
catch (Exception e) {System.out.println(e.getMessage());}
}
}
* Main.java
*
* Created on 2007-9-4, 2:25:07
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package arpfetcher;
import java.util.*;
/**
*
* @author signx
*/
public class Fetch {
public Fetch() {
}
public static void main(String[] args) {
int total = 0;
Config config = new Config("target.conf");
ArrayList list = config.readConfig();
SqlDatabase db = null;
try {
ListIterator it = list.listIterator();
while (it.hasNext()) {
String[] s = (String[])it.next();
total += new FetchRunner(s[1],s[2],s[0]).run();
}
}
catch (Exception e) {System.out.println(e.getMessage());}
}
}
配置文件类:Config.java
package arpfetcher;
import java.io.*;
import java.util.*;
/**
*
* @author signx
*/
public class Config {
private BufferedReader configFile;
public
import java.io.*;
import java.util.*;
/**
*
* @author signx
*/
public class Config {
private BufferedReader configFile;
public

这个Java程序从指定路由器中通过SNMP协议获取ARP表信息。它包括几个类,如Fetch作为入口点,Config用于读取配置文件,FetchRunner处理ARP数据,以及ArpTableFetcher作为核心功能类,负责解析SNMPwalk命令的输出并提取ARP条目。
最低0.47元/天 解锁文章
792





