WmConsole
Home Page
WmConsole is a console server
for Windows Mobile devices, that listen over BlueTooth RFCOMM channels,
and allows the user to interact with
the device using a command line interface from a Linux or Windows
workstation. Once the WmConsole
server is run, it'll listen on a configurable RFCOMM channel by waiting
for client connections. The server also creates a new
SDP service
called "WmConsole", and
advertises it as running onto its listening channel.
From the
client side, the QTTY
program has to be used to connect to the WmConsole server.
The QTTY software can be built for Linux
(needs the BlueZ package) and
Windows (needs the
Microsoft SDK - but a pre-built binary is also
supplied). Once
logged-in, the user will be able to access a thoruogh set of commands
to interact with the device (file upload/download, directory/tree
creation/removal, process creation with STDOUT redirection, process
kill, file search, registry manipulation/search, reboot, and many
others - the 'help'
command will list them all, together with a brief
description).
Since
Windows Mobile does not allow handle inheritance and standard
input/output redirection, a special device driver (RConsole) is used in order to
achieve binaries execution with output on the
console. The RConsole
device driver manages a
kernel pipe (ten actually - from 0 up to 9), and together with the SetStdioPathW() library call,
allows WmConsole to execute an
external binary by capturing its output on the console.
This came really handy to me, since it allowed the creation and usage
of simple command line utilities that where using standard POSIX stdio
output. The WmConsole
binary is installed inside
the "\Program Files\WmConsole" directory, and it must be manually run
using File Explorer. WmConsole
listen by default on the RFCOMM channel 11, but this can be changed
either by specifying the "-P CHNUM" command line parameter, or by
creating a registry string value named "Channel" inside the
"HKEY_LOCAL_MACHINE\SOFTWARE\WmConsole" key and by setting its value to
the desired one. The default username and password
for the WmConsole server are
user="wmconsole" and password="server". The "\Program
Files\WmConsole\passwd" file stores the usernames and passwords, that
you're suggested to change if you plan to keep the WmConsole server permanently running
on your device. Look at the QTTY
page
for instructions on how to use it to login into a WmConsole (or QConsole) server.
Commands
List
pwd
= Prints the current directory
cd
DIR
= Change current directory to DIR (.. is allowed)
ls
[DIR/FILE]
= Lists the current directory or the specified path
ps
= Lists currently running processes
lsmod
[MATCH]
= Lists modules loaded by processes whose name match MATCH
wld
MATCH
= Lists all processes that load modules matching MATCH
kill
PID
= Terminates the process identified by PID
run EXE
...
= Starts the exe with the specified parameters
exec EXE
...
= Starts the exe with the specified parameters and links to
the process standard output/input. This differs from the 'run'
command because it waits for the program termination
df
[DIR]
= Prints the disk space statistics for DIR (or object store
in case DIR is not specified
mem
= Displays memory usage statistics
lssvc
= Lists device services
svc -{S,T}
SVC =
Controls services functionality. Supported actions are:
S : Start service SVC
T : Stop service SVC
lsdev
= Lists system devices
mkdir [-p]
DIR =
Create directory DIR. Allowed flags for the command are:
p : Create all the intermediate directories, if missing
rmdir
DIR
= Remove directory DIR (must be empty)
rm
FILE
= Remove file FILE
mv OLD
NEW
= Renames files or directories from OLD to NEW
cp SRC
DST
= Copy SRC file onto DST file. If SRC is a directory, the whole
SRC tree will be copied
rmtree
DIR
= Remove directory DIR and all its subtree (dangerous)
chmod MODE
FILE =
Change the access mode of FILE applying MODE changes
([+-][hws]+ | h=hidden w=write s=system)
exit
= Exit session
shutdown
= Exit session and shutdown the WmConsole server
reboot
= Exit session and reboot the device
cat
FILE
= Dump the content of remote file FILE on screen
find [-1s] PATH
MATCH = Recursively searches PATH for MATCH
file or directory name
(wildcards allowed in MATCH). Allowed flags for the command are:
1 : Do not recurse inside subdirectories
s : Print only the file path
put [-Rf] REM
LOC = Copies the local
file(s) LOC to the remote file/path (on device) REM.
Wildcards allowed in LOC. Allowed flags for the command are:
R : Recurse to subdirectories
f : Forces the missing subdirectories creation on the device
get [-R] REM
LOC = Copies the
remote file(s) (on device) REM to local file/path LOC.
Wildcards allowed in REM. Allowed flags for the command are:
R : Recurse to subdirectories
rpwd
= Prints the current registry key
rcd
KEY
= Change current registry key to KEY (.. is allowed)
rls
[KEY/RVAL]
= Lists the current registry key or the specified KEY
rcat
RVAL
= Dump the content of registry path RVAL on screen
rfind KEY
MATCH =
Recursively searches KEY path for MATCH value or key name
rrm
RVAL
= Remove the registry value RVAL
rrmtree
KEY
= Remove the registry key KEY and all its subtree (dangerous)
rmkkey
KEY
= Creates the registry key KEY
rset RVAL TYPE
VALUE = Sets the registry value RVAL to
VALUE, with data type TYPE.
Allowed data types for the command are:
SZ : String value
DW : DWord value
BI : Binary value (VALUE is a sequence of 2 hexdigit numbers,
comma separated, like: 03,c2,fa,...)
rdig [-i] KEY TYPE
DATA = Recursively searches the KEY registry path for DATA
bytes. Allowed
data types for the command are:
SZ : String value
DW : DWord value
BI : Binary value (VALUE is a sequence of 2 hexdigit numbers,
comma separated, like: 03,c2,fa,...)
The DATA parameter format depends on the TYPE. Allowed
flags for the command are:
i : Ignore case during string match
rexp [-R] KEY/RVAL
FILE = Exports the registry value RVAL or key KEY, to the
file path FILE.
Allowed flags for the command are:
R : In case a registry key KEY is specified, exports the whole subtree
rimp
FILE
= Imports the registry file FILE into the device registry. New keys
will be created if missing, and existing values will be overwritten
help
= Prints this help screen
License
and Software
WmConsole
(and the RConsole device
driver) is made available through the GNU GPL license
together with the complete sources. The latest WmConsole packages are available
here :
Source 0.18