Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

12 March 2014

Hidden power of Android

android

Hidden Power of android.

Every android phone comes with a Busybox , which provides several unix tools. (Android use a Linux kernel. ). unfortunately android does not provide a shell or command interpreter. like xterm in Debian/Ubuntu. user will have to install them manually. few of it are. • Below are some useful command found in android:

cal displays a calendar and the date of Easter
dd convert and copy a file
df , du report file system disk space usage
dos2unix , unix2dos convert file from one format to another.
ftpget , ftpput , tftp File transfer client & server.
httpd A barebone web server.
ifconfig configure a network interface
ip show / manipulate routing, devices, policy routing and tunnels.
md5sum , sha1sum , sha256sum , sha512sum compute and check MD5 , SHA1SUM , SHA256SUM , SHA512SUM message digest
nc The swiff army knife of network mapping.
netstat Display network connections, routing, tunnel etc.
ping , ping6 send ICMP ECHO_REQUEST to network hosts
ps Display process
sh , ash Shell or Command interpreter
sqlite3 A command line interface for SQLite version 3
telnet , telnetd A Telnet client & server.
traceroute , traceroute6 Trace the route to HOST
top Display top process
touch change file timestamps
udhcpc , udhcpd DHCP client & server.
uname Get system or kernel information
uptime Tell how long the system has been running.
vi Text Editor
wget The non-interactive network downloader.
who show who is logged on
whois client for the whois directory service


Other commonly use command:
awk , basename , id , hostname , clear , cat , date , diff , dirname , dmesg , echo , dnsdomainname , env , false , find , hostid , head , grep , less , ln , ls , mkdir , logname , more , mv , pwd , sleep , sort , rm , rmdir , sed , renice , reset , tail , tee , test , true , uniq , which , whoami , wc , yes .

Here are few example:

ping -c 5 google.com
sqlite3 foo.db
Web Server:
busybox httpd -h /mnt/sdcard/www/ -p 8888
Download Manager:
busybox wget -c www.example.com/map.png
Telnet Server:
busybox telnetd
busybox telnet 127.0.0.1
busybox whois www.google.com
busybox uname -a
busybox top -d 2
dd if=pic1.jpg of=pic2.jpg
busybox cal 2014
busybox netstat -tun


22 February 2014

Installing ADB in GNU/Linux

adb

Making ADB work in Linux (Debian/Ubuntu)

  1. Install Android Debug Bridge for GNU/Linux.

    • for Debian & DEB packages:
    sudo apt-get install android-tools-adb

    • for Redhat & RPM packages:
    sudo yum install android-tools-adb


  2. Connect android phone.
    lsusb
    Bus 001 Device 008: ID 058f:6366 Alcor Micro Corp. Android
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Find the corresponding line for your android phone.
    The Vendor & Product ID will be in XXXX:XXXX format. In our example the ID's is 058f:6366 .
    058f = VendorID.
    6366 = ProductID.


  3. Create Rules.
    sudo gedit /etc/udev/rules.d/51-android.rules
       you can use vi, nano, pico or any text editor in place of gedit.

    append the code to the file.
    SUBSYSTEM=="usb", ATTR{idVendor}=="058f", ATTR{idProduct}=="6366", MODE="0666", GROUP="plugdev"


  4. Create adb file in home ( ~ ) folder.
    mkdir ~/.android
    ( if not already created. )
    touch ~/.android/adb_usb.ini
    echo '0x6366' >> ~/.android/adb_usb.ini


  5. Restart udev.
    sudo service udev restart
    adb kill-server
    adb start-server


  6. Reconnect the Phone.
    You may need to disconnect and reconnect the phone again. and wait for a couple of minute to get it detected.
    adb devices
    List of devices attached
    19761202 device
    45024745 device




# The short way.

Copy this code into the terminal (replaces id's) and run it.

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="6366", ATTR{idProduct}=="058f", MODE="0666", GROUP="plugdev"' | sudo tee -a /etc/udev/rules.d/51-android.rules && mkdir ~/.android/ && touch ~/.android/adb_usb.ini && echo '0x6366' >> ~/.android/adb_usb.ini && sudo service udev restart && adb kill-server && adb start-server && adb devices
Replace the VendorID & ProductID with the one you got....