Skip to content

Latest commit

 

History

History
594 lines (355 loc) · 13.1 KB

manual.pod

File metadata and controls

594 lines (355 loc) · 13.1 KB

NAME

mbank-cli - command-line interface to the on-line banking system of mBank

SYNOPSIS

  • mbank-cli [list] [option...]

  • mbank-cli history [option...] [--from start-date [--to end-date] ] [--with-id] [--export format] {account | -M account... | -A}

  • mbank-cli future [option...] {account | -M account... | -A}

  • mbank-cli blocked [option...] {account | -M account... | -A}

  • mbank-cli deposits [option...]

  • mbank-cli cards [option...]

  • mbank-cli funds [option...]

  • mbank-cli pension [option...]

  • mbank-cli notices [option...]

  • mbank-cli logout [option...]

  • mbank-cli register-device [option...] [device-name]

  • mbank-cli activate-profile [option...] {personal | business | company-name}

  • mbank-cli configure [option...]

DESCRIPTION

mbank-cli provides basic command-line interface to the online banking system of mBank.

It can use the following web interfaces:

Output format

Records are separated by newline (0x0A, LF) characters. Each line contains fields separated by tab (0x09, HT) characters.

All dates are in the YYYY-MM-DD format.

Common options

The following options are available for all commands:

--verbose

Display the debugging information.

--debug debug-directory

Save the debugging information (including dumps of downloaded pages) into debug-directory.

--config config-file

Use config-file as the configuration file.

The default is to use $XDG_CONFIG_HOME/mbank-cli/config (or $HOME/.config/mbank-cli/config).

Please consult the FILES section for the configuration file syntax.

Use cookie-jar-file as the session cookie store.

Please consult the FILES section for details.

--help

Show help message and exit.

--version

Show version information and exit.

Selecting accounts

Some commands (history, future, blocked) can act on one or more accounts. They can be selected in the following ways:

account-name (as a positional argument)

select a single account

-M, --multiple-accounts account...

select multiple accounts

-A, --all-accounts

select all accounts

The “*” character can be used as a wildcard character.

The “list” command

Syntax: mbank-cli [list] [option...]

For each account, print:

    account-name account-number balance avail-resources

Example:

$ mbank-cli
eKonto     03 1140 2004 0000 3902 0147 1002  4106.16 PLN  4082.79 PLN
izzyKonto  03 1140 2004 0000 3902 0147 1045  1684.32 PLN  1684.32 PLN
eMax       03 1140 2004 0000 3902 0147 3213  2436.98 PLN  2436.98 PLN
eMax EUR   03 1140 2004 0000 3902 0147 1002  2384.36 EUR  2384.36 EUR

The “history” command

Syntax: mbank-cli history [option...] [--from start-date [--to end-date] ] [--with-id] [--export format] {account | -M account... | -A}

Print the history of the selected account(s), in the following format:

    [account-name] [id] date accounting-date amount balance description

Newline characters in description are replaced by tab characters.

Time range can be selected with the following options:

--from start-date

Show operations since start-date.

--from start-date --to end-date

Show operations from start-date to end-date, inclusive.

Dates should be specified in the in the YYYY-MM-DD format.

The following options control the output format:

--with-id

Show operation identifiers (the id field).

Examples:

$ mbank-cli history eKonto
2010-08-01  2010-08-02  -10.00 PLN  4106.16 PLN  OPŁATA ZA PROWADZENIE RACHUNKU  WYPŁATY ZE WSZYSTKICH ATM
2010-08-01  2010-08-02  -22.00 PLN  4116.16 PLN  PODATEK OD ODSETEK KAPITAŁOWYCH
2010-08-01  2010-08-01  107.89 PLN  4138.16 PLN  KAPITALIZACJA ODSETEK
2010-07-30  2010-08-01   -5.00 PLN  4030.27 PLN  OPŁATA ZA MIES. ZESTAWIENIE OPER.

$ mbank-cli history eKonto --from 2006-06-01
[ history since 2006-06-01 ]

$ mbank-cli history eKonto --from 2005-01-01 --to 2005-12-31
[ history from 2006-06-01 to 2005-12-31 ]

As an alternative to the tabular format, it is possible to export history as CSV, HTML or PDF:

--export CSV
--export HTML
--export PDF

When the --export option is in effect, exactly one account must be selected. Also, the standard output must not be a terminal, but it should be redirected to a file.

Example:

$ mbank-cli history eKonto --from 2013-01-01 --to 2013-12-31 --export PDF eKonto > history-2013.pdf

The “future” command

Syntax: mbank-cli future [option...] {account | -M account... | -A}

Print the list of planned operations for the selected account(s), in the following format:

    [account-name] date recipient description amount status

Example:

$ mbank-cli future eMax
[ planned operations for the “eMax” account ]

The “blocked” command

Syntax: mbank-cli blocked [option...] {account | -M account... | -A}

Print the list of operations that were carried out but not booked, in the following format:

    [account-name] registration-date finalization-date amount description type

Example:

$ mbank-cli blocked eKonto
[ blocking operations for the “eKonto” account ]

The “deposits” command

Syntax: mbank-cli deposits [option...]

Print the list of time deposits, in the following format:

    deposit-name deposit-type establishment-date maturity-date term interest amount

Example:

$ mbank-cli deposits
Moja lokata  eMax lokata  2003-02-09  2004-02-09  12 miesięcy  4.00%  2500.00 PLN
mLokata      mLokata      2004-03-09  2004-05-09  2 miesiące   4.00%  1200.00 PLN

The “cards” command

Syntax: mbank-cli cards [option...]

Print the list of cards, in the following format:

    card-name card-number owner amount

Example:

