fipolate

2022-07-15 12:40 UTC
  • Xyne

Metadata

Description: Interpolate text files with variables through a fifo via user prompts.
Latest Version: 2017
Source Code: src/
Architecture:
  • any
Dependencies:
  • python-pyinotify
  • python3
Arch Repositories:
  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]
AUR Page: fipolate
Arch Forum Thread: 156444
Tags:

About

Fipolate was written to deal with wpa_supplicant files containing passwords. Instead of writing a file with passwords to disk, a template file can be created with placeholder variables. Fipolate will read this file and prompt the user when it encounters variables in the file. It will then send the interpolated file to a named pipe (FIFO) through which it can be read by other applications as necessary.

Example

Fipolate uses a regular rexpression to determine variables in the input file. The default regular rexpression is

<%(\*)?(.+?)%>

The regular expression contains two capturing groups. The first is an indicator for password fields (“*“). The second is the variable name. The rest of the pattern is just a delimiter that should only appear around variables in the input file.

To make this clear, here is an example input file (input.txt):

network={
  ssid="cryptonet"
  key_mgmt=WPA-EAP
  eap=PEAP
  identity="<%identity%>"
  password="<%*password%>"
}

The two variables are identity and password. Both are delimited with <% and %>. The password is marked as a password prompt by the *, which is the first capturing group in the default regular expression.

$ fipolate tmp.fifo input.txt
identity: foo
password:

$ cat tmp.fifo
network={
  ssid="cryptonet"
  key_mgmt=WPA-EAP
  eap=PEAP
  identity="foo"
  password="supersecretpassword"
}

To use %%% as the delimiter on both sides and pass: as the password indicator, the regular expression would be:

%%%(pass:)?(.+?)%%%

The input file would then be

network={
  ssid="cryptonet"
  key_mgmt=WPA-EAP
  eap=PEAP
  identity="%%%identity%%%"
  password="%%%pass:password%%%"
}

The regular expression can always be chosen in a way to ensure that only the user-defined variables are interpolated in the input file.

TODO

  • Determine if it is possible to detect a waiting application on the other end of the pipe. This could be used to control writing instead of the interval option.

CHANGELOG

2013-02-12

  • added inotify event watching via pyinotify to track when other end of pipe is closes
  • removed unnecessary block and interval options
  • fixed bug in mode option
  • added FIFO checks to avoid problems in unexpected events such FIFO deletion while running
Contact
echo xyne.archlinux.org | sed 's/\./@/'
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0