Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3624

Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
__construct()
instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3624

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573
CASUAL Commands and Variables | CASUAL-Dev
Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573
Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573
class="page page-id-48 page-template-default custom-background group-blog masthead-fixed singular">

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

CASUAL Commands and Variables


Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

CASUAL’s scripting language supports many commands, allowing for flexibility in script creation. These commands are listed below. Click on any command over on the right to jump to the appropriate section.

The CASUAL environment supports several environmental commands. Environmental commands change depending on the situation.

  • #comment

A comment is not interpreted at all by CASUAL. CASUAL disregards comments, except when processing $GOTO commands, in which case comments serve as markers in the script.

#This is a comment, it is not processed, but can be searched and $GOTO'd

  • ;;; command delimiter

The command delimiter allows for multiple commands to be chained together. If used in conjunction with the $IF(NOT)CONTAINS &&& operator, it will break the &&& chain and cause the command to execute after the $IF(NOT)CONTAINS chain ends.

$ECHO pushing ;;; $ADB push myfile /sdcard ;;; $ECHO done

  • $SLASH

The $SLASH provides a reference to pathname component separators, “\” on Windows and “/” on Linux or Mac. This is important because if you are creating a folder on the desktop and expect it to work on all systems, you want to use $SLASH rather than specifying a specific separator.

$MAKEDIR $HOMEFOLDER$SLASHnewFolder$SLASH

  • $ZIPFILE

The $ZIPFILE reference provides a way to access files contained within the script’s zip file.  These can be exploits, tools, or system images.

$ADB push $ZIPFILEexploit /data/local/tmp/exploit

  • $HOMEFOLDER

From time to time, you may require a place to store data permanently, rather than per-script.  Using $HOMEFOLDER you can specify a permanent storage location.  This location is dependent upon the system.

$ADB pull /system/build.prop $HOMEFOLDER$SLASHbuild.prop

  • $CASUALHOME

This is essentially the same as:

$HOMEFOLDER$SLASH.CASUAL$SLASH

  • $BUSYBOX

CASUAL has the ability to deploy and automatically reference BusyBox on any Android device. You simply specify that you would like to use BusyBox via the $BUSYBOX command, and CASUAL will take care of the rest.

$ADB shell "$BUSYBOX grep searchtext file | $BUSYBOX awk '{print $2 $1}'"
CASUAL provides flow control commands. These commands change the operation of CASUAL in real-time, allowing for loops and decision making.

  • $GOTO

$GOTO provides a way to jump to any #COMMENTed line in a CASUAL script. This allows for error correction or multiple device support in the same CASUAL.

$GOTO #Any commented line

  • $ON

The $ON command will react to CASUAL commands in real time.  As the input comes back from the commands, listed below in the Shell section, it is monitored for potential “actions.”  If an “action” is detected, a “reaction” will occur.  This is used by setting up an $ON event, and then executing any CASUAL shell command. The variable $LINE is used to detect the line which triggered the $ON command.

Syntax: $ON action , reaction

$ON UID=0, $ADB shell /data/local/tmp/executeRoot.sh
$ON UID=0, $ECHO detected $LINE performing root actions.

  • $CLEARON

The $CLEARON command removes the entire queue of $ON command actions and reactions.

$CLEARON

  • $IFCONTAINS

The $IFCONTAINS command allows testing the result of any CASUAL command and executing commands if the result contains a specified result. This command allows for chaining of itself or other CASUAL commands.

Syntax: $IFCONTAINS …. $INCOMMAND ..command.. $DO ..command..

true – $HALT will execute

$IFCONTAINS foo $INCOMMAND $ECHO foo $DO $HALT

false- $HALT will not execute

$IFCONTAINS foo $INCOMMAND $ECHO bar $DO $HALT

 

  • $IFNOTCONTAINS

The $IFNOTCONTAINS command allows to test the result of any CASUAL command and execute commands if the result does not contain a specified result. This command allows for chaining of itself or other CASUAL commands.

Syntax: $IFNOTCONTAINS …. $INCOMMAND ..command.. $DO ..command..

