Advertisement
Guest User

platypus

a guest
Mar 22nd, 2021
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.58 KB | None | 0 0
  1. use v5.32; use warnings;
  2. use FFI::Platypus;
  3.  
  4. my $ffi = FFI::Platypus->new(qw'api 1');
  5. $ffi->find_lib(qw'lib pwquality');
  6. $ffi->mangler(sub { 'pwquality_'.$_[0] });
  7. $ffi->attach(default_settings => [] => 'opaque');
  8. $ffi->attach(free_settings => [qw'opaque'] => 'void');
  9. $ffi->attach(check => [qw'opaque string string string opaque*'] => 'int');
  10. $ffi->attach(strerror => [qw'opaque size_t int opaque'] => 'string');
  11.  
  12. my $def = default_settings;
  13. say my $score = check($def, 'yourpass', (undef) x 2, \ my $err);
  14. say strerror(undef, 0, $score, $err) if $score < 0;
  15. free_settings($def);
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement