yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] dd043:
Very nice project, I'll after cleaning up my old dropbear this weekend!

I have a few questions:

Does the reverse tunnel set any kind of wakelocks? Or alarms? Or does it rely solely on Android's own network scheduler? Will it reconnect automatically?

How does the wakelock for the sshd work? Is it a full/partial wakelock set on client connect and removed when the client disconnects? Does it work with sftp too?

Thanks!
[Android Software/Hacking General [Developers Only]] Geofferey:
Friendly reminder:

PLEASE DIRECT QUESTIONS TO Q&A THREAD

The wake lock works by running a script that constantly checks if there is a connection established on port 22 using a while loop and some grep magic. When you disconnect the wakelock is toggled off. I don't know if it is full or partial but it keeps device from slowing to crawl when connected ;). I did some limited research to get it working.

#!/system/bin/sh

#Dropbear Wakelock Script by:
#Geofferey@XDA ©2015

. /system/etc/sshd.conf

sleep 10

while true; do
sleep 3
if netstat -a | grep 127.0.0.1:22 |grep ESTABLISHED >/dev/null; then
sleep 3
echo "dropbear_wakelock" > /sys/power/wake_lock
elif IP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" &&
netstat -a | grep $IP:22 |grep ESTABLISHED >/dev/null; then
sleep 3
echo "dropbear_wakelock" > /sys/power/wake_lock
elif netstat -a | grep 0.0.0.0:22 |grep LISTEN >/dev/null; then
sleep 3
echo "dropbear_wakelock" > /sys/power/wake_unlock
else
sleep 3
fi
done

it should work with the reverse ssh too and in my test it does

The reverse ssh tunnel uses a loop as well. Whenever the connection gets dropped it will try to re-establish automatically. I have had some minor issues with it but it gets the job done and keeps you connected minus a few rare net conditions... autossh would be better but I can't find a compiled binary for android. I'm working on that tho.

#!/system/xbin/bash

. /system/etc/sshd.conf

until ssh -N -g -T -K 180 -i "$KEYFILE" -R "$REVPORT":localhost:"$PORT" "$REMUSER"@"$REMSERV" -p "$REMSERVPORT" -y
do
sleep 1; ssh -T -i "$KEYFILE" "$REMUSER"@"$REMSERV" -p "$REMSERVPORT" -y ssh localhost -p "$REVPORT"
done
[Android Software/Hacking General [Developers Only]] brucem76:
Sorry for a silly question, where is the q & a thread?
[Android Software/Hacking General [Developers Only]] Geofferey:
Sorry for some reason I can't find the Q&A thread anymore.... There used to be a link at top of page. What's your question mate? I will answer it here. Also can you please remove the unnecessary quote from you last response to tidy things up. Thank you.
[Android Software/Hacking General [Developers Only]] NeoKbm:
Try on Note 3 Lollipop

I'll try the mod, because I just upgraded my Note 3 to lollipop and had a habit of running my mobile for sftp. Now with lollipop moment it is impossible root access. See if it works.

Thank You.

Edit: I just installed the mod and these are the results, suggestions and problems I found:

Results:

Full access to all folders.

Suggestions:

1.- Although after installing the mod appears "MUST RUN 'pdsshd-toolkit' in terminal after install" Maybe people do not read and in the tutorial you indicate that you have to run "pdsshd-config"

2.- (solution to a small error): When you will run "pdsshd-config" get the following error: "pdsshd-toolkit: Permission denied." This is because the binary file "bash" has the Execute permission. My suggestion is to add to the installation script something like "set_perm (0, 0, 0500," /system /xbin /bash ");" or change permissions manually.

Problems:

1.-The sftp access does not work (which is what I am most interested).

2.-init.d not work. This will cause the kernel of my Note 3 (Civato: http://xdaforums.com/galaxy-note-3/development/rom-civz-flexlollipop-rev1-2-aroma-t2987732)
[Android Software/Hacking General [Developers Only]] sub77:
1.) this is because sftp-server is not compiled with PIE support, just swap /etc/dropbear/data/br.com.bott.droidsshd/files/bin/sftp-server with my attached one.

2.) install SuperSU and move the init script to /system/su.d/10dropbear
[Android Software/Hacking General [Developers Only]] Geofferey:
Great find! Thanks for providing a sftp binary with PIE support. As you can see I'm not always actively updating this thread. I plan on releasing an update containing the necessary PIExecutables in near future but I can't find one for the dropbear ssh client aka dbclient. If anybody knows of a a client that was compiled with appropriate /support/flags please let me know or uploaded here.

I found a lil info on compiling with PIE support if anyone is interested. I might try it myself... MIGHT...

