add hardened firefox, offline mode to menu

This commit is contained in:
idk
2022-05-11 18:59:34 -04:00
parent 0b94e6f87a
commit 63b7289605
9 changed files with 65 additions and 3 deletions

View File

@ -175,6 +175,8 @@ most of the improvements on Tor Browser Launcher also apply to TB-Updater, the
<a href="https://www.flaticon.com/free-icons/garlic" title="garlic icons">Garlic icons created by Icongeek26 - Flaticon</a>
<a href="https://www.flaticon.com/free-icons/onion" title="onion icons">Onion icons created by Freepik - Flaticon</a>
<a href="https://www.flaticon.com/free-icons/search" title="search icons">Search icons created by Freepik - Flaticon</a>
<a href="https://www.flaticon.com/free-icons/offline" title="offline icons">Offline icons created by Flat Icons - Flaticon</a>
### More Screenshots:

View File

@ -35,6 +35,8 @@ TODO: A "Default" config file which uses hardened Tor Browser for clearnet
//go:embed tor-browser/NOT-TPO-signing-key.pub
//go:embed garliconion.png
//go:embed onion.png
//go:embed www.png
//go:embed offline.png
//go:embed torbrowser.desktop
//go:embed i2ptorbrowser.desktop
var content embed.FS

BIN
offline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -106,6 +106,18 @@ func (m *Client) servePNG(rw http.ResponseWriter, rq *http.Request) {
return
}
}
if strings.HasSuffix(rq.URL.Path, "www.png") {
if bytes, err := m.TBD.Profile.ReadFile("www.png"); err == nil {
rw.Write(bytes)
return
}
}
if strings.HasSuffix(rq.URL.Path, "offline.png") {
if bytes, err := m.TBD.Profile.ReadFile("offline.png"); err == nil {
rw.Write(bytes)
return
}
}
return
}
rw.Header().Set("Content-Type", "image/png")

View File

@ -188,6 +188,14 @@ func (m *Client) ServeHTTP(rw http.ResponseWriter, rq *http.Request) {
log.Println("Starting I2P Browser")
go m.TBS.RunI2PBWithLang()
http.Redirect(rw, rq, "/", http.StatusFound)
case "/launch-firefox-browser":
log.Println("Starting Hardened Firefox Browser")
go m.TBS.RunTBBWithOfflineClearnetProfile("i2p.firefox", false, true)
http.Redirect(rw, rq, "/", http.StatusFound)
case "/launch-offline-browser":
log.Println("Starting Hardened Firefox Browser in offline mode")
go m.TBS.RunTBBWithOfflineClearnetProfile("i2p.firefox.offline", true, true)
http.Redirect(rw, rq, "/", http.StatusFound)
case "/start-tor":
log.Println("Starting Tor")
go m.TBS.RunTorWithLang()

View File

@ -18,6 +18,8 @@ configuration.
- [![Launch I2P in Tor Browser](garliconion.png) - Launch I2P in Tor Browser](/launch-i2p-browser)
- [![Launch Tor Browser](onion.png) - Launch Tor Browser](/launch-tor-browser)
- [![Launch Hardened Clearnet Browser](www.png) - Launch Hardened Clearnet Browser](/launch-firefox-browser)
- [![Launch Offline Browser](offline.png) - Launch Offline Browser](/launch-offline-browser)
## Tor Controls

View File

@ -65,6 +65,20 @@ user_pref("network.IDN_show_punycode", true);
user_pref("privacy.prioritizeonions.showNotification", false);
`)
var offlinebrowserjs = append(secbrowserjs, []byte(`
//set the proxy to 127.0.0.1:1, which will fail all requests
user_pref("network.proxy.type", 1);
user_pref("network.proxy.http", "127.0.0.1");
user_pref("network.proxy.http_port", 1);
user_pref("network.proxy.ssl", "127.0.0.1");
user_pref("network.proxy.ssl_port", 1);
user_pref("network.proxy.ftp", "127.0.0.1");
user_pref("network.proxy.ftp_port", 1);
user_pref("network.proxy.socks", "127.0.0.1");
user_pref("network.proxy.socks_port", 1);
user_pref("network.proxy.share_proxy_settings", true);
`)...)
var secbrowserhtml = []byte(`
<!DOCTYPE html>
<html>

View File

@ -355,6 +355,26 @@ func (s *Supervisor) RunI2PBAppWithLang() error {
return s.RunTBBWithOfflineClearnetProfile(s.I2PAppDataPath(), true, false)
}
func (s *Supervisor) generateOfflineProfile(profiledata string) error {
apath, err := filepath.Abs(profiledata)
if err != nil {
return err
}
if !tbget.FileExists(filepath.Join(apath, "user.js")) {
err := ioutil.WriteFile(filepath.Join(apath, "user.js"), offlinebrowserjs, 0644)
if err != nil {
return err
}
}
if !tbget.FileExists(filepath.Join(apath, "pref.js")) {
err := ioutil.WriteFile(filepath.Join(apath, "pref.js"), offlinebrowserjs, 0644)
if err != nil {
return err
}
}
return nil
}
func (s *Supervisor) GenerateClearnetProfile(profiledata string) error {
apath, err := filepath.Abs(profiledata)
if err != nil {
@ -462,10 +482,12 @@ func (s *Supervisor) RunTBBWithOfflineClearnetProfile(profiledata string, offlin
log.Println("Error copying AWO XPI", err)
return err
}
if err := s.generateOfflineProfile(profiledata); err != nil {
log.Println("Error generating Offline Profile", err)
return err
}
if !strings.Contains(filepath.Base(profiledata), "i2p") {
defaultpage = profiledata + "/index.html"
} else {
defaultpage = "http://127.0.0.1:7657/home"
}
}
if len(s.PTAS()) > 0 {

BIN
www.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB