Generate a testing password via external program
This snippet shows how you can also call external applications and process their results.
# Quickly generate BCRYPT password via PHP
require "strings";
require "auto";
const C_TEST_PASSWORD string <= "test";
global expression string;
global exprlen int;
set expression <= "%2";
s_getlen "%expression" exprlen;
if (%exprlen, -ls, 3) {
set expression <= "%C_TEST_PASSWORD";
};
if ("%2", -eq, "--verbose") {
print "Generating password for: %expression";
};
function genenrate_password void()
{
local output string;
sys {php -r "echo password_hash('%expression', PASSWORD_BCRYPT);"} output;
print "%output";
aut_clpbsetstring "%output";
print "Copied to clipboard!";
};
call genenrate_password() => void;
if (%DNYAS_IS_INTERACTIVE_MODE, -eq, false) {
pause;
};