question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[rust] Better handling for gnirehtet.apk path

See original GitHub issue

Currently it’d just execute adb install -r gnirehtet.apk in whatever dir user was.

Not only is that insecure, that also makes it impossible to be run from any location except same dir, and makes distribution impossible.

So, I have two suggestions:

  • chdir to gnirehtet file location before running any commands
  • provide a way to override the path (via environment variable for example)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
JuanPotatocommented, Mar 16, 2018
fn chdir_to_executable_dirname() -> bool {
    env::current_exe()
        .and_then(|exe| fs::canonicalize(exe.as_path()))
        .ok()
        .map_or(false, |real_exe| {
            real_exe
                .as_path()
                .parent()
                .map_or(false, |real_dir| env::set_current_dir(real_dir).is_ok())
        })
}

I’m sorry, I like chaining things.

1reaction
rom1vcommented, Aug 16, 2020

@SalvatoreT I just published a new release v1.5 with this change and the fix for #273.

Sorry for the delay. (I work on gnirehtet and scrcpy on my free time, and scrcpy has higher priority.)

I wanted to change other things in gnirehtet before the release (like automatically close gnirehtet on the device on disconnection, unless an option is passed), but I had no time to work on it, so I just published the current dev branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - [rust] Better handling for gnirehtet.apk path -
Currently it'd just execute adb install -r gnirehtet.apk in whatever dir user was. Not only is that insecure, that also makes it impossible...
Read more >
Gnirehtet 2: our reverse tethering tool for Android now ...
To get rid of the shell scripts, the command-line parsing is now directly handled by the application (both the Java and the Rust...
Read more >
gnirehtet-bin - SlackBuilds.org
gnirehtet is a tool that provides reverse tethering for Android This is a repackage of the 64 bit binary supplied by upstream, the...
Read more >
XiaomiADBFastbootTools vs gnirehtet - compare differences ...
Compare XiaomiADBFastbootTools vs gnirehtet and see what are their differences. ... A simple tool for managing Xiaomi devices on desktop using ADB and ......
Read more >
Reverse USB tethering in 2022? - Super User
Yes!, it's possible, there a program called gnirehtet which allows you to give internet access to you android smartphone via USB as if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found