DISREGARD - Leaving for histroical purposes

If anybody is desperate to run PDSSHD (fully working) there is a way to bypass the requirement for PIEs by replacing /system/bin/linker with a modified one so this whole package will run on lollipop. Be weary though, you're sacrificing security for compatibility and replacing a file required by Android to properly boot. Some user have reported issues. Make a backup of /system/bin/linker first!

DISREGARD

Update:

I compiled a new working version of dbclient (first ver didn't have password access) with PIE support & attached it to this post. It will be included in the next release. PDSSHD is almost fully compatible with lollipop now ;) I just need a PIE binary for inadyn now.

Update 2:

I uploaded a new version of my mod v2.0.6. It should be fully compatible on lollipop and probably marshmallow with the exception of inadyn. I can't figure out how to compile for android yet without ./configure... :(
[Android Software/Hacking General [Developers Only]] sub77:
here it is, compiled without https support, so it should work with mm, too.

i used a qemu-arm chroot to compile inadyn. https://community.arm.com/groups/embedded/blog/2013/11/21/cross-compilation-for-arm

apt-get install qemu-user-static

mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc

echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register

wget http://releases.linaro.org/archive/13.12/ubuntu/panda/panda-saucy_developer_20131216-558.img.gz

gunzip panda-saucy_developer_20131216-558.img.gz

fdisk -l panda-saucy_developer_20131216-558.img

# Disk panda-raring_developer_20130922-471.img: 1073 MB, 1073741824 bytes, 2097152 sectors

# Units = sectors of 1 * 512 = 512 bytes

# Sector size (logical/physical): 512 bytes / 512 bytes

# I/O size (minimum/optimal): 512 bytes / 512 bytes

# Disk label type: dos

# Disk identifier: 0x00000000

#

# Device Boot Start End Blocks Id System

# panda-raring_developer_20130922-471.img1 * 63 106494 53216 c W95 FAT32 (LBA)

# panda-raring_developer_20130922-471.img2 106496 2097151 995328 83 Linux

# Now you can see the partitions and the size information. For mounting you need the start offset of the second partition (106496) multiplied with the block size (512).

mkdir ubuntu-arm/

dd if=/dev/zero of=expand_tmp bs=1M count=3000

cat expand_tmp >>panda-saucy_developer_20131216-558.img

sudo mount -o loop,offset=54525952 panda-saucy_developer_20131216-558.img ubuntu-arm/

cp /usr/bin/qemu-arm-static ubuntu-arm/usr/bin/

resize2fs -f /dev/loop0

mount --bind /proc ubuntu-arm/proc

mount --bind /tmp ubuntu-arm/tmp

mount --bind /sys ubuntu-arm/sys

mount --bind /dev ubuntu-arm/dev

mount --bind /dev/pts ubuntu-arm/dev/pts

mount --bind /home ubuntu-arm/home

echo ubuntu-arm > ubuntu-arm/etc/debian_chroot

cp /etc/resolv.conf ubuntu-arm/etc/

chroot ubuntu-arm/

locale-gen en_US en_US.UTF-8

dpkg-reconfigure locales

echo "deb http://old-releases.ubuntu.com/ubuntu/ saucy main universe" > /etc/apt/sources.list

echo "deb-src http://old-releases.ubuntu.com/ubuntu/ saucy main universe" >> /etc/apt/sources.list

apt-get update

apt-get install nano g++ libglib2.0-dev libslang2-dev autoconf libconfuse-dev libgnutls-dev git

export PATH=/usr/local/bin:/bin:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin

# git clone https://github.com/troglobit/inadyn.git

# cd inadyn

# ./autogen.sh,

break building if configure file is generated,

# ./configure --disable-ssl LDFLAGS=-static

# make && strip src/inadyn

some ideas / requests for further releases:

aroma installer to choose a dropbear or openssh deamon.

gui to configure the deamon.

ssh-copy-id support.

sshfs mount manager

cloud based backup of settings in case of a full wipe.

.
[Android Software/Hacking General [Developers Only]] Geofferey:
Thanks Sub, you the man! I appreciate you helping with the binaries and supporting other users in this thread. The Aroma installer is probably doable for me, problem is (correct me if I'm wrong) openssh can only use private key authentication since Android doesn't sport /etc/shadow.... I have thought of creating a GUI front end to write to the pseudo sshd.conf but I am no Java/Android app developer so that probably won't be happening unless you or someone you know is willing to tackle it. As for ssh-copy-id, sshfs and cloud based backup I will look further into it

I think I have already found some source to compile sshfs could be wrong tho.

https://github.com/l3iggs/android_external_sshfs?files=1
[Android Software/Hacking General [Developers Only]] enkidu70:
Hi [MENTION=3421557]Geofferey[/MENTION],

I am new to your mod and I like it. I currently use it on my OPO, CM13 and it works quite well (ssh server only, no ddns or reverse).

Only today I was unable to connect to my device. A restart of dropbear solved my problem. So I'd suggest to add a kind of nightly restart. E.g. with cron:

http://stackoverflow.com/questions/16747880/how-to-use-crontab-in-android

In addition to this, I'd suggest a config backup in sdcard. (I use /sdcard/Android/etc for things like that. :) ) Because I sometimes fully wipe my device (/system, /data, /cache - but NEVER my internal SD :) ) to really begin from scratch. First thing I could need would be ssh. So on first start after flashing, when there is no sshd.conf, it could search in sd for it and try it with this one if present. :)

Good work.

Cheers,

Enkidu
[Android Software/Hacking General [Developers Only]] enkidu70:
Can anyone please tell me, where to place my ssh-pubkey resp. authorized_keys(2) so that I get rid of pw-login!? And what key formats are valid?

Tnx!
[Android Software/Hacking General [Developers Only]] enkidu70:
I found another problem:

When I reboot my device, dropbear does not work. Means, "ssh mydevice" just hangs. So port seems to be open, but dropbear is not reacting at all. :(

When I restart dropbear manually, all is fine.
[Android Software/Hacking General [Developers Only]] Geofferey:
When you reboot your device run pdsshd-toolkit -c and report back what it says.
[Android Software/Hacking General [Developers Only]] :
I need openssh binary for proxy, but it seems that it was compiled without PIE support. Will not run on my Android M 6.0 Device :/ Can you please build a version with PIE support ?

thanks
[Android Software/Hacking General [Developers Only]] weasel5i2:
Thanks for your awesome work! It looks like we also need a build for 64-bit architecture.. I'm running a CM13-NIGHTLY on a Nexus 5X.

CANNOT LINK EXECUTABLE: "/system/lib/libc++.so" is 32-bit instead of 64-bit
page record for 0x7fa4402010 was not found (block_size=32)
Connection to 10.10.10.12 closed.
[Android Software/Hacking General [Developers Only]] Geofferey:
I have a Nexus 5X and a S6 as well... I need to recompile for 64bit but I am lazy to attempt ATM. Sorry. I'll update when I get around to it.
[Android Software/Hacking General [Developers Only]] lpreams:
So how do I uninstall it? Can I just delete a folder somewhere?
[Android Software/Hacking General [Developers Only]] Geofferey:
WORKING DBCLIENT for 64BIT ANDROID!!!

I've compiled a working 64bit version of the dropbear client :) Enjoy!!!

EDIT:

Successfully compiled a working version of dropbear for 64bit that doesn't rely on a statically compiled busybox distributions. Going to update with a new release of PDSSHD soon ;)
[Android Software/Hacking General [Developers Only]] Geofferey:
Update to v2.08

Released ver. 2.0.8 which adds new features

including:

64bit compatibility & 32bit in same binary

automated private/public key generation

Rom updates (just reflash no re-config req)

Notification LED on certain devices
[Android Software/Hacking General [Developers Only]] m3g4tr0n:
would this work on a Nvidia Shield TV?
[Android Software/Hacking General [Developers Only]] Geofferey:
I don't see why not since it has a 64bit arm processor. You will need busybox at /system/xbin and possibly some other lil mods. Does it have a way to flash zips?
[Android Software/Hacking General [Developers Only]] m3g4tr0n:
i have TWRP installed.

getting the error below

root@foster:/ # pdsshd -e
pdsshd -e
?[2J?[HPDSSHD v2.08 by:
Geofferey@XDA forums
?[2J?[H/system/xbin/pdsshd: line 429: test: -eq: unary operator expected
Oh yeah! It's running :)
/system/xbin/pdsshd: line 443: test: -eq: unary operator expected
/system/xbin/pdsshd: line 447: test: -eq: unary operator expected
/system/xbin/pdsshd: line 451: test: -eq: unary operator expected
/system/xbin/pdsshd: line 455: test: -eq: unary operator expected
root@foster:/ #
[Android Software/Hacking General [Developers Only]] Geofferey:
Do you have busybox installed?
[Android Software/Hacking General [Developers Only]] m3g4tr0n:
root@foster:/ # busybox
BusyBox v1.21.0 (2013-07-08 16:00:47 CEST) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.

Usage: busybox [function [arguments]...]
or: busybox --list[-full]
or: busybox --install [-s] [DIR]
or: function [arguments]...

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.

Currently defined functions:
[, [[, acpid, add-shell, adjtimex, ar, arp, ash, awk, base64, basename, bash, beep, blkid, blockdev,
bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown,
chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cryptpw,
cttyhack, cut, date, dc, dd, deallocvt, depmod, devmem, diff, dirname, dmesg, dnsd, dnsdomainname,
dos2unix, du, dumpkmap, echo, ed, egrep, env, envdir, envuidgid, expand, expr, fakeidentd, false,
fbset, fbsplash, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs, flock, fold, free,
freeramdisk, fsync, ftpd, ftpget, ftpput, fuser, getopt, grep, groups, gunzip, gzip, halt, hd,
hdparm, head, hexdump, hostname, httpd, hwclock, id, insmod, install, ionice, iostat, ip, ipaddr,
ipcalc, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, less, ln, loadfont,
loadkmap, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lsof, lspci, lsusb, lzcat, lzma, lzop, lzopcat,
makedevs, makemime, man, md5sum, mdev, mesg, mkdir, mkdosfs, mkfifo, mkfs.vfat, mknod, mkpasswd,
mkswap, modinfo, modprobe, more, mountpoint, mpstat, mv, nbd-client, nc, netstat, nice, nmeter,
nohup, od, openvt, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap,
popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pstree, pwd, pwdx, raidautorun, rdate,
rdev, readlink, readprofile, realpath, reboot, reformime, remove-shell, renice, reset, resize, rev,
rm, rmdir, rmmod, rpm, rpm2cpio, rtcwake, run-parts, runsv, runsvdir, rx, script, scriptreplay, sed,
sendmail, seq, setconsole, setfont, setkeycodes, setlogcons, setserial, setsid, setuidgid, sh,
sha1sum, sha256sum, sha3sum, sha512sum, showkey, slattach, sleep, smemcap, softlimit, sort, split,
start-stop-daemon, stat, strings, stty, sulogin, sum, sv, svlogd, switch_root, sync, sysctl, tac,
tail, tar, tcpsvd, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr,
traceroute, traceroute6, true, tty, ttysize, tunctl, udpsvd, uname, uncompress, unexpand, uniq,
unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, vlock,
volname, watch, wc, wget, which, whoami, whois, xargs, xz, xzcat, yes, zcat

root@foster:/ #

which busybox
[B]/data/data/berserker.android.apps.sshdroid/dropbear/busybox[/B]

theres also one in system/xbin
[Android Software/Hacking General [Developers Only]] Geofferey:
Get one from playstore busybox installer and install it to /system/xbin. If that doesn't work report back. I may upload you custom bash to try.
[Android Software/Hacking General [Developers Only]] m3g4tr0n:
got it to work.

uninstalled SSHDroid then installed busybox to /system/xbin.

got two problems now

1. i cant use a password with $ character.

2. getting error below when connecting

---------------------------

Warning

---------------------------

The first key-exchange algorithm supported by the server is diffie-hellman-group1-sha1, which is below the configured warning threshold.

Do you want to continue with this connection?

---------------------------

Yes No Help

---------------------------

thanks
[Android Software/Hacking General [Developers Only]] m3g4tr0n:
can you compile with the latest dropbear?
[Android Software/Hacking General [Developers Only]] Geofferey:
I have tried to compile using the latest version, but password login is completely broken. That's why I'm using older versions. The patches actually work. The $ sign issue I've known about. It's because the terminal uses that symbol when pointing to a variable. I usually forward my ssh and connect that way. Kinda helps with the old key exchange issues when you connect via local network. It's just a.warning that the connection isnt as secure. Updated versions of dropbear don't have the problem. If you'd like I will try to post a updated version of the binary but it won't be included in future releases because password auth is broken and not everyone wants to use key exchange.
[Android Software/Hacking General [Developers Only]] Finswimmer:
I tried to use this on an Moto X plus with stock Android 6.

After installation and configuration I get when trying to login via ssh:

Unable to negotiate with 192.168.1.44 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

Changing to ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 192.168.1.44 I get immediately:

Connection to 192.168.1.44 closed.

Enabling "-vvvv" I see:
[Android Software/Hacking General [Developers Only]] Finswimmer:
While debugging I saw "Remote protocol version 2.0, remote software version dropbear_0.52" which is rather old (2008-11-12).

Would it be possible to upgrade?
[Android Software/Hacking General [Developers Only]] Darkestnoir:
Hey,

nice tool, good work:svetius:

But can you fix this:

The first key-exchange algorithm supported by the server is diffie-hellman-group1-sha1, which is no longer secure. Aborting connection.

This is a little bit insecure...

And this:

Bad message (badly formatted packet or protocol incompatibility).
Error code: 5
Error message from server: Bad message

After transferring 2.147.514.705 Bytes on my external storage (i have the same problem with SSHDroid).

Device: Nvidia Shield TV @ Android 6.0.1 rooted
[Android Software/Hacking General [Developers Only]] Geofferey:
UPDATE - Openssh Binaries for Android

I haven't updated this project in a while... Obviously haha... Sorry if I left anybody in the dark. I'm no C dev so the issues you guys are having are beyond my skill-set afaik. I know the source is OLD but its the best I could do. I tried to compile newer versions and they had issues that made it not feasible. The key-exchange issue shouldn't be too worrisome, most people wouldn't even have the computational power needed.

Anyways I will leave ya'll with a gift. Attached are openssh binaries that I extracted from a CM14 ROM for the Nexus 5X. I couldn't find them anywhere else besides a pre-built ROM. I plan to integrate these binaries in near future so users will have the choice between openssh / dropbear clients & servers. I just don't know how I am going to implement it. Expect a standalone openssh flashable zip for 64bit devices very soon ;)

Here's a lil guide for you guys so you can figure out what to do with the provided binaries in meantime.

EDIT:

I put together a new ver. of the project 2.0.9 with the addition of OpenSSH support. Sadly after testing on my Nexus 5X running stock M with xposed it spit out errors complaining about missing symbols etc. Thats probably due to the binaries being from a CM-14 ROM. It does work fine on my Pixel running 7.1.1 PN. I have attached the updated project and a standalone installer for OpenSSH.
[Android Software/Hacking General [Developers Only]] Geofferey:
Dropbear 2018.76 Binary!

Well I finally cross-compiled a fully working version of Dropbear ver. 2018.76 (afaik) with password and key auth. I've also made it possible to build customized versions of Dropbear for Android directly on Gitlab, just fork the repo and run pipeline with VARs described in the projects README.md or clone the repo and run build.sh on a Linux box. I also have plans to update the main .zips for this project very soon once I get the time. Happy Holidays to you folks!
[HTC Desire C] ADB100:
I have a UK 02 branded Desire C. I unlocked it with HTC Dev, installed CWM recovery and then installed some custom ROMs. I now want to restore it to stock ICS 4.0.3 which I have but had hit an issue. I installed the untouched v2.0 that is available on here but this ROM doesn't have NFC which the original ROM did. I have found some RUU's for this device but not for this CID (cid: 02__001) - the ones I found are HTC only CID's and a H3G one. I am looking for an O2 RUU - is there one available anywhere?

Andy
[General Questions and Answers] malrevenal:
Hi all,

I'm following the guide at CM wiki to build for samsung n7100:

**tp://wiki.cyanogenmod.org/w/Build_for_n7100 (sorry)

While executing device/samsung/n7100/extract-files.sh, I note that some files are missing from my device (running CM version 11-20140505-SNAPSHOT-M6-n7100):

/system/bin/bcm4334_semco.hcd
/system/bin/lpm
/system/lib/libaudiosa.so
/system/vendor/lib/liblvverx.so
/system/vendor/lib/liblvvetx.so
/system/vendor/lib/mediadrm/libwvdrmengine.so

The build fails with make complaining about no rules to make these files.

What makes me confused is that the stock system.img does not contain these files either. So why are they listed as dependencies, or why does the script try to extract them? How can I carry out a successful build?
[Galaxy Tab 10.1 Q&A, Help & Troubleshooting] ArAc007:
Hi All.

I have a GT-P7500 android 4.0.4 (rooted).

I wanted to download and install modern combat 5 on my tab. But it had the same problem as MC4, it was not compatible with my device. So I did what I did with MC4. I used Market helper to change my device ID and downgraded my google play by uninstalling the update ( cause last time when I tried market helper only, it gave me an error when starting the download). This method completely worked for MC4.

MC5 purchased, downloaded and installed perfectly but when I open it , on "Verifying Files.." screen after gameloft logo a bar fills up fully but then MC5 closes and I go to my home screen. It doesn't say forced closes. Just closes!

I would really appreciate it if anybody could help me with this.

Thank you
[Galaxy Tab 10.1 Q&A, Help & Troubleshooting] SystemDoctor:
Try using an upgraded ROM. Hope this helps.
[Galaxy Tab 10.1 Q&A, Help & Troubleshooting] ArAc007:
Thanks for the response. .. I did that with MC4 but it was very faulty and roms I installed were unstable (im kindda a noob when it comes to roms)

Any specific stable rom u can suggest for p7500???