true $HALT will execute

$IFNOTCONTAINS foo $INCOMMAND $ECHO bar $DO $HALT

false – $HALT will not execute

$IFNOTCONTAINS foo $INCOMMAND $ECHO foo $DO $HALT

  • $IFCONTAINS and $IFNOTCONTAINS &&& operator

The &&& operator works with the $IFCONTAINS and $IFNOTCONTAINS commands, and upon sucessful completion of any $IF statement, all &&& commands following will be executed as though they were new commands. Since the “;;;” command delimiter operator has higher precedence, “;;;” will cause “&&&” to break out of its loop and “;;;” will denote a new command altogether.

$IFNOTCONTAINS foo $INCOMMAND $ECHO foo $DO $ECHO done &&& $ADB kill-server &&& $HALT

General CommandsGeneral commands fill in the gaps and provide methods not covered by other CASUAL commands.

  • $SLEEPMILLIS

$SLEEPMILLIS will pause script execution for a certain number of milliseconds. This can be useful when rebooting into recovery, as stock AOSP recovery does not run ADB, so the host side ADB is not capable of waiting for a device to reach recovery mode. Milliseconds are 1/1000th of a second each.

$SLEEPMILLIS 30500

The above would pause for thirty and one half seconds.

  • $SLEEP

$SLEEP works the same as $SLEEPMILLIS, but time is measured in seconds.

$SLEEP 3

  • $SENDLOG

The $SENDLOG command is used to send a log to Pastebin. This can be used to gather information about a device in the CASUAL log and paste it automatically.  Alternately, you may choose to use $SENDLOG chained to the $IFNOTCONTAINS command to detect errors and post a log.

$SENDLOG

  • $LISTDIR

The $LISTDIR command is used to perform a directory listing on a host computer folder. If you “adb pull” a folder and wish to parse the results, $LISTDIR returns the full path to each file on a separate line. This may be used with the $ON command.

$ON $ZIPFILE, $ADB install $LINE

  • $MAKEDIR

$MAKEDIR makes a folder on the host computer. This can be used to make a subfolder in the $CASUALHOME folder for permanent storage.

$MAKEDIR $CASUALHOME$SLASHmyNewFolder

  • $REMOVEDIR

$REMOVEDIR removes a folder and deletes all its contents recursively.

$REMOVEDIR $CASUALHOMEmyNewFolder

  • $DOWNLOAD

$DOWNLOAD allows you to download resources to the host computer. This is useful for getting the latest nightly builds out to your users. The user will see a percentage complete and the friendly name you specify.

Syntax: $DOWNLOAD from, to, friendly download name, Optional standard Linux MD5 command ouptut

$DOWNLOAD http://google.com/index.htm, $ZIPFILEindex.html, Google's home page, 8044d756b7f00b695ab8dce07dce43e5 index.html
$DOWNLOAD http://mysite.com/kernel.img, $ZIPFILEkernel.img, Latest kernel from me!

  • $BUILDPROP

$BUILDPROP pulls the /system/build.prop from the device and returns its contents. This will pull the build.prop from the device only once per script run. This speeds up the gathering of this commonly used information for commands such as $IFCONTAINS, which may be chained together multiple times to test information contained within the /system/build.prop.

$IFCONTAINS foo $INCOMMAND $BUILDPROP $DO $IFCONTAINS bar $INCOMMAND $BUILDPROP $DO $ECHO foo bar detected.

  • $ECHO

$ECHO displays text to CASUAL’s console

$ECHO This is some text in the console of CASUAL

Operating System-SpecificOperating system-specific commands will execute a command if it is running on the specified OS. These commands are intended to be chained and prefix any other CASUAL command. The general syntax for all operating system-specific commands is as follows:

$OperatingSystem $CASUALCommand

  • $WINDOWS

Executes if CASUAL is executing on Windows

  • $LINUX

Executes if CASUAL is executing on Linux

  • $MAC

Executes if CASUAL is executing on Mac.

  • $LINUXMAC

Since many Linux and Mac commands are identical, executes if CASUAL is executing on Linux or Mac

  • $LINUXWINDOWS

Executes if CASUAL is executing on Linux or Windows

  • $WINDOWSMAC

Executes if CASUAL is executing on Windows or Mac

Notification CommandsNotification commands will execute a notification. In general, these stop the flow of CASUAL script until the user acknowledges or performs some action. Any notification that allows you to put in a title and a message are delimited by the comma (“,”) or three less-than signs (“>>>”). The “title” will be used as the new window’s title bar text.

  • $COMMANDNOTIFICATION

$COMMANDNOTIFICATION performs an action and returns the result, which CASUAL provides back.

Syntax: $COMMANDNOTIFICATION $CASUALCOMMAND

$COMMANDNOTIFICATION $ADB cat /system/build.prop

  • $USERNOTIFICATION

$USERNOTIFICATION displays a basic Information dialog to the user. You can specify a title and a message.

$USERNOTIFICATION Title, Message

  • $USERCANCELOPTION

$USERCANCELOPTION allows the user to choose whether to continue or not. You can specify a title and a message. The user will receive two buttons: Continue and Stop.

$USERCANCELOPTION Title, Message

  • $ACTIONREQUIRED

$ACTIONREQUIRED notifies the user that they are to perform an action. You can specify title and message. The user will receive two buttons, “I did it” and “I didn’t do it.” Choosing the “I didn’t do it” button will halt the script.

$ACTIONREQUIRED Title, Message

  • $USERINPUTBOX

$USERINPUTBOX is a chain-able command. It requests input from the user and puts the text they entered into $USERINPUT. This may be useful for changing values in a script at runtime or specifying a custom value for a file.

Syntax: $USERINPUTBOX Title, Message, command $USERINPUT

$USERINPUTBOX Title, Message, $ADB shell "echo $USERINPUT > /sdcard/storedInput

 

ShellsThe following commands are parsed as shells.  CASUAL uses its own built-in command line preprocessor. This is important because the first layer of quotes will not be stripped by CASUAL, but by the operating system itself.  Because this is necessary on all platforms, it is recommended that when using embedded or escaped quotes, the outside layer should always be a double quote as the layer will be processed by the operating system. For example, $ADB shell “su -c ‘echo hi'” will work fine on all operating systems. However, reversing the single and double quotes like this: $ADB shell ‘su -c “echo hi”‘ will fail on Windows. This processor becomes active while using the following commands.

  • $ADB

ADB (Android Debug Bridge) is useful for pushing files, pulling files, installing applications, and performing Android shell commands. Please see the AOSP documentation for more information on ADB.

$ADB shell "su -c 'echo hi'"
$ADB push "$ZIPFILEexploit" "/data/local/tmp"

  • $FASTBOOT

$FASTBOOT is used for flashing firmware to any fastboot-capable device in bootloader mode. See the AOSP documentation for more information about fastboot.

$FASTBOOT boot "$ZIPFILErecovery.img"
$FASTBOOT flash recovery "$ZIPFILErecovery.img"

  • $HEIMDALL

$HEIMDALL is a tool used for flashing firmware on any Samsung Android device. See Heimdall’s website for more information.

$HEIMDALL close-pc-screen
$HEIMDALL flash RECOVERY "$ZIPFILErecovery.img"

  • $EXECUTE

$EXECUTE executes a command on the host computer. This is useful only with commands for the operating system upon which CASUAL is running, so the conditionals such as $LINUX or $WINDOWS should probably be used. For example, you may wish to execute a driver installer as a part of a script on Windows.

$WINDOWS $EXECUTE $ZIPFILEinstaller.exe
Share on Google+0Share on Facebook0Tweet about this on TwitterShare on Reddit0

3 thoughts on “CASUAL Commands and Variables”

Comments are closed.


Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

CASUAL Development


Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573

Notice: force_ssl_login is deprecated since version 4.4! Use force_ssl_admin() instead. in /var/www/vhosts/casual-dev.com/httpdocs/wp-includes/functions.php on line 3573