Java调用snmpwalk获得路由器ARP表

这个Java程序从指定路由器中通过SNMP协议获取ARP表信息。它包括几个类,如Fetch作为入口点,Config用于读取配置文件,FetchRunner处理ARP数据,以及ArpTableFetcher作为核心功能类,负责解析SNMPwalk命令的输出并提取ARP条目。
摘要由CSDN通过智能技术生成
入口类:Fetch.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());}
    }
}

配置文件类:Config.java
package arpfetcher;

import java.io.*;
import java.util.*;
/**
 *
 * 
@author signx
 
*/
public class Config {

    
pri
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值