I was working on the logic to ignore the file's which is created by "Microsoft" which crawling the C:\ drive as shared using CIFS ("smb://hostname:445/sharedfoldername").
I was using the suggested solution by my previous post link (Solution was to use PEParser code. It was working fine when I was on same windows machine, but when I tried to run my application at ubuntu and from there I tried to craw the shared c:\ drive - Its was crawling without any issue if I did not use the logic to ignore microsoft file. BUT when I applied it then I could not found Microsoft file which I want to ignore.
Can any one suggest any solution to get file's windows property from ubuntu/linux machine? Following code block return the company name value at windows - same I want to get from smb path.
PE pe = null;
try {
pe = PEParser.parse(path);
ResourceDirectory rd = pe.getImageData().getResourceTable();
ResourceEntry[] entries = ResourceHelper.findResources(rd, ResourceType.VERSION_INFO);
for (int i = 0; i < entries.length; i++) {
byte[] data = entries[i].getData();
VersionInfo version = ResourceParser.readVersionInfo(data);
StringFileInfo strings = version.getStringFileInfo();
StringTable table = strings.getTable(0);
for (int j = 0; j < table.getCount(); j++) {
String key = table.getString(j).getKey();
String value = table.getString(j).getValue();
if (key.equalsIgnoreCase("companyname")) {
if (value.contains("Microsoft")) {
return true;
} else {
return false;
}
}
}
}
} catch (Exception e) {
log.debug("Exception caught which checking for Microsoft File " + e.getMessage());
}