$ mbank-cli cards
ELECTRON EKONTO  1111 **** **** 5772  JAN WIRTUALNY  4082.79 PLN
ELECTRON EMAX    1111 **** **** 2561  JAN WIRTUALNY  2436.98 PLN

The “funds” command

Syntax: mbank-cli funds [option...]

Print the list of investment funds, in the following format:

    fund-name amount [planned-amount]

Example:

$ mbank-cli funds
Noble Fund Mieszany  2318.22 PLN
PKO Akcji            2000.00 PLN  318.00 PLN

The “pension” command

Syntax: mbank-cli pension [option...]

Print the list of pension funds, in the following format:

    fund-name amount [planned-amount]

Example:

$ mbank-cli pension
IKE mOchrony Kapitału  15636.17 PLN

The “notices” command

Syntax: mbank-cli notices [option...]

Print the list of notices, in the following format:

    flag date title

flag is either “N” (for an unread notice) or an empty string (otherwise).

Example:

$ mbank-cli notices
   2010-08-07  Odrzucony przelew
N  2010-08-06  Odrzucone zlecenie nabycia FI

The “logout” command

Syntax: mbank-cli logout [option...]

Log out from the web interface.

The “register-device” command

Syntax: mbank-cli register-device [option...] [device-name]

Register mbank-cli as a trusted device. This should allow logging in without second-factor authentication requests most of the time.

The default device name is “CLI”.

The “activate-profile” command

Syntax: mbank-cli activate-profile {personal | business | company-name}

Activate the personal profile, or a business profile.

This is an experimental command. It is provided only a stop-gap solution until mbank-cli is taught to activate profiles automatically.

Examples:

$ mbank-cli activate-profile personal  # activate the personal profile
$ mbank-cli activate-profile business  # activate the business profile

The “configure” command

Create the configuration file interactively.

Example:

$ mbank-cli configure
Country (CZ, or SK, or PL): PL
Login: 12345678
Password: *************
Encrypt password with GnuPG (y/n)? y
Session cookie store: ~/.local/share/mbank-cli/12345678.cookies
Configuration file: ~/.config/mbank-cli/config

$ cat ~/.config/mbank-cli/config
CookieJar ~/.local/share/mbank-cli/12345678.cookies
Country PL
Login 12345678
# Password (encrypted):
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1

hIwDQI8Yo++6I7MBBACc44wKiYDUP7Ynw0PKbJuACSoXH96KL7a1O6o+442FfKb6
w7YAV1YJ3GVfdXM7AR5IFwdMG4N63NS6gEW5c9yXJmoITyzkQxBrI4BEgjmxeo3h
U1X4bdkUjHEaq99o0LvvbzvHSDydPsTC86MCfxD7H/ZaTysTYCLvc11n1RCs4NJK
AYkxMBHKq6mEZD9F1U0zJcUhrYXwq7a2krGhlgDDiyBq/Ls4dZpwOqbGNXFa7Klk
EQEJUNO3nxBIrY0T85/zmk8xk/W99IreWZ0=
=Kt9S
-----END PGP MESSAGE-----

EXIT STATUS

0

Success.

1

Failure caused by a user error.

2

Failure caused by an HTTP error. This may be due to a network error, but might as well be a result of a scraping error (see below).

3

Failure caused by an unexpected behaviour of the web interface (so called “scraping error”).

4

Failure caused by a system-related error or an I/O error.

255

Failure caused by an internal error.

ENVIRONMENT

MBANK_CLI_GPG

This variable defines the GnuPG command (possibly with arguments) that is used to encrypt or decrypt the configuration file. The default is “gpg”.

XDG_CONFIG_HOME

The variable defines the base directory relative to which user specific configuration files should be stored. If it is not set to an absolute path, $HOME/.config is used instead. Please consult the XDG Base Directory Specification for details.

This variable is used to determine default location of the configuration file.

XDG_DATA_HOME

The variable defines the base directory relative to which user-specific data files should be stored. If it is not set to an absolute path, $HOME/.local/share is used instead. Please consult the XDG Base Directory Specification for details.

The “configure” command uses this variable to choose location of the session cookie store.

LC_ALL, LC_CTYPE, LANG

These variables affect, amongst others, the interpretation of sequences of bytes as characters. LC_ALL overrides LC_CTYPE, which overrides LANG. Please consult locale(7) for details.

These variables are used to determine input and output encoding.

LC_*, LANG

The “configure” command uses the internationalization variables to guess the user's country.

FILES

Configuration file

By default, configuration is read from $XDG_CONFIG_HOME/mbank-cli/config (or $HOME/.config/mbank-cli/config). An alternative location can be specified with the --config option.

The configuration file is a simple text file. Empty lines are ignored. Lines starting with the “#” character are comments, and are ignored, too. The remaining lines are key-value pairs:

    CookieJar path

    Location of the session cookie store.

    Each mBank user must use a separate file. This is currently not enforced, and there is no protection against accidentally using another user's file.

    Country cc

    cc is a two-letter country code: CZ (Czech Republic), SK (Slovakia), or PL (Poland).

    Login login

    Password password

    PasswordManager command-line

    Command that should be run to retrieve the password. This can be used instead of "Password" to avoid storing the password in the configuration file.

Any part of the configuration file can be encrypted with GnuPG, and will be automatically decrypted when needed. It is recommended to encrypt only the password. This is what the “configure” command does.

Session cookies are stored on disk, so that subsequent invocations of the program can reuse existing session, instead of re-logging every time.

The file is not encrypted. If keeping unencrypted session cookies on disk is not desirable, set CookieJar to /dev/null in the configuration file.

BUGS

Please report bugs at the issue tracker.

SEE ALSO