comparison src/luan/modules/IoLuan.java @ 1698:2dbcc8360a3e

backup security
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 27 Jun 2022 20:51:49 -0600
parents 8f38abaf779f
children 745f756e719b
comparison
equal deleted inserted replaced
1697:aff2309ae510 1698:2dbcc8360a3e
20 import java.io.IOException; 20 import java.io.IOException;
21 import java.io.FileNotFoundException; 21 import java.io.FileNotFoundException;
22 import java.net.URL; 22 import java.net.URL;
23 import java.net.InetAddress; 23 import java.net.InetAddress;
24 import java.net.Inet4Address; 24 import java.net.Inet4Address;
25 import java.net.NetworkInterface;
26 import java.net.MalformedURLException; 25 import java.net.MalformedURLException;
27 import java.net.UnknownHostException; 26 import java.net.UnknownHostException;
28 import java.util.Enumeration;
29 import java.util.Map; 27 import java.util.Map;
30 import javax.naming.NamingException; 28 import javax.naming.NamingException;
31 import javax.naming.NameNotFoundException; 29 import javax.naming.NameNotFoundException;
32 import javax.naming.directory.Attribute; 30 import javax.naming.directory.Attribute;
33 import javax.naming.directory.InitialDirContext; 31 import javax.naming.directory.InitialDirContext;
640 } 638 }
641 } 639 }
642 640
643 public static LuanTable my_ips(Luan luan) throws IOException, LuanException { 641 public static LuanTable my_ips(Luan luan) throws IOException, LuanException {
644 LuanTable tbl = new LuanTable(); 642 LuanTable tbl = new LuanTable();
645 for( Enumeration<NetworkInterface> e1 = NetworkInterface.getNetworkInterfaces(); e1.hasMoreElements(); ) { 643 for( InetAddress ia : IoUtils.getInetAddresses() ) {
646 NetworkInterface ni = e1.nextElement(); 644 if( ia instanceof Inet4Address )
647 for( Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements(); ) { 645 tbl.put(luan,ia.getHostAddress(),true);
648 InetAddress ia = e2.nextElement();
649 if( ia instanceof Inet4Address )
650 tbl.put(luan,ia.getHostAddress(),true);
651 }
652 } 646 }
653 return tbl; 647 return tbl;
654 } 648 }
655 649
656 public static LuanTable dns_lookup(String domain,String type) 650 public static LuanTable dns_lookup(String domain,String type)