Comments (5)
can you send a screenshot or describe better how do you connect with a user and password? this is not a common type of authentication in adb.
also if you could intercept USB or TCP communication with Wireshark would greatly help.
from adb_shell.
Thanks for your reply. This device can connect with password like this.
Using user as 'root', and password as 'oelinux123'.
from adb_shell.
what if you use adb_shell like this?
from adb_shell.adb_device import AdbDeviceUsb
from adb_shell.auth.sign_pythonrsa import PythonRSASigner
# Load the public and private keys
adbkey = 'path/to/adbkey'
with open(adbkey) as f:
priv = f.read()
with open(adbkey + '.pub') as f:
pub = f.read()
signer = PythonRSASigner(pub, priv)
# Connect via USB (package must be installed via `pip install adb-shell[usb])`
device = AdbDeviceUsb()
device.connect(rsa_keys=[signer], auth_timeout_s=0.1)
# Send a shell command
login = 'root\noelinux123\n'
response = device.shell(login + 'whoami')
from adb_shell.
Thank you . I try it, but doesn't work.
Since I don't have adbkey, I use the function below
device = AdbDeviceTcp('127.0.0.1', 5037, default_transport_timeout_s=9.) device.connect(auth_timeout_s=0.1) login = 'root\noelinux123\n' response = device.shell(login + 'whoami')
But cannot connect.
Traceback (most recent call last): File "E:\Project\PyOneDark\main.py", line 5974, in adb_connect device.connect(auth_timeout_s=0.1) File "E:\Project\PyOneDark\venv\lib\site-packages\adb_shell\adb_device.py", line 675, in connect self._available, self._maxdata = self._io_manager.connect(self._banner, rsa_keys, auth_timeout_s, auth_callback, adb_info) File "E:\Project\PyOneDark\venv\lib\site-packages\adb_shell\adb_device.py", line 228, in connect cmd, arg0, maxdata, banner2 = self._read_expected_packet_from_device([constants.AUTH, constants.CNXN], adb_info) File "E:\Project\PyOneDark\venv\lib\site-packages\adb_shell\adb_device.py", line 408, in _read_expected_packet_from_device cmd, arg0, arg1, data = self._read_packet_from_device(adb_info) File "E:\Project\PyOneDark\venv\lib\site-packages\adb_shell\adb_device.py", line 486, in _read_packet_from_device msg = self._read_bytes_from_device(constants.MESSAGE_SIZE, adb_info) File "E:\Project\PyOneDark\venv\lib\site-packages\adb_shell\adb_device.py", line 455, in _read_bytes_from_device raise exceptions.AdbTimeoutError("Timeout: read {} of {} bytes (transport_timeout_s = {}, read_timeout_s = {})".format(len(data), len(data) + length, adb_info.transport_timeout_s, adb_info.read_timeout_s)) adb_shell.exceptions.AdbTimeoutError: Timeout: read 0 of 24 bytes (transport_timeout_s = 9.0, read_timeout_s = 10.0)
from adb_shell.
I use this method and it works, but some command like 'ls' or 'sqlite3' doesn't support.
` def adb_connect(self):
# 连接设备
self.child = pexpect.popen_spawn.PopenSpawn('adb shell')
# 匹配提示符,输入用户名和密码
self.child.expect(['#', ' $', 'mdm9607 login:'], timeout=3)
self.adb_out.insertPlainText('检测到登录请求...\n')
self.child.sendline('root')
self.adb_out.insertPlainText('发送root用户名...\n')
time.sleep(1)
self.child.expect(['#', ' $', 'Password:'], timeout=4)
self.adb_out.insertPlainText('检测到密码请求...\n')
self.child.send('oelinux123\n')
self.adb_out.insertPlainText('输入密码...\n')
self.child.expect(['#', '~'], timeout=3)
self.adb_out.insertPlainText('登录成功\n')`
from adb_shell.
Related Issues (20)
- Using pull on BytesIO object HOT 3
- Pushing large files always timeouts HOT 12
- Implement the pair command for Android 11+ devices HOT 6
- How to connect more than two devices at the same time? HOT 3
- AdbDeviceUsb not working with MacOS X due to error 'LIBUSB_ERROR_ACCESS [-3]' HOT 2
- default_transport_timeout_s is ignored HOT 1
- Add support for pulling directories HOT 2
- usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3] HOT 2
- adb server claims usb device: results in USBErrorBusy
- Feature request install package analog to adb install HOT 4
- get return code of shell command HOT 4
- Add adb forward functionality
- packaging this project for Debian HOT 3
- Improvement
- Streaming Shell doesn't result in a stream ?
- usb1.USBErrorBusy: LIBUSB_ERROR_BUSY [-6] when connect to device HOT 2
- Timeout shell commands after gaining root on device
- Please avoid re-tagging
- No ability to list attached devices?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adb_shell.