⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
psa-pear
/
pear
/
tests
/
ingo
/
Ingo
/
Unit
/
View File Name :
ProcmailTest.php
* @author Michael Slusarz
* @category Horde * @copyright 2014-2016 Horde LLC * @ignore * @license http://www.horde.org/licenses/apache ASL * @package Ingo * @subpackage UnitTests */ class Ingo_Unit_ProcmailTest extends Ingo_Unit_TestBase { public function setUp() { parent::setUp(); $this->script = new Ingo_Script_Procmail(array( 'path_style' => 'mbox', 'skip' => array(), 'spam_compare' => 'string', 'spam_header' => 'X-Spam-Level', 'spam_char' => '*', 'storage' => $this->storage, 'transport' => array( Ingo::RULE_ALL => array( 'driver' => 'Null' ) ) )); } public function testForwardKeep() { $forward = new Ingo_Storage_Forward(); $forward->setForwardAddresses('joefabetes@example.com'); $forward->setForwardKeep(true); $this->storage->store($forward); $this->_enableRule(Ingo_Storage::ACTION_FORWARD); $this->_assertScript(':0 c { :0 *$ ! ^From *\/[^ ]+ *$ ! ^Sender: *\/[^ ]+ *$ ! ^From: *\/[^ ]+ *$ ! ^Reply-to: *\/[^ ]+ { OUTPUT = `formail -zxFrom:` } :0 E { OUTPUT = $MATCH } :0 c * !^FROM_MAILER * !^X-Loop: to-joefabetes@example.com | formail -A"X-Loop: to-joefabetes@example.com" | $SENDMAIL -oi -f $OUTPUT joefabetes@example.com :0 E $DEFAULT :0 /dev/null }'); } public function testForwardNoKeep() { $forward = new Ingo_Storage_Forward(); $forward->setForwardAddresses('joefabetes@example.com'); $forward->setForwardKeep(false); $this->storage->store($forward); $this->_enableRule(Ingo_Storage::ACTION_FORWARD); $this->_assertScript(':0 { :0 *$ ! ^From *\/[^ ]+ *$ ! ^Sender: *\/[^ ]+ *$ ! ^From: *\/[^ ]+ *$ ! ^Reply-to: *\/[^ ]+ { OUTPUT = `formail -zxFrom:` } :0 E { OUTPUT = $MATCH } :0 c * !^FROM_MAILER * !^X-Loop: to-joefabetes@example.com | formail -A"X-Loop: to-joefabetes@example.com" | $SENDMAIL -oi -f $OUTPUT joefabetes@example.com :0 E $DEFAULT :0 /dev/null }'); } public function testBlacklistWithFolder() { $bl = new Ingo_Storage_Blacklist(3); $bl->setBlacklist(array('spammer@example.com')); $bl->setBlacklistFolder('Junk'); $this->storage->store($bl); $this->_assertScript(':0 * ^From:(.*\<)?spammer@example\.com Junk'); } public function testBlacklistMarker() { $bl = new Ingo_Storage_Blacklist(3); $bl->setBlacklist(array('spammer@example.com')); $bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER); $this->storage->store($bl); $this->_assertScript(':0 * ^From:(.*\<)?spammer@example\.com ++DELETE++'); } public function testBlacklistDiscard() { $bl = new Ingo_Storage_Blacklist(3); $bl->setBlacklist(array('spammer@example.com')); $bl->setBlacklistFolder(null); $this->storage->store($bl); $this->_assertScript(':0 * ^From:(.*\<)?spammer@example\.com /dev/null'); } public function testWhitelist() { $wl = new Ingo_Storage_Whitelist(3); $wl->setWhitelist(array('spammer@example.com')); $this->storage->store($wl); $this->_assertScript(':0 * ^From:(.*\<)?spammer@example\.com $DEFAULT'); } public function testVacationDisabled() { $vacation = new Ingo_Storage_VacationTest(); $vacation->setVacationAddresses(array('from@example.com')); $vacation->setVacationSubject('Subject'); $vacation->setVacationReason("Because I don't like working!"); $this->storage->store($vacation); $this->_assertScript(''); } public function testVacationEnabled() { $vacation = new Ingo_Storage_VacationTest(); $vacation->setVacationAddresses(array('from@example.com')); $vacation->setVacationSubject('Subject'); $vacation->setVacationReason("Because I don't like working!"); $this->storage->store($vacation); $this->_enableRule(Ingo_Storage::ACTION_VACATION); $this->_assertScript(':0 { :0 * ^TO_from@example.com { DATE=`date +%s` FILEDATE=`test -f ${VACATION_DIR:-.}/\'.vacation.from@example.com\' && ls -lcn --time-style=+%s ${VACATION_DIR:-.}/\'.vacation.from@example.com\' | awk \'{ print $6 + (604800) }\'` DUMMY=`test -f ${VACATION_DIR:-.}/\'.vacation.from@example.com\' && test $FILEDATE -le $DATE && rm ${VACATION_DIR:-.}/\'.vacation.from@example.com\'` :0 h SUBJECT=| formail -xSubject: :0 Wc: ${VACATION_DIR:-.}/vacation.lock { :0 Wh * ^TO_from@example.com * !^X-Loop: from@example.com * !^X-Spam-Flag: YES * !^FROM_DAEMON | formail -rD 8192 ${VACATION_DIR:-.}/.vacation.from@example.com :0 eh | (formail -rI"Precedence: junk" \ -a"From:
" \ -A"X-Loop: from@example.com" \ -i"Subject: Subject (Re: $SUBJECT)" ; \ echo -e "Because I don\'t like working!" \ ) | $SENDMAIL -ffrom@example.com -oi -t :0 /dev/null } } }'); } }