From c7c4d077688807bcbec21e11d0aeb0af9ebfbd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Mon, 21 Apr 2014 20:07:00 +0200 Subject: Source code taken from cacert-20140419.tar.bz2 --- scripts/send_heartbleed.php | 248 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 scripts/send_heartbleed.php (limited to 'scripts/send_heartbleed.php') diff --git a/scripts/send_heartbleed.php b/scripts/send_heartbleed.php new file mode 100644 index 0000000..6bf0f5f --- /dev/null +++ b/scripts/send_heartbleed.php @@ -0,0 +1,248 @@ +#!/usr/bin/php -q + '$lastid' + and a.`memid` = u.`id` + and a.`general` = 1 + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `domains` as d, `domaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`domid` = d.`id` and d.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `domains` as d, `domlink` as dl, `domaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`id` = dl.`certid` and dl.`domid` = d.`id` and d.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `org` as o, `orgdomaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`orgid` = o.`orgid` and o.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + union distinct + ( + select u.`id`, u.`fname`, u.`lname`, u.`email`, u.`language` + from `users` as u, `org` as o, `orgdomains` as d, `orgdomlink` as dl, `orgdomaincerts` as dc + where u.`deleted` = 0 and u.`id` > '$lastid' + and dc.`id` = dl.`orgcertid` and dl.`orgdomid` = d.`id` + and d.`orgid` = o.`orgid` and o.`memid` = u.`id` + and dc.`expire` >= '2011-12-01' + ) + order by `id`"; + +$res = mysql_query($query); + +while($row = mysql_fetch_assoc($res)) +{ + $mailtxt = "Dear ${row["fname"]} ${row["lname"]},\n".$lines_EN."\n\n"; + switch ($row["language"]) + { + case "de_DE": + case "de": + $mailtxt .= $lines_DE; + break; + } + + sendmail($row['email'], "[CAcert.org] Information about Heartbleed bug in OpenSSL 1.0.1 up to 1.0.1f", $mailtxt, "support@cacert.org", "", "", "CAcert", "returns@cacert.org", ""); + + $fp = fopen("send_heartbleed_lastid.txt", "w"); + fputs($fp, $row["id"]."\n"); + fclose($fp); + + $count++; + echo "Sent ${count}th mail. User ID: ${row["id"]}\n"; + + sleep (1); +} -- cgit v1.2.1