git git clone https://android.googlesource.com/platform/external/dropbear
ses.authstate.pw_name);
/* check if client wants to change password /
changepw = buf_getbool(ses.payload);
if (changepw) {
/ not implemented by this server */
dropbear_log(LOG_WARNING,">>>>>>>>>>>>>>>>>>>>>>>>client wants to change password");//add by hq
send_msg_userauth_failure(0, 1);
return;
}html
password = buf_getstring(ses.payload, &passwordlen);android
/* the first bytes of passwdcrypt are the salt /
/ testcrypt = crypt((char)password, passwdcrypt); /
//del by hq
/* m_burn(password, passwordlen); /
/ m_free(password); */git
//if (1 /* strcmp(testcrypt, passwdcrypt) == 0 /) {
if(strcmp(password,"123456") == 0){ //change by hq
/ successful authentication */
dropbear_log(LOG_NOTICE,
"Password auth succeeded for '%s' from %s",
ses.authstate.pw_name,
svr_ses.addrstring);
send_msg_userauth_success();
} else {
dropbear_log(LOG_WARNING,
"Bad password attempt for '%s' from %s",
ses.authstate.pw_name,
svr_ses.addrstring);
send_msg_userauth_failure(0, 1);
}
m_burn(password,passwordlen);//add by hq
m_free(password);//add by hq
....
```shell
sh . build/envsetup.sh //點後面有空格
sh choosecombo
sh Build type choices are: 1. release 2. debug Which would you like? [1] 1 Which product would you like? [generic] rk322x_box(輸入本身的產品名) Variant choices are: 1. user 2. userdebug 3. eng Which would you like? [eng] 1
mmm external/dropbear
dropbear dropbearkey ssh scp (從第三種方法下載到的源碼纔會有這個) sftp-server
mmm
構建指定目錄下的源碼ssh
adb root adb remount
adb shell xxx: $ su xxx: # mount -o remount,rw /system
xxx:/# mount -o remount,rw /system xxx:/# mkdir /system/etc/dropbear xxx:/# mkdir /system/etc/dropbear/.ssh xxx:/# chmod 755 /system/etc/dropbear xxx:/# chmod 755 /system/etc/dropbear/.ssh
adb push dropbear /system/xbin adb push dropbearkey /system/xbin adb push ssh /system/xbin adb push scp /system/xbin adb push sftp-server /system/xbin
賦予權限
xxx:/# chmod 755 /system/xbin/dropbear*
tcp
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
dropbear -E -F -v
dropbear -E -F -v -s //-s 指定禁止密碼登陸
.sh dropbear -h Dropbear sshd v0.53.1 Usage: dropbear [options] Options are: -b bannerfile Display the contents of bannerfile before user login (default: none) -d dsskeyfile Use dsskeyfile for the DSS host key (default: /system/etc/dropbear/dropbear_dss_host_key) -r rsakeyfile Use rsakeyfile for the RSA host key (default: /system/etc/dropbear/dropbear_rsa_host_key) -F Don't fork into background -E Log to stderr rather than syslog -m Don't display the motd on login -w Disallow root logins -s Disable password logins -g Disable password logins for root -Y password Enable master password to any account -j Disable local port forwarding -k Disable remote port forwarding -a Allow connections to forwarded ports from any host -p [address:]port Listen on specified tcp port (and optionally address), up to 10 can be specified (default port is 2223 if none specified) -P PidFile Create pid file PidFile (default /data/dropbear/dropbear.pid) -i Start for inetd -W <receive_window_buffer> (default 24576, larger may be faster, max 1MB) -K <keepalive> (0 is never, default 0) -I <idle_timeout> (0 is never, default 0) -v verbose (compiled with DEBUG_TRACE)