Description: | Interpolate text files with variables through a fifo via user prompts. |
Latest Version: | 2017 |
Source Code: | src/ |
Architecture: |
|
Dependencies: |
|
Arch Repositories: |
|
AUR Page: | fipolate |
Arch Forum Thread: | 156444 |
Tags: |
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.
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.