Advertisement
Guest User

showdevixes

a guest
Mar 6th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.78 KB | None | 0 0
  1. import java.awt.BorderLayout;
  2. import java.awt.EventQueue;
  3.  
  4. import javax.swing.JFrame;
  5. import javax.swing.JPanel;
  6. import javax.swing.border.EmptyBorder;
  7. import javax.swing.JTextArea;
  8.  
  9. import jpcap.JpcapCaptor;
  10. import jpcap.NetworkInterface;
  11. import jpcap.NetworkInterfaceAddress;
  12.  
  13.  
  14. public class showdEvixes extends JFrame {
  15.  
  16.     private JPanel contentPane;
  17.     static JTextArea txtrXd;
  18.  
  19.     /**
  20.      * Launch the application.
  21.      */
  22.     public static void main(String[] args) {
  23.  
  24.         EventQueue.invokeLater(new Runnable() {
  25.             public void run() {
  26.                 try {
  27.                     showdEvixes frame = new showdEvixes();
  28.                     frame.setVisible(true);
  29.                 } catch (Exception e) {
  30.                     e.printStackTrace();
  31.                 }
  32.             }
  33.         });
  34.         NetworkInterface[] devices = JpcapCaptor.getDeviceList();
  35.         for (int i = 0; i < devices.length; i++) {
  36.              
  37.             txtrXd.append(i+": "+devices[i].name + "(" + devices[i].description+")");
  38.  
  39.              
  40.               txtrXd.append(" datalink: "+devices[i].datalink_name + "(" + devices[i].datalink_description+")");
  41.  
  42.              
  43.               System.out.print(" MAC address:");
  44.               for (byte b : devices[i].mac_address)
  45.                   txtrXd.append(Integer.toHexString(b&0xff) + ":");
  46.              // System.out.println();
  47.               txtrXd.append("\n");
  48.              
  49.               for (NetworkInterfaceAddress a : devices[i].addresses)
  50.                 txtrXd.append(" address:"+a.address + " " + a.subnet + " "+ a.broadcast +"\n");
  51.             }
  52.        
  53.     }
  54.  
  55.     /**
  56.      * Create the frame.
  57.      */
  58.     public showdEvixes() {
  59.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  60.         setBounds(100, 100, 700, 300);
  61.         contentPane = new JPanel();
  62.         contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  63.         contentPane.setLayout(new BorderLayout(0, 0));
  64.         setContentPane(contentPane);
  65.        
  66.          txtrXd = new JTextArea();
  67.         txtrXd.setText("xD");
  68.         contentPane.add(txtrXd, BorderLayout.CENTER);
  69.     }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement