CASUAL

CASUAL stands for Cross-Platform ADB Scripting Universal Android Loader. CASUAL is a scripting language and a package distribution system. CASUAL is Cross-Platform (Windows, Linux, and Mac), and Open-Source. CASUAL works with every current Android device which utilizes ADB. CASUAL's source code can be found here: http://code.google.com/p/android-casual/ this article is based upon the source code translation into human readable format.
Notibly, CASUAL has been used to distribute the Motofail exploit. While CASUAL is still officially in public beta it has been downloaded over 3,000 times and mentioned by several android news sites.
CASUAL is intended to be modified and redistributed. CASUAL can be changed by recompiling the source, or modifying the java JAR's /SCRIPT/ folder.
CASUAL Package Layout
CASUAL is distributed as a Java JAR file. It can be modified with any utility compatible with the universal zip format. All CASUAL programs and GUI tweaks are located in the /SCRIPTS/ folder. The GUI is customizable by simply editing text files. The individual packages are a text, a zip and a script.
GUI design
The GUI is controlled by the build.properties file. This file is pure text and is self-documented. eg.
#Developer Name
Developer.Name=Adam Outler
#Donation link button title
Developer.DonateToButtonText= XDA-Developers
#Link for donate button
Developer.DonateLink= http://forum.xda-developers.com/donations.php
#This is the window title
Window.Title=CASUAL TEST SCRIPTS
#If true, BannerPic will be used for the main window banner decoration
Window.UsePictureForBanner=True
#The main window banner
Window.BannerPic=logo.png
#If UsePictureForBanner is false this text will be displayed in large format
Window.BannerText=Do It!
#text for main button
Window.ExecuteButtonText=Do It
#"true" or "True" to enable
Audio.Enabled=true
Initial Document display
The Overview.txt is displayed to the user on launch. Anything contained within this file will be placed on the CASUAL main window
Overview.txt is located in the /SCRIPTS/ folder
optional adb_usb.ini
The adb_usb.ini is used to extend the functionality of ADB to un-natively supported devices. The adb_usb.ini file contains manufacturer's USB ids in hexadecimel format. Any lines specified in the adb_usb.ini and not present in the system's adb_usb.ini will be merged at the end of the system's adb_usb.ini
eg. for barnes and noble, the adb_usb.ini should look like this
0x2080
adb_usb.ini is located in the /SCRIPTS/ folder.
Script format
A CASUAL Script can stand alone and be selected from the file menu, or be zipped in the CASUAL /SCRIPTS/ folder.
About scripts
Each script consists of a .scr file, a .zip file, and a .txt file. The .txt file is displayed when the script is selected in the GUI. The .zip file is deployed to a unique temporary folder on the computer filesystem. The .scr controls the flow of the execution.
Script.txt
The Script.txt file is displayed to the user when it's script is selected from the GUI. It is used to inform the user of the intention of the script.
Script.zip
The Script.zip file contains any resources which are deployed to the device upon command by the Script.scr
Script.scr
The Script.scr file contains instructions which are read into the application at execution time and interperated by the CASUAL Language interperater.
CASUAL Language
The CASUAL language is designed to mimic the Linux shell in several ways. Below you will find a list of CASUAL commands.
Guide: SWLine Starts With, C Line Contains, "fields" in CASUAL Language are separated by comas.
Administrative Commands
Administrative Commands are not logged by CASUAL System Logger. They are simply executed.
SW: one or more spaces - Remove any leading spaces
SW: $HALT - stops the script entirely
SW: # - comments out the line and stops processing for this line
SW: Blank Line - take no action continue to next command
Scripting Commands
All scripting commands are logged by CASUAL System Logger
C: $SLASH: Replace $SLASH with the system file separator ("\" on Windows "/" on Linux/Mac)
C: $ZIPFILE: Replace $ZIPFILE with the path to the path to the uncompressed zipfile in the CASUAL system temp folder...
--push $ZIPFILEbusybox /data/local
SW: $ECHO: Remove leading spaces and echo any text on this line to the console.
--$ECHO Starting Procedures
SW: $ON:This is for flow control-- Remove any leading spaces, Action and Reaction is separated by coma. Action is pulled from the shell text received. Reaction is any CASUAL command.
Format: $ON Action, Reaction
--$ON File Not Found, $HALT
SW: $USERNOTIFICATION: Displays a notification popup window. First field is main-body text, second field is optional title. Default title will be "Information".
--$USERNOTIFICATION My Title text, My Textbox text
--$USERNOTIFICATION Here is some information
SW: $USERCANCELOPTION: Displays a $USERNOTIFICATION, however if the "Yes" button is pressed, the script will $HALT.
--$USERCANCELOPTION My Title Text, My Textbox text
$SW: $USERINPUTBOX: Functions like $USERNOTIFICAITON but with an input box. Will request text from the user and put it into a variable called $USERINPUT then execute a shell command
-- $USERINPUTBOX MyTitle, My text, shell echo $USERINPUT>>/sdcard/usertextfile.txt
Other Commands
Any other commands are prefixed with "adb". eg..
shell ls
reboot recovery
 
< Prev   Next >