~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2

[PATCH peanutbutter] added manpage

Details
Message ID
<20241202165124.101248-2-proycon@anaproy.nl>
DKIM signature
pass
Download raw message
Patch: +148 -16
---
Apply on top of all my earlier patches

 README.md               |  26 ++++----
 docs/peanutbutter.1.scd | 134 ++++++++++++++++++++++++++++++++++++++++
 src/main.rs             |   4 +-
 3 files changed, 148 insertions(+), 16 deletions(-)
 create mode 100644 docs/peanutbutter.1.scd

diff --git a/README.md b/README.md
index 4664363..a7816c1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Peanutbutter

A lock screen for linux mobile. Specially designed for Sxmo (sway edition).
A wayland screen locker for touch-based Linux mobile devices

## Usage

@@ -59,14 +59,6 @@ wait
peanutbutter &
```

## Debugging

If peanutbutter crashes, it will display a red screen.
To debug, run the following command in your terminal (on the phone):

`peanutbutter 2> /tmp/peanutbutter.log`

When peanutbutter crashes, ssh into your phone and check the `/tmp/peanutbutter.log` file for the error message.

# Controls

@@ -118,7 +110,7 @@ c d e f

By default, if a certain number of touches (10 by default) did not lead to a
successful unlock, then the locker will go into a deeper lock state and show
red a background. This is a time-out state during which the device can not be
a red background. This is a time-out state during which the device can not be
unlocked, it will time out after a number of seconds (20 by default) and go
back to normal lock mode. This is a security measure to prevent brute-force attacks.

@@ -126,11 +118,17 @@ The number of tries is configured via ``--tries``, the timeout (in seconds) via
You can set ``--paranoid`` to make the timeout double each time the deep lock state is reached, which 
may lead to the timeout being so long that you need to force a hard reboot.

# Safety
This program implements the `ext-session-lock-v1` protocol.
If `peanutbutter` inadvertently crashes, your information is not exposed.

This program uses: `ext-session-lock-v1`.
If `peanutbutter` crashes, your information is not exposed.
Try `pkill peanutbutter`.
## Debugging

If peanutbutter crashes, it will display a red screen.
To debug, run the following command in your terminal (on the phone):

`peanutbutter --debug 2> /tmp/peanutbutter.log`

When peanutbutter crashes, ssh into your phone and check the `/tmp/peanutbutter.log` file for the error message.

# TODO

diff --git a/docs/peanutbutter.1.scd b/docs/peanutbutter.1.scd
new file mode 100644
index 0000000..8d173b5
--- /dev/null
+++ b/docs/peanutbutter.1.scd
@@ -0,0 +1,134 @@
peanutbutter(1)

# NAME

peanutbutter - A wayland screen locker for touch-based Linux mobile devices

# SYNOPSIS

*peanutbutter* [options]

# DESCRIPTION

A lock screen for linux mobile. Specially designed for Sxmo (wayland edition).

# OPTIONS

*-d* / *--debug*
	Debug mode (allows quiting on any keypress) and prints verbose logging (insecure!)

*-T* / *--notouch*
	Disable touch support

*-F* / *--nofeedback*
	Disable touch feedback

*-f* / *--font* _font_
	Set font family

*-t* / *--tries* _tries_
	The number of incorrect touches allowed before the locker goes into a deeper lock (0 = unlimited, default = 10)

*-L* / *--deeplock* _seconds_
	Timeout in seconds for deeplock mode, during which the device can not be unlocked. (default = 20)

*-p* / *--paranoid*
	In paranoid mode, the deeplock timeout will be doubled every time it is reached, making successive attempts harder and harder.

*-1* 
	1x1 touch grid (insecure). See CONTROLS.

*-2*
	2x2 touch grid (1=topleft, 4=bottomright). See CONTROLS.

*-3*
	3x3 touch grid (1=topleft, 9=bottomright). See CONTROLS.

*-4*
	4x4 touch grid (0=topleft, f=bottomright). See CONTROLS.

*-s* / *--statuscommand* _command_
	Run this command for a status line, it should run continuously and each new output line will become the status line. This parameter should be the last parameter provided! Any further parameters will be passed to the command.

# CONTROLS

By default, the screen is segregated into 4 quadrants (resolution 2):

1. Top left
2. Top right
3. Bottom left 
4. Bottom right 

The passcode consists of any combination of these and is configured through the
environment variable *PEANUTBUTTER_PASSCODE* which takes a sequence of digits
to represent the quadrants, e.g. *1132* for top left, top left, bottom left,
top right. This happens to also be the default passcode if the environment
variable is not set.

There is no confirm or clear option. The passcode is checked after each touch
and stored in a stack with the exact length of the passcode. If you make a
mistake, simply start tapping the sequence anew.

A will be acknowledged by flipping the background, this provides only
provides a indication whether the touch was registered, not whether it is a
valid touch in the passcode sequence. The feedback will be over the entire screen
and will not specifically highlight the quadrant you tapped (as a security measure).

# SECURITY 

For extra security, visual feedback can be disabled entirely by passing the *-F*
or *--nofeedback* option.

Another way to increase security, is to set the parameter *-3* to change the
resolution to 3 (3x3 = 9 quadrants). Which takes the following configuration:

	1 2 3 

	4 5 6

	7 8 9

You can even go up to *-4*, which will give you this next configuration (4x4 =
16 quadrants):

	0 1 2 3 

	4 5 6 7

	8 9 a b

	c d e f

By default, if a certain number of touches (10 by default) did not lead to a
successful unlock, then the locker will go into a deeper lock state and show
a red background. This is a time-out state during which the device can not be
unlocked, it will time out after a number of seconds (20 by default) and go
back to normal lock mode. This is a security measure to prevent brute-force attacks.

The number of tries is configured via *--tries*, the timeout (in seconds) via *--deeplock*.
You can set *--paranoid* to make the timeout double each time the deep lock state is reached, which 
may lead to the timeout being so long that you need to force a hard reboot.

This program implements the `ext-session-lock-v1` protocol.
If peanutbutter inadvertently crashes, your information is not exposed.

# ENVIRONMENT

*PEANUTBUTTER_PASSCODE*
	The passcode to use, each character refers to a quadrant. See CONTROLS.

# AUTHORS

- Anjandev Momi <anjan@momi.ca>
- Maarten van Gompel <proycon@anaproy.nl>

# COPYRIGHT

Peanutbutter is licensed under the GNU Affero General Public License v3.

# SEE ALSO

_sxmo_(7)



diff --git a/src/main.rs b/src/main.rs
index c557527..3d7cf23 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -56,7 +56,7 @@ fn main() {
            "-h" | "--help" => {
                eprintln!("Options:");
                eprintln!(
                    " -d / --debug                    Debug mode (allows quiting on any keypress)"
                    " -d / --debug                    Debug mode (allows quiting on any keypress) and prints verbose logging (insecure!)"
                );
                eprintln!(" -T / --notouch                  Disable touch support");
                eprintln!(" -F / --nofeedback               Disable touch feedback");
@@ -74,7 +74,7 @@ fn main() {
                eprintln!(
                    " -4                              4x4 touch grid (0=topleft, f=bottomright)"
                );
                eprintln!(" -s / --statuscommand [command]  Run this command for a status line, it should run continuously and each new output line will become the status line. This parameter should be the last parameter provided.");
                eprintln!(" -s / --statuscommand [command]  Run this command for a status line, it should run continuously and each new output line will become the status line. This parameter should be the last parameter provided. Any further parameters will be passed to the command.");
                std::process::exit(0);
            }
            "-v" | "--version" => {
-- 
2.47.1
Details
Message ID
<D64FC08J4NP4.2RH9OHW1YBDVQ@momi.ca>
In-Reply-To
<20241202165124.101248-2-proycon@anaproy.nl> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~anjan/peanutbutter
   81d20ff..4e64b6e  main -> main
Details
Message ID
<D64FB6HTES32.1ATQ5TQTWWMOX@momi.ca>
In-Reply-To
<20241202165124.101248-2-proycon@anaproy.nl> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git@git.sr.ht:~anjan/peanutbutter
   81d20ff..4e64b6e  main -> main
Reply to thread Export thread (mbox)