Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,781,073 Members 45,956 Now Online
XDA Developers Android and Mobile Development Forum

[DEV][WIP] PyAdb Python 2.7 Package [Windows/Unix]

Tip us?
 
cybojenix
Old
(Last edited by cybojenix; 25th December 2013 at 07:38 AM.)
#1  
cybojenix's Avatar
Recognized Developer - OP
Thanks Meter 1,540
Posts: 819
Join Date: Apr 2012

 
DONATE TO ME
Default [DEV][WIP] PyAdb Python 2.7 Package [Windows/Unix]

KEarlier I saw a thread that demonstrated a python wrapper for the adb command. I remembered a while ago that adb uses a TCP protocol (duh it's written in the docs)

I had some spare time today so I decided to write a script for you all (I know how redundant it is, but hey why not)
This script incorporates the core functionality of adb into it, such as detecting your device... that's pretty much it at this stage..

so here it is. PyAdb

I doubt this will brick anyone's devices... but just in case..
disclaimer:
Quote:
if this bricks your device, it was not my fault. you used this at your own risk.
I don't care if this crashes your computers, or shoots you in the foot. you used it, not me
The general concept with how this works is below:
firstly, you have to choose your command from this list
secondly: the length of that command (in hexadecimal) needs to be prefixed before the command is sent. This is probably to do with security so the adb server on the device only reads the right amount of data
thirdly:... well there's not much more to it. just enjoy, tinker with it, and remember to contribute!!

note about getting device detected:
You need to ensure that the Android Debugging Bridge driver is installed for your device. this is normally supplied with standard device drivers. please refer to your device forums for instructions on how to install these
You also need to make sure your pc is authorised with stock adb, otherwise you won't be able to connect with PyAdb (for 4.2 upwards)

note about the current shell integration:
I now have a threaded interactive console, however single commands are still not read from a thread. If you want to use grep or kmsg, launch a full session
Quote:
<cybojenix> Every single language makes sense. They're logical
<cybojenix> Then there's just Perl.
<helicopter88> perl just looks like an esotheric language
<cybojenix> Perl is what came out from those monkeys trying to recreate Shakespeare
<helicopter88> cybojenix, this is the wise sentence of the month

like my work? buy me a present
 

Proud member of TeamHackLG


contact me here
My Builds
P350 kernels: 2.6.35 | 3.0.x
Github
devices: p350 | e610 | Nexus 7 | tegra note 7

The Following 10 Users Say Thank You to cybojenix For This Useful Post: [ Click to Expand ]
 
DaGr81
Old
#2  
DaGr81's Avatar
Member
Thanks Meter 6
Posts: 59
Join Date: Aug 2010
Location: Kathmandu
page not found!
HTC Google Nexus One
BlackRose HBOOT Version: 7.35.5017
Radio Version: 5.08.00.04
ClockworkMod Recovery Version: 5.0.2.0
ROM: CyanogenMod 7.2
Current Status: Broken Power Button but still rigid.


LG Google Nexus 4
Bootloader: MAKOZ30d
Baseband: .83
TWRP with MultiRom: 2.6.3
ROM: CyanogenMod 11


Asus Google Nexus 7
Bootloader Version: 4.13
TWRP version: 2.6.3
ROM: CyanogenMod 11
 
omegavesko
Old
#3  
omegavesko's Avatar
Member
Thanks Meter 189
Posts: 87
Join Date: Jun 2012
Fixed link: https://github.com/cybojenix/PyAdb/

Looks like OP removed the file he linked to and forgot to change the link. :P
The Following User Says Thank You to omegavesko For This Useful Post: [ Click to Expand ]
 
anttaz
Old
#4  
Senior Member
Thanks Meter 14
Posts: 301
Join Date: Nov 2009
Location: Doncaster

 
DONATE TO ME
Default 404 page not found?

Quote:
Originally Posted by cybojenix View Post
Earlier I saw a thread that demonstrated a python wrapper for the adb command. I remembered a while ago that adb uses a TCP protocol (duh it's written in the docs)

I had some spare time today so I decided to write a script for you all (I know how redundant it is, but hey why not)
This script incorporates the core functionality of adb into it, such as detecting your device... that's pretty much it at this stage..

so here it is. PyAdb

I doubt this will brick anyone's devices... but just in case..
disclaimer:


The general concept with how this works is below:
firstly, you have to choose your command from this list
secondly: the length of that command (in hexadecimal) needs to be prefixed before the command is sent. This is probably to do with security so the adb server on the device only reads the right amount of data
thirdly:... well there's not much more to it. just enjoy, tinker with it, and remember to contribute!!

note about getting device detected:
You need to ensure that the Android Debugging Bridge driver is installed for your device. this is normally supplied with standard device drivers. please refer to your device forums for instructions on how to install these

note about the current shell integration:
I haven't added a threaded data capture method yet, purely because I don't have time at the moment. it will (should) work with single commands. it isn't reliable for commands that take a while to run (such as grep)
404 page not found?
 
cybojenix
Old
#5  
cybojenix's Avatar
Recognized Developer - OP
Thanks Meter 1,540
Posts: 819
Join Date: Apr 2012

 
DONATE TO ME
Quote:
Originally Posted by omegavesko View Post
Fixed link: https://github.com/cybojenix/PyAdb/

Looks like OP removed the file he linked to and forgot to change the link. :P
lol yeah thanks. I did some file changes and forgot I linked to the file in the thread rather than the repo
Quote:
<cybojenix> Every single language makes sense. They're logical
<cybojenix> Then there's just Perl.
<helicopter88> perl just looks like an esotheric language
<cybojenix> Perl is what came out from those monkeys trying to recreate Shakespeare
<helicopter88> cybojenix, this is the wise sentence of the month

like my work? buy me a present
 

Proud member of TeamHackLG


contact me here
My Builds
P350 kernels: 2.6.35 | 3.0.x
Github
devices: p350 | e610 | Nexus 7 | tegra note 7

The Following User Says Thank You to cybojenix For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes