title: Vendor serial number usb white list
body: <p>I'm currently building a Java app that could detect USB drive, and can identify the difference between a personal USB drive and an unauthorized USB drive by using vendor serial number, my goal is to whitelist the identified USB drive and so only the unauthorized vendor serial number is shown.</p>
  <p>Preferably I'd like to add a feature where I could add the more authorized USB drive as a list.</p>
  <p>SRC code:</p>
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package serialnumber;
  
  import java.nio.file.FileStore;
  import java.nio.file.FileSystems;
  
  /**
   *
   * @author Verdatabo
   */
  public class SerialNumber {
  
      /**
       * @param args the command line arguments
       */
      public static void main(String[] args) throws Exception {
          StringBuilder sb=new StringBuilder();
          String saved_vsn =&quot;Windows (C:)         vsn:-1024236825&quot; +&quot;Can-a-bees (D:)      vsn:-2142019920&quot;;
  
          // while(true)
          //{
          for (FileStore store : FileSystems.getDefault().getFileStores())
          {
              sb.append(String.format(&quot;%-20s vsn:%s\n&quot;, store, store.getAttribute(&quot;volume:vsn&quot;)));
  
  
  
         //     if (!saved_vsn.equals(sb.append))
  
          //     {
                  // System.out.println(&quot;SKIP&quot;);
           //    }
  
              System.out.println(sb.toString());
          }
          //}
      }
  
  }
  
  </code></pre>
  <p>Output:</p>
  <pre><code>Windows (C:)         vsn:-1024236825
  
  Windows (C:)         vsn:-1024236825
  Can-a-bees (D:)      vsn:-2142019920
  
  Windows (C:)         vsn:-1024236825
  Can-a-bees (D:)      vsn:-2142019920
  Fuscus (E:)          vsn:1719839436
  
  Disconnected from the target VM, address: '127.0.0.1:17429', transport: 'socket'
  
  Process finished with exit code 0
  </code></pre>