%PDF- %PDF-
Server IP : 79.170.40.229 / Your IP : 18.119.122.32 Web Server : Apache System : Linux web230.extendcp.co.uk 4.18.0-513.24.1.el8_9.x86_64 #1 SMP Mon Apr 8 11:23:13 EDT 2024 x86_64 User : 1stforcarhirealicante.com ( 296923) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/sbin/ |
Upload File : |
#!/usr/bin/perl use strict; use warnings; use HI::VAULT; use Data::Dumper; use constant ROOTNODE => 'black-book/'; my $BASEDIR = shift; my $sub = shift; die "Usage: $0 /path/to/output [childnode]\n" unless $BASEDIR; die "$BASEDIR is not a directory" unless -d $BASEDIR; my $vault = new HI::VAULT({ssl_opts => {SSL_verify_mode => 0, verify_hostname => 0}}); $vault->renew_token('60m'); if($sub) { recurse(ROOTNODE . $sub . '/'); } else { recurse(ROOTNODE); } sub recurse { my $dir = shift; my $fsdir = "$BASEDIR/$dir"; mkdir $fsdir unless -d $fsdir; my $nodes; my $blob = $vault->list_ref_from_uri($dir); if(ref $blob eq 'HASH') { #All good $nodes = $blob->{keys}; } else { #Something went wrong! Perhaps token expired or URL is malformed } for(@$nodes) { printf "%s%s\n", $dir, $_; if($_ =~ m#/$#) { #A directory, so keep recursing recurse($dir.$_); } else { #A file, so write the contents open my $fh, '>', "$fsdir/$_" or warn "Cannot open $fsdir/$_"; my $data = $vault->get_ref_from_uri($dir.$_); if(ref $data eq 'HASH') { #All good for(sort keys %$data) { printf $fh "\t%s => %s\n", $_, $data->{$_}; } } else { #Houston we have a problem print Dumper $data; } close $fh; } } }