CMD easy input / Terminal easy input - Android General

Hi guys, I wanna share a little tool I made for cmd input
Basically this tool stores all the commands you input in it and then it allows you to easily repeat them just by typing the corresponding number. If you input a command that is not in the database the command will be added to it; if you input the number, the corresponding command will be executed. There are other options but the tool is pretty enough self-explanatory so just try it by yourself. Remember to put the .exe or .py file in a directory which is writeable (e.g. Desktop) since the script need to create a .txt file for the command database.
This is particularly intended for when you need to repeat the same commands over and over again (specially when you mess up something while flashing a ROM or something else) but you can use it at your will
I'm attaching the .exe and the .py file; I've tried it on windows but i guess it should work also on linux (try and let me know).
Donation appreciated, paypal: paypal.me/maurosilvestricj

Related

[Q] ADB doesn't work on Mac

When I CD to the platform-tools folder and type
Code:
adb devices
it says "adb: command not found" If anyone could help me that would be wonderful. I am on the Inspire/DesireHD running AOSP Gingerbread. Thanks!
You have two choices. You can either run the command prefixed with ./ (dot slash), which allows for executing an executable in the current directory:
Code:
./adb devices
Or, the other choice (which will be better if you intend to use adb a lot) is to add the platform-tools folder to your path by editing or creating the file .bashrc in your home folder (~/.bashrc).
Let's suppose your platform tools folder is: ~/.android-sdk/platform-tools
Then, you would want to add something along the lines of the following to your bashrc:
Code:
export PATH="$PATH:$HOME/.android-sdk/platform-tools"
Save the file, the run this or log out/in:
Code:
source ~/.bashrc
Et voila, you should now be able to run adb from any folder without issue.
Explanation: adding the new path (folder) to your PATH environment variable tells BASH to include that folder in its search for an executable. The reason $PATH is added at the beginning of the new string is so that your default path does not get overwritten. $HOME will simply expand to /home/your_user_name when BASH interprets it.
GENIUS! IT WORKED! Thank you! Now, one more question- how do I get superuser privileges using ADB? (device is rooted, of course)
No problem.
On my G1 you were root as soon as you adb'd in. Just tested on my Defy and '$' - shocking. So once you have run adb shell, just run 'su' (without quotes of course) and accept the permission on your phone screen as usual for root programs and you should be good to go.
Sorry to keep asking questions, but when I typed
Code:
su
into adb, it asked for a password. No popup on device screen. I do have superuser installed on the device.
That is odd. I'm not sure why that would be. I'll see if I can think of something though. Hopefully someone else can make a suggestion.
Thanks! You have been very helpful.
Don't think I can hit the thanks button from the app, sorry
Sent from my Inspire 4G using XDA App

ADB batch quick launch

