Skip to content

Commit 885e69b

Browse files
committed
Add guide for setting up Tor if not configured properly
1 parent 8339d7f commit 885e69b

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

ProxAllium.au3

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,75 @@ Func Core_InitConnectionToController($iPort)
632632
Return True
633633
EndFunc
634634

635+
Func Core_SetupTor()
636+
Local $iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg
637+
$iMsgBoxFlags = $MB_ICONINFORMATION + $MB_YESNO
638+
$sMsgBoxTitle = "Setup Tor"
639+
$sMsgBoxMsg = "It looks Tor is not configured properly in ProxAllium yet, most likely this is your first run. Do not worry, ProxAllium can guide you through the process!" & @CRLF
640+
$sMsgBoxMsg &= @CRLF & "Do you want to continue with the setup process?"
641+
If MsgBox($iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg) = $IDNO Then Return False
642+
643+
Local $bUseTB = False
644+
$iMsgBoxFlags = $MB_ICONQUESTION + $MB_YESNO
645+
$sMsgBoxMsg = "Do you have Tor Browser installed?"
646+
If MsgBox($iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg) = $IDYES Then
647+
$bUseTB = True
648+
Else
649+
$iMsgBoxFlags = $MB_ICONQUESTION + $MB_YESNO
650+
$sMsgBoxMsg = "It is also possible to just use Tor, but I recommend installing the Tor Browser as it automatically updates your copy of Tor when you update the browser and it also adds support for bridges." & @CRLF
651+
$sMsgBoxMsg &= @CRLF & 'Do you want to install Tor Browser and use Tor from it? Choose "No" to continue with only Tor.'
652+
$bUseTB = MsgBox($iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg) = $IDYES
653+
If $bUseTB Then MsgBox($MB_ICONINFORMATION, $sMsgBoxTitle, "Please download and install the latest version of Tor Browser and click OK to continue.")
654+
EndIf
655+
656+
Local $sTorFolder, $bFoundTor = False
657+
If $bUseTB Then
658+
Do
659+
$sTorFolder = FileSelectFolder("Please select the folder containing Tor Browser", "", 0, @DesktopDir & '\Tor Browser')
660+
If @error Then Return False
661+
$sTorFolder = $sTorFolder & '\Browser\TorBrowser\Tor'
662+
If FileExists($sTorFolder & '\tor.exe') Then
663+
$bFoundTor = True
664+
EndIf
665+
If Not $bFoundTor Then MsgBox($MB_ICONERROR, "Tor not found", 'Cannot find tor.exe in this folder, please try again and make sure you have selected the installation directory (and not the "Browser" folder inside it).')
666+
Until $bFoundTor
667+
Else
668+
$iMsgBoxFlags = $MB_ICONQUESTION + $MB_YESNO
669+
$sMsgBoxMsg = 'Do you want to download Tor? If you already have a copy of Tor in your computer, then choose "No".'
670+
If MsgBox($iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg) = $IDYES Then
671+
$iMsgBoxFlags = $MB_ICONINFORMATION
672+
$sMsgBoxMsg = 'The URL (https://www.torproject.org/download/tor) for the page which contains the link to download the "Tor Expert Bundle" has been copied to your clipboard.' & @CRLF
673+
$sMsgBoxMsg &= @CRLF & "Please download it and extract the files to a permanent location (a sub-folder in ProxAllium's folder should be perfect), Click OK when you are done."
674+
ClipPut('https://www.torproject.org/download/tor')
675+
MsgBox($iMsgBoxFlags, $sMsgBoxTitle, $sMsgBoxMsg)
676+
EndIf
677+
Do
678+
$sTorFolder = FileSelectFolder("Please select the folder containing Tor", "")
679+
If @error Then Return False
680+
If FileExists($sTorFolder & '\Tor\tor.exe') Then
681+
$sTorFolder = $sTorFolder & '\Tor'
682+
$bFoundTor = True
683+
ElseIf FileExists($sTorFolder & '\tor.exe') Then
684+
$bFoundTor = True
685+
EndIf
686+
If Not $bFoundTor Then MsgBox($MB_ICONERROR, "Tor not found", "Cannot find tor.exe in this folder, please make sure you have selected the right folder and try again.")
687+
Until $bFoundTor
688+
EndIf
689+
690+
If $bFoundTor Then
691+
$g_sTorPath = $sTorFolder & '\tor.exe'
692+
IniWrite($CONFIG_INI, "tor", "path", $g_sTorPath)
693+
If $bUseTB Then
694+
Local $sObfs4 = $sTorFolder & '\PluggableTransports\obfs4proxy.exe'
695+
If FileExists($sObfs4) Then
696+
$g_sObfs4Path = $sObfs4
697+
IniWrite($CONFIG_INI, "tor", "obfs4_path", $g_sObfs4Path)
698+
EndIf
699+
EndIf
700+
EndIf
701+
Return $bFoundTor
702+
EndFunc
703+
635704
Func IsTorRunning()
636705
Return ProcessExists($g_aTorProcess[$TOR_PROCESS_PID]) <> 0
637706
EndFunc
@@ -660,7 +729,10 @@ Func Tor_Initialize()
660729
Switch $iError
661730
Case $TOR_ERROR_GENERIC
662731
GUI_LogOut("Cannot find Tor!")
663-
732+
If Core_SetupTor() Then
733+
Local $vReturn = Tor_Initialize()
734+
Return SetError(@error, 0, $vReturn)
735+
EndIf
664736
Case $TOR_ERROR_VERSION
665737
GUI_LogOut("Unable to identify Tor's version!")
666738
EndSwitch

0 commit comments

Comments
 (0)