brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.7k stars 2.31k forks source link

Start brave in incognito+TOR mode using command line #2105

Closed edouard-lopez closed 3 years ago

edouard-lopez commented 5 years ago

Description

related: #690, #1457

Starting Brave in incognito mode via command is possible with the --incognito flag. However there is no such flag for the Tor feature.

Steps to Reproduce

To enable Tor you have to:

  1. Start brave manually or by CLI brave-browser --incognito (here in incognito mode) ;
  2. Hit Alt+Shift+N (Linux user) ;
  3. Close previous window.

Actual result:

Works

Expected result:

Open directly via a flag, e.g.:

 brave-browser --incognito --tor

Reproduces how often:

Every time

Brave version (brave://version info)

 Version 0.56.12 Chromium: 70.0.3538.77 (Official Build) (64-bit)
jackcaron commented 5 years ago

Yes please!!!

Not sure if the right issue also, but when installed on Ubuntu, you can lock Brave in the launcher. And with a right click, having option for the incognito and incognito+tor would also be great.

jtbrown3 commented 5 years ago

Thanks for mentioning this @jackcaron - In Windows 10, this context feature of 'right-clicking' from the TaskBar or Start Menu also exists. It would be a GREAT if Brave could also add the "New Incognito+Tor Window" selection to these special context menus. This could be an extension of the command-line option being requested here...

Brave-Matt commented 5 years ago

Just had a user on Reddit confirm that a way to do this in Windows (tested and works on my end): https://www.reddit.com/r/brave_browser/comments/a7aflb/how_to_launch_brave_browser_in_incognito_mode_by/ Method:

  1. Right-click on Brave Shortcut --> Properties
  2. In Target path, enter [space]--incognito after quotations
  3. Click Apply/OK
  4. Brave shortcut launches with Private Window Note: the [space] refers the actual space character - command throws invalid path error without the space between the last " and --incognito
ghost commented 5 years ago

Yes, please, add the command line to open brave tor window. That's a real need for us.

manit-shah commented 5 years ago

+1 for adding CLI command to open Brave tor window (start Brave --tor perhaps?) +1 for adding New private window with Tor option to Windows 10 special context menus

Additional (related) request: Allow the user to specify the default new window type (normal window, private window, or private window with Tor). So that a user may choose for Brave to always open to a private window with Tor. This would be an outstanding addition (which even Chrome does not have).

Brave-Matt commented 5 years ago

+1 from reddit: https://www.reddit.com/r/brave_browser/comments/ck9z3v/command_line_option_to_launch_new_private_browser/

Brave-Matt commented 5 years ago

+1 https://www.reddit.com/r/brave_browser/comments/csao5r/open_brave_with_tor_by_default_via_shortcut/

apenasrr commented 4 years ago

+1 from Reddit: https://www.reddit.com/r/brave_browser/comments/e6pk3i/windows_run_command_to_open_link_in_private/

WhatDothLife commented 4 years ago

Can't wait for this to be implemented.

ghost commented 4 years ago

+1 bump

RuthlessRuler commented 4 years ago

+1 Bump.

cybardev commented 4 years ago

It's been 2 years already... Please implement it soon. It'd be a killer feature. Also, please add it to the context menu (.desktop file on Linux) so we get a "New Incognito Window with Tor" option on right-clicking the shortcut.

contre95 commented 4 years ago

It would be a great feature, yes !

contre95 commented 4 years ago

how f*cking long this will take? Do hear me? just parse a new cli argument and trigger incognito+tor mode just like incognito.

Calm down dude !

dbjordan1 commented 4 years ago

how f*cking long this will take? Do hear me? just parse a new cli argument and trigger incognito+tor mode just like incognito.

Yup, should be pretty simple. Good thing it's open source, we'll keep an eye out for the pull request.

woswos commented 4 years ago

If anyone needs this feature for automation (for example, using Brave Incognito+Tor mode in selenium), try using xdotool windowactivate --sync <Brave's_ window_id> key alt+shift+n to send the shortcut to the browser instead. Later, you can use driver.switch_to.window() to switch to the Incognito+Tor window and keep running your tests.

If you already thought about using selenium's sendKeys() to open the Incognito+Tor mode, that doesn't work because apparently "keys get sent directly to the render process, bypassing the browser process. So, any keyboard shortcut handlers in the browser process will not be invoked by sendKeys()."

Of course, I would prefer to use brave-browser --incognito --tor, but it doesn't exist yet :(

russeg commented 3 years ago

Since it's been 2 years, I'm assuming this is a very very hard problem. Is there an unsurmountable technical reason why It has not been implemented? It seems it's not as simple as parsing --tor or whatever and launching a new browser window, like some people suggested? Am I wrong about this?

dbjordan1 commented 3 years ago

I believe this is the hardest problem the team has ever encountered.

Doug Jordan

On Fri, Nov 6, 2020 at 8:29 PM russeg notifications@github.com wrote:

Since it's been 2 years, I'm assuming this is a very very hard problem. Is there an unsurmountable technical reason why It has not been implemented? It seems it's not as simple as parsing --tor or whatever and launching a new browser window, like some people suggested? Am I wrong about this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/brave/brave-browser/issues/2105#issuecomment-723376953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXTPXIU5V2ZJDL4FFJRDI3SOSWJ5ANCNFSM4GDHBVGA .

141 commented 3 years ago

It seems impossible for them as Tor is not part of the browser itself, but a built-in extension. If they can merge Tor in, then it would be simple.

xmha97 commented 3 years ago

You can use:

brave onion
vk4s commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

austinwk commented 3 years ago

You can use:

brave onion

Thanks for the tip! For some users, like myself, it may be brave-browser onion. I'm on Kubuntu and used the official apt install instructions (not snap).

jtbrown3 commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

@vikaspatelp83, This works partially, but on my system, Brave also tries to load a new "onion/" page in a new tab and fails with "This site can't be reached" error.

Is there a more specific syntax that can be used so the failed new tab doesn't open?

darkwiz666 commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

@vikaspatelp83, This works partially, but on my system, Brave also tries to load a new "onion/" page in a new tab and fails with "This site can't be reached" error.

Is there a more specific syntax that can be used so the failed new tab doesn't open?

I'm bumping this because of all the crap that's been suggested this is the one thing that is nearly working on Windows. adding "--" does nothing but open a normal window (and a single dash does nothing, obviously)

anonymous-ne0 commented 3 years ago

As of now, I just use:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "brave"
WshShell.SendKeys "+%{n}"

as a .vbs file, which is executed by the batch file (after the brave window is opened) 😐

anonymous-ne0 commented 3 years ago

As of now, I just use:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate "brave"
WshShell.SendKeys "+%{n}"

as a .vbs file, which is executed by the batch file (after the brave window is opened) 😐

The batch file is:

start brave --incognito
timeout 2
wscript [path/filename of vbs file].vbs

The timeout of 2s is for the window to load (might be more/less for you)

vk4s commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

@vikaspatelp83, This works partially, but on my system, Brave also tries to load a new "onion/" page in a new tab and fails with "This site can't be reached" error.

Is there a more specific syntax that can be used so the failed new tab doesn't open?

After getting the brave widow, just open a new tab and search anything this new window is opened in tor browser mode.

darkwiz666 commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

@vikaspatelp83, This works partially, but on my system, Brave also tries to load a new "onion/" page in a new tab and fails with "This site can't be reached" error. Is there a more specific syntax that can be used so the failed new tab doesn't open?

After getting the brave widow, just open a new tab and search anything this new window is opened in tor browser mode.

That's not what is being asked: we're trying to do this WITHOUT the GUI. External programs can't invoke the Tor-mode browser (properly), even though there is a flag to do so.

vk4s commented 3 years ago

Create a shortcut with the target: "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" onion it will fire brave tor.

@vikaspatelp83, This works partially, but on my system, Brave also tries to load a new "onion/" page in a new tab and fails with "This site can't be reached" error. Is there a more specific syntax that can be used so the failed new tab doesn't open?

After getting the brave widow, just open a new tab and search anything this new window is opened in tor browser mode.

That's not what is being asked: we're trying to do this WITHOUT the GUI. External programs can't invoke the Tor-mode browser (properly), even though there is a flag to do so.

Yes that's right.

DavidFromNL commented 3 years ago

You can use:

brave onion

Thanks for the tip! For some users, like myself, it may be brave-browser onion. I'm on Kubuntu and used the official apt install instructions (not snap).

Running "brave-browser onion" on my Brave 1.19.88 / Fedora 33 / x86_64 system gets my a hanging browser, followed by a segmentation fault every time. Also, opening https://3g2upl4pq6kufc4m.onion/ (Duckduckgo) from the command line does the same, no matter if brave was already running or not. Opening Duck by typing said address in an already-running brave browser is no problem at all.

Fablo020 commented 3 years ago

I got the /Onion can't be reached error too. After enabling "Automatically redirect .onion sites" in settings, it is working now. But a native solution like -onion start parameter would be way better IMO. Thank for updating Tor anyways finally I can skip the captchas and block elements using uBlock. Just FYI I used: "brave.exe onion" - I tested it with any Site like "brave.exe 3g2upl4pq6kufc4m.onion" It opens 2 tabs in Tor one "onion/" and another with the Link, in this case: https://3g2upl4pq6kufc4m.onion/.

Brave-Matt commented 3 years ago

+1 Community: https://community.brave.com/t/setting-private-or-private-with-tor-as-default-tab-types/235252/5 @rebron this issue has been around for some time -- is there any way we can get someone to take a stab at this or is it blocked by something?

xanoni commented 3 years ago

Related question, is there some flag (brave://flags) that forces Brave to always use Tor mode?

jdnixx commented 3 years ago

After enabling "Automatically redirect .onion sites" in settings, it is working now. But a native solution like -onion start parameter would be way better IMO.

Hey thanks, this is a good workaround. Look forward to a real CLI option though glad to see this just recently got (officially) put on the radar

bridiver commented 3 years ago

I think we need some more detail here for Actual result. What should happen if there is a previously saved profile that would normally be restored on startup? I think this should be a separate profile or maybe even a separate user data dir so it doesn't cause any problems there, but we need to outline these scenarios for QA and browser tests.

bridiver commented 3 years ago

it's possible that --incognito already handles ^^ but we still need to explain what the expected behavior is for those cases

NullHypothesis commented 3 years ago

This feature was implemented in https://github.com/brave/brave-core/pull/9533. It makes it possible to start Brave in Tor mode by running:

brave-browser --tor

Note that if the --tor switch is used together with --silent-launch, Tor won't be launched.

rebron commented 3 years ago

Closing. Fixed per comment above.

xmha97 commented 3 years ago

brave-browser --tor

This command doesn't work on the stable version. image Please help me or reopen this issue.

stephendonner commented 3 years ago

Verified PASSED using the testplan from https://github.com/brave/brave-core/pull/9533 with

Brave 1.29.48 Chromium: 92.0.4515.131 (Official Build) nightly (x86_64)
Revision 6b8d6c56ce21e38a72f7c4becb5abc1fa5134f29-refs/branch-heads/4515@{#1933}
OS macOS Version 11.5.1 (Build 20G80)

Steps:

Test 1 1. Open a website in browser window 1 (`abc.com`) and another website in browser window 2 (`bbc.com`) 2. Quit Brave and launch it with `--tor` command line flag 3. Open a normal window by pressing Ctrl + n or by clicking on Menu -> New window 4. Windows from step 1 should be restored Confirmed `abc.com` and `bbc.com` reopened Screen Shot 2021-08-03 at 3 52 53 PM
Test 2 1. Open a website in browser window 1 (`abc.com`) and another website in browser window 2 (`bbc.com`) 2. Quit Brave and launch it with `--tor` command line flag 3. Quit Brave 4. Launch Brave without `--tor` 5. Windows from step 1 should be restored Confirmed `abc.com` and `bbc.com` reopened Screen Shot 2021-08-03 at 3 50 28 PM
Test 3 1. Open a website in browser window 1 (`abc.com`) and another website in browser window 2 (`bcc.com`) 2. Crash browser using `chrome://inducebrowsercrashforrealz/` 3. Launch Brave with `--tor` 4. Open a normal window by pressing Ctrl + n or by clicking on Menu -> New window 5. Windows from step 1 should be restored Confirmed `abc.com` and `bbc.com` reopened example | example ---------|--------- Screen Shot 2021-08-03 at 3 43 45 PM | Screen Shot 2021-08-03 at 3 52 53 PM
Test 4 1. Open a website in browser window 1 (`abc.com`) and another website in browser window 2 (`bbc.com`) 2. Crash browser using `chrome://inducebrowsercrashforrealz/` 3. Launch Brave with `--tor` 4. Quit Brave 5. Launch Brave without `--tor` 6. Windows from step 1 should be restored Confirmed `abc.com` and `bbc.com` reopened Screen Shot 2021-08-03 at 3 54 15 PM
Test 5 1. Launch Brave with `--tor` 2. Visit `https://check.torproject.org/api/ip` 3. Make sure that the page contains the string `"IsTor":true`. Confirmed I saw `{"IsTor":true,"IP":"185.220.102.249"}` Screen Shot 2021-08-03 at 3 45 52 PM

Verification passed on

Brave 1.29.60 Chromium: 92.0.4515.131 (Official Build) beta (64-bit)
Revision 6b8d6c56ce21e38a72f7c4becb5abc1fa5134f29-refs/branch-heads/4515@{#1933}
OS Ubuntu 18.04 LTS

Verified test plan from https://github.com/brave/brave-core/pull/9533

Test 1 ![image](https://user-images.githubusercontent.com/34715963/129814495-91d34083-5a5a-4cd9-80e3-b1eb551781ab.png) ![image](https://user-images.githubusercontent.com/34715963/129814516-54348e6a-3479-4aeb-be15-0fbd84d0c64e.png)
Test 2 ![image](https://user-images.githubusercontent.com/34715963/129814695-7d9d684f-ea07-468d-a95c-aaa5502fa6b5.png) ![image](https://user-images.githubusercontent.com/34715963/129814710-a5e04e13-9446-43d6-ba5c-12a92c2186e7.png)
Test 3 ![image](https://user-images.githubusercontent.com/34715963/129814895-3e917aaf-49ff-4615-b54b-7f8b514e82f6.png) ![image](https://user-images.githubusercontent.com/34715963/129814929-3294e47d-6db0-4ee9-bc8b-85233b3905c9.png)
Test 4 ![image](https://user-images.githubusercontent.com/34715963/129815059-abf221c7-eefd-4349-8732-45f061690c8a.png) ![image](https://user-images.githubusercontent.com/34715963/129815093-e26b383a-ee89-4752-a810-19840109bd95.png)
Test 5 ![image](https://user-images.githubusercontent.com/34715963/129815294-8f900027-51de-46d4-aa2f-6d8e645ca553.png)

Verification passed on

Brave | 1.29.74 Chromium: 93.0.4577.58 (Official Build) (64-bit)
-- | --
Revision | c4410ece044414ea42fa4ba328d08195e818a99c-refs/branch-heads/4577@{#1076}
OS | Windows 10 OS Version 2009 (Build 19043.1165)
Test 1 Confirmed cnn.com and nytimes.com reopened ![image](https://user-images.githubusercontent.com/38657976/131325464-3995e6a4-b23b-4a9d-998f-77fdfd572837.png)
Test 2 Confirmed twitter.com and buzzfeed.com reopened ![image](https://user-images.githubusercontent.com/38657976/131325921-12841d07-59e1-401f-bb7b-d0d6940f2cf8.png)
Test 3 Confirmed `theverge.com` and `orimi.com` reopened ![image](https://user-images.githubusercontent.com/38657976/131326341-6e7acaff-eea5-40a8-8e75-44f1e1c8d4f7.png) ![image](https://user-images.githubusercontent.com/38657976/131326472-5c82d419-fa74-410f-bac7-e80511c9149f.png)
Test 4 Confirmed `gmail.com` and `indiatimes.com` reopened ![image](https://user-images.githubusercontent.com/38657976/131326842-842641d1-3d03-424a-adfb-c5a4dfdde4a7.png)
Test 5 ![image](https://user-images.githubusercontent.com/38657976/131327124-c1df43ce-58ff-4af7-b8c6-aadb8be64362.png)
stephendonner commented 3 years ago

brave-browser --tor

This command doesn't work on the stable version. image Please help me or reopen this issue.

hi @xmha97 - this does work in 1.29.48 and newer nightly builds, and will be in the August 31st release (https://github.com/brave/brave-browser/wiki/Brave-Release-Schedule), if not sooner (if we take the change and uplift/back-port to 1.28.x branch).

gnfpt commented 1 year ago

Brave doesn't start in tor mode when app mode is also used.

ie: brave --tor --app="https://whatismyipaddress.com/"

~/gnf.pt