-
-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathmailinglist-decrypt.php
More file actions
33 lines (24 loc) · 790 Bytes
/
Copy pathmailinglist-decrypt.php
File metadata and controls
33 lines (24 loc) · 790 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
<?php
// ubsubscribe functionality. saves to a flat file.
// built by Jamie Kosoy (@jkosoy, jamie@arbitrary.io)
require_once('../config.php');
require_once(BASEDIR . '/subscribe/AES.class.php');
// gets the aes key.
$aesKeyFilePath = BASEDIR . '../mailinglist/aes-key.txt';
$fh = fopen($aesKeyFilePath, 'r');
$aesKey = fread($fh, filesize($aesKeyFilePath));
fclose($fh);
// set the aes block size.
$aesBlockSize = 256;
// where the mailing list text file is located.
$listFilePath = BASEDIR . '../mailinglist/list.txt';
$aes = new AES('', $aesKey, $aesBlockSize);
$fh = fopen($listFilePath, 'r');
while (($line = fgets($fh)) !== false) {
$aes->setData($line);
$email = $aes->decrypt();
error_log($email);
echo "$email<br />";
}
fclose($fh);
?>