Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

targetSdkVersion 29 permission denied #153

Open
pingothedoer opened this issue Sep 9, 2020 · 3 comments
Open

targetSdkVersion 29 permission denied #153

pingothedoer opened this issue Sep 9, 2020 · 3 comments

Comments

@pingothedoer
Copy link

pingothedoer commented Sep 9, 2020

Hi. Since November is the deadline for all the apps to start using targetSdkVersion 29, This library doesn't work. Here are the logs that i faced when i upgraded my sdk version.

W/System.err: java.io.IOException: Cannot run program "/data/user/0/<app-id>/app_torfiles/tor" (in directory "/data/user/0/<app-id>/app_torfiles"): error=13, Permission denied W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1050) W/System.err: at com.msopentech.thali.toronionproxy.OnionProxyManager.installAndStartTorOp(OnionProxyManager.java:366) W/System.err: at com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager.installAndStartTorOp(AndroidOnionProxyManager.java:66) W/System.err: at com.msopentech.thali.toronionproxy.OnionProxyManager.startWithRepeat(OnionProxyManager.java:106) W/System.err: at <app-id>.shared.tor.TorProxyService.onHandleIntent(TorProxyService.kt:24) W/System.err: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) W/System.err: at android.os.Looper.loop(Looper.java:214) W/System.err: at android.os.HandlerThread.run(HandlerThread.java:67) W/System.err: Caused by: java.io.IOException: error=13, Permission denied W/System.err: at java.lang.UNIXProcess.forkAndExec(Native Method) W/System.err: at java.lang.UNIXProcess.<init>(UNIXProcess.java:133) W/System.err: at java.lang.ProcessImpl.start(ProcessImpl.java:141) W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) W/System.err: ... 8 more

And here is my implementation for TorProxyService

package mypackage.shared.tor

import android.app.IntentService
import android.content.Intent
import com.msopentech.thali.android.toronionproxy.AndroidOnionProxyManager
import com.msopentech.thali.toronionproxy.OnionProxyManager
import mypackage.ObserverUtils
import mypackage.shared.utils.Logger

class TorProxyService : IntentService("TorProxyIntentService") {

    override fun onHandleIntent(p0: Intent?) {

        return try {

            ObserverUtils.torObserver.post(TorStatus.CONNECTING)

            Logger.showDebugLog(TorConstants.TAG, "Starting TOR \uD83D\uDEA7 \uD83D\uDEA7 \uD83D\uDEA7 \uD83D\uDEA7")

            val fileStorageLocation = "torfiles"
            val proxyManager: OnionProxyManager = AndroidOnionProxyManager(applicationContext, fileStorageLocation)
            val totalSecondsPerTorStartup = 4 * 60
            val totalTriesPerTorStartup = 5
            val torStarted = proxyManager.startWithRepeat(totalSecondsPerTorStartup, totalTriesPerTorStartup)

            if (!torStarted) {

                Logger.showDebugLog(TorConstants.TAG, "Couldn't start TOR ❌❌❌❌")
                ObserverUtils.torObserver.post(TorStatus.DISCONNECTED)

            } else {

                while (!proxyManager.isRunning) {
                    Thread.sleep(90)
                }

                TorConstants.TOR_SOCK_PORT = proxyManager.iPv4LocalHostSocksPort
                Logger.showDebugLog(TorConstants.TAG, "TOR Started ✅✅✅✅")
                ObserverUtils.torObserver.post(TorStatus.CONNECTED)

            }
        } catch (e: Exception) {
            e.printStackTrace()
            Logger.showDebugLog(TorConstants.TAG, "Couldn't start TOR ❌❌❌❌")
            ObserverUtils.torObserver.post(TorStatus.DISCONNECTED)
        }

    }

}

@05nelsonm
Copy link

Executable files are no longer supported for API 29+ from data/data and the shared native libs must be extracted to the native Dir.

https://github.com/05nelsonm/TOPL-Android-TorBinary

@pingothedoer
Copy link
Author

@05nelsonm Thanks, Will the implementation of TOR be same? Just need to replace the dependencies ???

@Suryah07
Copy link

So is there any way to make this library work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants