-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathSCP.pl
More file actions
47 lines (33 loc) · 847 Bytes
/
SCP.pl
File metadata and controls
47 lines (33 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -U
use 5.010;
use IO::File;
use warnings;
use Data::Dumper;
use Net::OpenSSH;
use strict 'vars';
use Term::ANSIColor;
BEGIN:
my $Pass;
my @File =("signatures.cgi" , "Launcher.pl");
my $Path="/var/www/html/";
# Using password:
my $PasswdFile = IO::File->new("passwd.txt",'r') || die $!;
foreach my $File(@File){
print "\nUpdating $Path with $File file ...";
while (my $Reading = $PasswdFile->getline()) {
chomp($Reading);
$Pass=$Reading;
}
my $ssh = Net::OpenSSH->new(
'10.29.20.2',
user => 'kmkz',
password => $Pass,
strict_mode => 0,
ctl_dir => "/tmp/.libnet-openssh-perl",
);
$ssh->scp_put({glob => 1},$File,$Path )
or die colored "scp failed: " . $ssh->error,'bold red';
print colored("[OK]\n",'bold green');
}
say "\n[+] Repository is now up to date !\n";
__END__