mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
added signature checking for javafx videos
This commit is contained in:
parent
48452a8a27
commit
ed4e01134c
@ -21,7 +21,9 @@ package org.sleuthkit.autopsy.corecomponents;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@ -33,6 +35,8 @@ import org.openide.util.lookup.ServiceProviders;
|
||||
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
|
||||
import org.sleuthkit.autopsy.coreutils.ImageUtils;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData.TSK_FS_NAME_FLAG_ENUM;
|
||||
|
||||
/**
|
||||
@ -50,6 +54,7 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
private final MediaViewVideoPanel videoPanel;
|
||||
private final String[] videoExtensions; // get them from the panel
|
||||
private String[] imageExtensions; // use javafx supported
|
||||
private final List<String> supportedMimes;
|
||||
private final MediaViewImagePanel imagePanel;
|
||||
private boolean videoPanelInited;
|
||||
private boolean imagePanelInited;
|
||||
@ -69,9 +74,9 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
imagePanel = new MediaViewImagePanel();
|
||||
videoPanelInited = videoPanel.isInited();
|
||||
imagePanelInited = imagePanel.isInited();
|
||||
|
||||
|
||||
videoExtensions = videoPanel.getExtensions();
|
||||
|
||||
supportedMimes = videoPanel.getMimeTypes();
|
||||
customizeComponents();
|
||||
logger.log(Level.INFO, "Created MediaView instance: " + this);
|
||||
}
|
||||
@ -141,9 +146,10 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
this.switchPanels(false);
|
||||
|
||||
} else if (videoPanelInited
|
||||
&& (containsExt(file.getName(), videoExtensions) || containsExt(file.getName(), AUDIO_EXTENSIONS))) {
|
||||
&& containsMimeType(selectedNode,supportedMimes)&&(containsExt(file.getName(), videoExtensions) || containsExt(file.getName(), AUDIO_EXTENSIONS))) {
|
||||
videoPanel.setupVideo(file, dims);
|
||||
switchPanels(true);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Exception while setting node", e);
|
||||
@ -218,8 +224,8 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
}
|
||||
|
||||
if (videoPanelInited && videoPanel.isInited()) {
|
||||
if (containsExt(name, AUDIO_EXTENSIONS)
|
||||
|| (containsExt(name, videoExtensions))) {
|
||||
if ((containsExt(name, AUDIO_EXTENSIONS)
|
||||
|| containsExt(name, videoExtensions))&& containsMimeType(node,supportedMimes)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -254,4 +260,22 @@ public class DataContentViewerMedia extends javax.swing.JPanel implements DataCo
|
||||
}
|
||||
return Arrays.asList(exts).contains(ext);
|
||||
}
|
||||
private static boolean containsMimeType(Node node, List<String> mimeTypes) {
|
||||
if (mimeTypes.isEmpty()) return true; //GStreamer currently is empty. Signature detection for javafx currently
|
||||
AbstractFile file = node.getLookup().lookup(AbstractFile.class);
|
||||
try {
|
||||
ArrayList<BlackboardAttribute> genInfoAttributes = file.getGenInfoAttributes(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FILE_TYPE_SIG);
|
||||
if (genInfoAttributes.isEmpty() == false) {
|
||||
for (BlackboardAttribute batt : genInfoAttributes) {
|
||||
if (mimeTypes.contains(batt.getValueString())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.corecomponents;
|
||||
import java.awt.Dimension;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.logging.Level;
|
||||
@ -82,6 +83,8 @@ import org.sleuthkit.autopsy.core.Installer;
|
||||
public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
|
||||
private static final String[] EXTENSIONS = new String[]{".mov", ".m4v", ".flv", ".mp4", ".mpg", ".mpeg"};
|
||||
static private final List<String> supportedMimes = Arrays.asList("audio/x-aiff", "video/x-javafx", "video/x-flv", "application/vnd.apple.mpegurl", " audio/mpegurl", "audio/mpeg", "video/mp4","audio/x-m4a","video/x-m4v","audio/x-wav");
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName());
|
||||
private boolean fxInited = false;
|
||||
// FX Components
|
||||
@ -467,6 +470,7 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
case READY:
|
||||
case PAUSED:
|
||||
case STOPPED:
|
||||
case UNKNOWN:
|
||||
mediaPlayer.play();
|
||||
break;
|
||||
default:
|
||||
@ -798,4 +802,9 @@ public class FXVideoPanel extends MediaViewVideoPanel {
|
||||
public String[] getExtensions() {
|
||||
return EXTENSIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMimeTypes(){
|
||||
return supportedMimes;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -88,7 +89,7 @@ public class GstVideoPanel extends MediaViewVideoPanel {
|
||||
private final Object playbinLock = new Object(); // lock for synchronization of gstPlaybin2 player
|
||||
private AbstractFile currentFile;
|
||||
private Set<String> badVideoFiles = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
static private final List<String> supportedMimes = Arrays.asList();
|
||||
/**
|
||||
* Creates new form MediaViewVideoPanel
|
||||
*/
|
||||
@ -802,4 +803,9 @@ public class GstVideoPanel extends MediaViewVideoPanel {
|
||||
public String[] getExtensions() {
|
||||
return EXTENSIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMimeTypes(){
|
||||
return supportedMimes;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.corecomponents;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JPanel;
|
||||
@ -108,4 +109,8 @@ public abstract class MediaViewVideoPanel extends JPanel implements FrameCapture
|
||||
* Return the extensions supported by this video panel.
|
||||
*/
|
||||
abstract public String[] getExtensions();
|
||||
/**
|
||||
* Return the extensions supported by this video panel.
|
||||
*/
|
||||
abstract public List<String> getMimeTypes();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user