Datei mit bestimmtem Namen und Inhalt generieren

Sub ErzeugeACME()
Dim Dateiname As String
Dim ZellenInhalt As String
Dim x As String
If MsgBox("Text inkl. Trennlinien aus Terminal kopieren!", vbOKCancel, "Copy from Terminal") = vbOK Then
Range("A1").Select
ActiveSheet.Paste
Dateiname = Range("B8").Value
ZellenInhalt = Range("A4").Value
x = "C:\Temp\.well-known\acme-challenge\" & Dateiname
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(x, True)
a.WriteLine (ZellenInhalt)
a.Close
MsgBox "In C:\Temp\.well-known\acme-challenge\ gespeichert!"
Else
MsgBox "Aktion abgebrochen"
End If
End Sub

Hostname und User-Agent prüfen, Bild von Webcam laden und mit Timestamp in Dateinamen in Unterordner speichern

<?php

$useragent = $_SERVER["HTTP_USER_AGENT"];
$ipaddress = $_SERVER["HTTP_X_REAL_IP"];
$hostname = gethostbyaddr($ipaddress);

if ((strpos($hostname, 'cable-xdsl.tld') !== false) and (strpos($useragent, 'Wget') !== false))
{
	$timestamp = date("Y-m-d_H-i-s");
	$url = "https://webcam.tld/full.jpg";
	$img = "./webcam/img_".$timestamp.".jpg";
	file_put_contents($img, file_get_contents($url));
	print "OK...action performed :-)";
}

else {
	echo 'Error...you are not permitted to perform this action :-(';
}

?>

Hostname prüfen und IP in .htaccess in Unterverzeichnis schreiben

<?php
$ipaddress = $_SERVER["HTTP_X_REAL_IP"];
$hostname = gethostbyaddr($ipaddress);
if (strpos($hostname, 'cable-xdsl.tld') !== false) {
$data2write1 = "order deny,allow\n";
$data2write2 = "deny from all\n";
$data2write3 = "allow from ".$ipaddress;
$subdir1 = fopen("./subdir1/.htaccess","w");
$subdir2 = fopen("./subdir2/.htaccess","w");
fwrite($subdir1, $data2write1);
fwrite($subdir1, $data2write2);
fwrite($subdir1, $data2write3);
fwrite($subdir2, $data2write1);
fwrite($subdir2, $data2write2);
fwrite($subdir2, $data2write3);
print "OK...data written :-)";
}
else {
echo 'Error...you are not permitted to perform this action :-(';
}
?>

Honeypot

honeypot.php

<?php
$timestamp = date("d.m.Y H:i:s");
$ip = $_SERVER["REMOTE_ADDR"];
$host = gethostbyaddr($_SERVER['HTTP_X_REAL_IP']);
$reqtype = $_SERVER['REQUEST_METHOD'];
$file = $_SERVER['REQUEST_URI'];
$browser = $_SERVER["HTTP_USER_AGENT"];

$filename="logging/logfile.txt";

$header = array("Timestamp", "IP", "Hostname", "RequestType", "File", "Browser");
$infos = array($timestamp, $ip, $host, $reqtype, $file, $browser);

$entry = implode("\t", $infos);

$write_header = !file_exists($filename);

$file=fopen($filename,"a");

if($write_header) {
$heading = implode("\t", $header);
fwrite($file, $heading."\n");
}

fwrite($file,$entry."\n");
fclose($file);
?>

xmlrpc.php / wp-login.php #1:

<?php include 'honeypot.php'; ?>