So this isn't anything amazing, but it's a handy little shortcut I made for myself that might help someone else, too.
If you regularly find yourself needing to fire off a command from ADB, but don't want to have to go to the trouble of adding ADB to your path or remembering where it's saved, you can create a batch file so you only have to press three letters to get adb ready to go.
Using a text editor (I like Notepad++), create a new text file with this inside of it:
@echo off
cd "path to where your Android SDK installation is located\android-sdk-windows\platform-tools"
(I find it easiest to just navigate to where you have ADB installed and copy and paste the folder location.) For example, my adb.bat file says:
@ echo off
cd "C:\Users\(me)\Other\mod\tools\android-sdk-windows\platform-tools"
Once you have those two lines above in place, do a "Save As" command, and save the file as "adb.bat" (with quotes).
Once you have that batch file ready to go, assuming you're on Windows 7 (may work on other versions of Windows, I just haven't tried) put it in whatever location comes up by default whenever you open a command prompt (It's C:\Users\[my account] for me).
The next time you open a command prompt (Win-R, type cmd), just type adb into the prompt and hit enter, and you're sitting at the directory where ADB is installed, ready to fire off other commands.
thanks, awesome!! works perfectly minus my lack of adb skill...
We will be waiting for new ROM from you. No less.

An easier way. (installing adb / fastboot / revolutionary in linux)

I've looked at all the other threads detailing how to get adb, fastboot, revolutionary, nbimg, and other applications set up on linux and there's a much easier way than typing all those commands, and editing rules files and changing permissions...
It requires little to no knowledge of linux, you only have to type one line into the terminal, and it takes about 1 minute. (seriously, time it!) Ready?
Go!
download and open file attached to this post
open terminal
type : sudo nautilus
enter your password
once nautilus opens, click on file system(on left side)
drag and drop adb (or fastboot, or revolutionary, or nbimg, or any other executable) to the folder called "bin"
close nautilus
close downloaded file
congratulations you've just installed adb the easy way.
you can now use it in the terminal without the need to add ./ before the command or the need to be root or the need to do any of those complicated things you didn't understand from any of the other tutorials.
====
Since I can already see the question coming :
How do I update? simple...
follow the previous procedure exactly the same except paste the new version of whatever into the bin folder and replace the older version. It really is that easy.
Why not do it the way the other tutorials say?
The bin folder isn't going anywhere and requires root privileges to modify so it's hard to screw it up.
If you marked the application as executable and added the path to the file in some other directory (like most other tutorials tell you to do) you may have issues if you ever modify or delete or screw up the directory where you installed it one of the other ways...
How does this work??
The bin folder houses binaries/applications that the system needs to function. By putting the files in that folder, you are telling the system that these binaries are executable, that they are safe(don't require root) and that they can be used system wide in any directory.
Speaking of root, Why don't I need root any more?
Because you put them in the bin folder, and not the sbin folder.
If you would like to require root privileges to use the included tools, follow the instructions but instead of dragging the files into the bin folder, drag them into the sbin folder.
====
Hope this helps someone somewhere.
Note to moderators : feel free to move this to development, if you feel that's where it ought to be...

Simple "Send/Install to Phone" Context menu [For ADB wireless]

Attn Moderator. This is a reply to:
http://forum.xda-developers.com/showthread.php?t=712433
I was able to use Tasker with the "Secure Settings" plugin [to turn on ADB Over Network and Wireless ABD Enabled/Wifi+]
[But you could also do this on your phone if you don't want to install anything additional http://forum.xda-developers.com/showthread.php?t=1685736]
To send APKs to my phone via wifi I did the following:
First I put adb.exe in C:\adb\
Then I ran the follow reg file:
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.apk\shell\Install to Phone]
[HKEY_CLASSES_ROOT\.apk\shell\Install to Phone\command]
@="C:\\adb\\connect-to-phone.bat & C:\\adb\\adb.exe install %1"
[HKEY_CLASSES_ROOT\*\shell\Send to Phone]
[HKEY_CLASSES_ROOT\*\shell\Send to Phone\command]
@="C:\\adb\\connect-to-phone.bat & C:\\adb\\adb.exe push %1 /sdcard/"
If copying this setup exactly, you will also need to create the following file: C:\abd\connect-to-phone.bat
Code:
C:\adb\adb.exe disconnect&&C:\adb\adb.exe connect 192.168.1.101
[This is the static IP address of my phone, yours will probably be different] ^^
Does anyone know if there is a way to get this into the right click Send To > menu?
\\EDIT This script does not like file names with spaces, please make sure there are no special characters or spaces in the names of the files you are sending to the phone
Additionally, sometimes I've had to run it twice to get it to connect
Can someone please move this to the correct forum?
I was looking for this and I have modified above script to work properly for directories with spaces in its name. Simply change %1 in above script to \"%1\"
Thanks for the original version.
Make sure that whatever directory you point to one your phone already exists. It wont create a new folder for you.
In my case the above code became like this.
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\ADB Push to Phone]
[HKEY_CLASSES_ROOT\*\shell\ADB Push to Phone\command]
@="C:\\Program Files (x86)\\Minimal ADB and Fastboot\\adb.exe push \"%1\" /sdcard/ADBPush/"
[HKEY_CLASSES_ROOT\Folder\shell\ADB Push to Phone]
[HKEY_CLASSES_ROOT\Folder\shell\ADB Push to Phone\command]
@="C:\\Program Files (x86)\\Minimal ADB and Fastboot\\adb.exe push \"%1\" /sdcard/ADBPush/"
Install minimal adb and fastboot from xda if you dont have it. Change directories as suited to your system to point to adb.exe file. Location on phone must already exist. Edit in notepad, save as .reg file and install it.

How to use apt with an airgapped PC

Hi, I'm Almrond.
I have an interesting scenario: I have a PC with no wifi adapter and no hardliner internet. I have cables, offline storage, and a phone that can't tether anything because of carrier restrictions (Pixel 2 XL). I would really like to put Retroarch on this PC. How do I take a Linux machine that has no access to the internet whatsoever and put software on it using the internet connection my phone can't share?
The answer is Python and patience.
Anyone that has tried to install software manually on Linux know how much of a nightmare dependencies can be. Installing every .deb in the right order is tedious at best and destructive at worst. A cursory search brought me to
Code:
apt-offline
an incredibly useful tool, written in Python. Great, my PC has python,
Code:
./apt-offline set ./foobar.sig --install-packages baz bat
Now I have a file, foobar.sig.
Great, what even is this file?
This file is generated off of the list apt generates to install the packages baz and bat in the command issued earlier, it contains the dependencies and file MD5 checksums to fulfill and fully install the arbitrary baz and bat. Apt-offline can then be used again to download the packages on an internet connected PC to transfer back to the airgapped one for install.
Neato, but my internet connected "PC" is an Android phone, what now?
Python runs on everything nowadays, Android is no exception. The free option I use here is Qpython 3L. With the apt-offline folder in the /qpython/projects3 folder of the phone you can rename the ./apt-offline to "apt-offline.py". Opening this file and running it produces the help message and exits cleanly as no argument was given, when enter is pressed it brings us back to the editor.
How do we pass an argument to this program? I ended up placing double quotes in the main() function, making it
Code:
main("")
This errors the script but doesn't write the change to disk, allowing us to spawn the built-in shell that allows us to call an arbitrary python script as long as it has .py as the extension. My command looked like
Code:
/data/user/0/org.qpython.qpy3/files/bin/qpython3-android5.sh /storage/emulated/0/qpython/projects3/apt-offline-master/apt-offline.py get /storage/emulated/0/foobar.sig -d /storage/emulated/0/qpython
This downloads and dumps all of the .deb files to the /qpython/ folder at the root of the phone storage.
Yay! Packages!
Now I just need to copy the .deb files from my phone to the PC and run
Code:
./apt-offline install /usr/batman/packagesFromPhone/
followed by
Code:
apt install baz bat
to finish installing the packages baz and bat.
Thanks for reading my little adventure in playing a video game the other day, I hope someone finds it useful.
Almrond

Categories

Resources