mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Readded browser control class back.
This commit is contained in:
parent
34c3e35351
commit
224bbf13f9
50
Report/src/org/sleuthkit/autopsy/report/BrowserControl.java
Normal file
50
Report/src/org/sleuthkit/autopsy/report/BrowserControl.java
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alex
|
||||
*/
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class BrowserControl{
|
||||
/**
|
||||
* Method to Open the Browser with Given URL
|
||||
* @param url
|
||||
*/
|
||||
public static void openUrl(String url){
|
||||
String os = System.getProperty("os.name");
|
||||
Runtime runtime=Runtime.getRuntime();
|
||||
try{
|
||||
// Block for Windows Platform
|
||||
if (os.startsWith("Windows")){
|
||||
String cmd = "rundll32 url.dll,FileProtocolHandler "+ url;
|
||||
Process p = runtime.exec(cmd);
|
||||
}
|
||||
//Block for Mac OS
|
||||
else if(os.startsWith("Mac OS")){
|
||||
Class fileMgr = Class.forName("com.apple.eio.FileManager");
|
||||
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class});
|
||||
openURL.invoke(null, new Object[] {url});
|
||||
}
|
||||
//Block for UNIX Platform
|
||||
else {
|
||||
String[] browsers = {"firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape" };
|
||||
String browser = null;
|
||||
for (int count = 0; count < browsers.length && browser == null; count++)
|
||||
if (runtime.exec(new String[] {"which", browsers[count]}).waitFor() == 0)
|
||||
browser = browsers[count];
|
||||
if (browser == null)
|
||||
throw new Exception("Could not find web browser");
|
||||
else
|
||||
runtime.exec(new String[] {browser, url});
|
||||
}
|
||||
}catch(Exception x){
|
||||
System.err.println("Exception occurd while invoking Browser!");
|
||||
x.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -95,7 +95,7 @@ public class reportPanelAction {
|
||||
public void run()
|
||||
{
|
||||
reportHTML htmlReport = new reportHTML(Results,rr);
|
||||
|
||||
BrowserControl.openUrl(reportHTML.htmlPath);
|
||||
}
|
||||
});
|
||||
Thread xlsthread = new Thread(new Runnable()
|
||||
@ -104,7 +104,7 @@ public class reportPanelAction {
|
||||
public void run()
|
||||
{
|
||||
reportXLS xlsReport = new reportXLS(Results,rr);
|
||||
// BrowserControl.openUrl(xlsReport.xlsPath);
|
||||
//
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user