aboutsummaryrefslogtreecommitdiffstats
path: root/config/strikeback
diff options
context:
space:
mode:
authorTom Schaefer <tom@tomschaefer.org>2011-05-27 23:07:11 -0400
committerTom Schaefer <tom@tomschaefer.org>2011-05-27 23:07:11 -0400
commit0d0402fbfd69a2978d43e7551319ba970a2d77ef (patch)
tree005f8181ac8c5e7470441a8e4a3a19b0edabda42 /config/strikeback
parent51e31652e2c03e4de2c852cefc637bf394df359b (diff)
downloadpfsense-packages-0d0402fbfd69a2978d43e7551319ba970a2d77ef.tar.gz
pfsense-packages-0d0402fbfd69a2978d43e7551319ba970a2d77ef.tar.bz2
pfsense-packages-0d0402fbfd69a2978d43e7551319ba970a2d77ef.zip
Push strikeback package
Diffstat (limited to 'config/strikeback')
-rw-r--r--config/strikeback/class.phpmailer.tmp1909
-rw-r--r--config/strikeback/class.smtp.tmp1062
-rw-r--r--config/strikeback/email.tmp291
-rw-r--r--config/strikeback/execute.sh84
-rw-r--r--config/strikeback/firewall_shaper.tmp11
-rw-r--r--config/strikeback/help.tmp91
-rw-r--r--config/strikeback/index.tmp11
-rw-r--r--config/strikeback/iplog-2.2.3_3.tbzbin0 -> 37662 bytes
-rw-r--r--config/strikeback/jscolor.js840
-rw-r--r--config/strikeback/lua-5.1.4.tbzbin0 -> 241716 bytes
-rw-r--r--config/strikeback/nmap.tbzbin0 -> 2356550 bytes
-rw-r--r--config/strikeback/parse.tmp289
-rw-r--r--config/strikeback/pcre-8.02.tbzbin0 -> 609552 bytes
-rw-r--r--config/strikeback/pkg-config-0.23_1.tbzbin0 -> 51174 bytes
-rw-r--r--config/strikeback/settings.tmp337
-rw-r--r--config/strikeback/strikeback.db2
-rw-r--r--config/strikeback/strikeback.tmp364
-rw-r--r--config/strikeback/strikeback.xml165
18 files changed, 5456 insertions, 0 deletions
diff --git a/config/strikeback/class.phpmailer.tmp b/config/strikeback/class.phpmailer.tmp
new file mode 100644
index 00000000..c2cbba03
--- /dev/null
+++ b/config/strikeback/class.phpmailer.tmp
@@ -0,0 +1,1909 @@
+<?php
+/*~ class.phpmailer.php
+.---------------------------------------------------------------------------.
+| Software: PHPMailer - PHP email class |
+| Version: 2.0.4 |
+| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
+| Info: http://phpmailer.sourceforge.net |
+| Support: http://sourceforge.net/projects/phpmailer/ |
+| ------------------------------------------------------------------------- |
+| Author: Andy Prevost (project admininistrator) |
+| Author: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Copyright (c) 2001-2003, Brent R. Matzelle |
+| ------------------------------------------------------------------------- |
+| License: Distributed under the Lesser General Public License (LGPL) |
+| http://www.gnu.org/copyleft/lesser.html |
+| This program is distributed in the hope that it will be useful - WITHOUT |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
+| FITNESS FOR A PARTICULAR PURPOSE. |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com): |
+| - Web Hosting on highly optimized fast and secure servers |
+| - Technology Consulting |
+| - Oursourcing (highly qualified programmers and graphic designers) |
+'---------------------------------------------------------------------------'
+
+/**
+ * PHPMailer - PHP email transport class
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @copyright 2004 - 2009 Andy Prevost
+ */
+
+class PHPMailer {
+
+ /////////////////////////////////////////////////
+ // PROPERTIES, PUBLIC
+ /////////////////////////////////////////////////
+
+ /**
+ * Email priority (1 = High, 3 = Normal, 5 = low).
+ * @var int
+ */
+ var $Priority = 3;
+
+ /**
+ * Sets the CharSet of the message.
+ * @var string
+ */
+ var $CharSet = 'iso-8859-1';
+
+ /**
+ * Sets the Content-type of the message.
+ * @var string
+ */
+ var $ContentType = 'text/plain';
+
+ /**
+ * Sets the Encoding of the message. Options for this are "8bit",
+ * "7bit", "binary", "base64", and "quoted-printable".
+ * @var string
+ */
+ var $Encoding = '8bit';
+
+ /**
+ * Holds the most recent mailer error message.
+ * @var string
+ */
+ var $ErrorInfo = '';
+
+ /**
+ * Sets the From email address for the message.
+ * @var string
+ */
+ var $From = 'root@localhost';
+
+ /**
+ * Sets the From name of the message.
+ * @var string
+ */
+ var $FromName = 'Root User';
+
+ /**
+ * Sets the Sender email (Return-Path) of the message. If not empty,
+ * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+ * @var string
+ */
+ var $Sender = '';
+
+ /**
+ * Sets the Subject of the message.
+ * @var string
+ */
+ var $Subject = '';
+
+ /**
+ * Sets the Body of the message. This can be either an HTML or text body.
+ * If HTML then run IsHTML(true).
+ * @var string
+ */
+ var $Body = '';
+
+ /**
+ * Sets the text-only body of the message. This automatically sets the
+ * email to multipart/alternative. This body can be read by mail
+ * clients that do not have HTML email capability such as mutt. Clients
+ * that can read HTML will view the normal Body.
+ * @var string
+ */
+ var $AltBody = '';
+
+ /**
+ * Sets word wrapping on the body of the message to a given number of
+ * characters.
+ * @var int
+ */
+ var $WordWrap = 0;
+
+ /**
+ * Method to send mail: ("mail", "sendmail", or "smtp").
+ * @var string
+ */
+ var $Mailer = 'mail';
+
+ /**
+ * Sets the path of the sendmail program.
+ * @var string
+ */
+ var $Sendmail = '/usr/sbin/sendmail';
+
+ /**
+ * Path to PHPMailer plugins. This is now only useful if the SMTP class
+ * is in a different directory than the PHP include path.
+ * @var string
+ */
+ var $PluginDir = '';
+
+ /**
+ * Holds PHPMailer version.
+ * @var string
+ */
+ var $Version = "2.0.4";
+
+ /**
+ * Sets the email address that a reading confirmation will be sent.
+ * @var string
+ */
+ var $ConfirmReadingTo = '';
+
+ /**
+ * Sets the hostname to use in Message-Id and Received headers
+ * and as default HELO string. If empty, the value returned
+ * by SERVER_NAME is used or 'localhost.localdomain'.
+ * @var string
+ */
+ var $Hostname = '';
+
+ /**
+ * Sets the message ID to be used in the Message-Id header.
+ * If empty, a unique id will be generated.
+ * @var string
+ */
+ var $MessageID = '';
+
+ /////////////////////////////////////////////////
+ // PROPERTIES FOR SMTP
+ /////////////////////////////////////////////////
+
+ /**
+ * Sets the SMTP hosts. All hosts must be separated by a
+ * semicolon. You can also specify a different port
+ * for each host by using this format: [hostname:port]
+ * (e.g. "smtp1.example.com:25;smtp2.example.com").
+ * Hosts will be tried in order.
+ * @var string
+ */
+ var $Host = 'smtp.gmail.com';
+
+ /**
+ * Sets the default SMTP server port.
+ * @var int
+ */
+ var $Port = 465;
+
+ /**
+ * Sets the SMTP HELO of the message (Default is $Hostname).
+ * @var string
+ */
+ var $Helo = '';
+
+ /**
+ * Sets connection prefix.
+ * Options are "", "ssl" or "tls"
+ * @var string
+ */
+ var $SMTPSecure = "ssl";
+
+ /**
+ * Sets SMTP authentication. Utilizes the Username and Password variables.
+ * @var bool
+ */
+ var $SMTPAuth = false;
+
+ /**
+ * Sets SMTP username.
+ * @var string
+ */
+ var $Username = '';
+
+ /**
+ * Sets SMTP password.
+ * @var string
+ */
+ var $Password = '';
+
+ /**
+ * Sets the SMTP server timeout in seconds. This function will not
+ * work with the win32 version.
+ * @var int
+ */
+ var $Timeout = 10;
+
+ /**
+ * Sets SMTP class debugging on or off.
+ * @var bool
+ */
+ var $SMTPDebug = false;
+
+ /**
+ * Prevents the SMTP connection from being closed after each mail
+ * sending. If this is set to true then to close the connection
+ * requires an explicit call to SmtpClose().
+ * @var bool
+ */
+ var $SMTPKeepAlive = false;
+
+ /**
+ * Provides the ability to have the TO field process individual
+ * emails, instead of sending to entire TO addresses
+ * @var bool
+ */
+ var $SingleTo = false;
+
+ /////////////////////////////////////////////////
+ // PROPERTIES, PRIVATE
+ /////////////////////////////////////////////////
+
+ var $smtp = NULL;
+ var $to = array();
+ var $cc = array();
+ var $bcc = array();
+ var $ReplyTo = array();
+ var $attachment = array();
+ var $CustomHeader = array();
+ var $message_type = '';
+ var $boundary = array();
+ var $language = array();
+ var $error_count = 0;
+ var $LE = "\n";
+ var $sign_cert_file = "";
+ var $sign_key_file = "";
+ var $sign_key_pass = "";
+
+ /////////////////////////////////////////////////
+ // METHODS, VARIABLES
+ /////////////////////////////////////////////////
+
+ /**
+ * Sets message type to HTML.
+ * @param bool $bool
+ * @return void
+ */
+ function IsHTML($bool) {
+ if($bool == true) {
+ $this->ContentType = 'text/html';
+ } else {
+ $this->ContentType = 'text/plain';
+ }
+ }
+
+ /**
+ * Sets Mailer to send message using SMTP.
+ * @return void
+ */
+ function IsSMTP() {
+ $this->Mailer = 'smtp';
+ }
+
+ /**
+ * Sets Mailer to send message using PHP mail() function.
+ * @return void
+ */
+ function IsMail() {
+ $this->Mailer = 'mail';
+ }
+
+ /**
+ * Sets Mailer to send message using the $Sendmail program.
+ * @return void
+ */
+ function IsSendmail() {
+ $this->Mailer = 'sendmail';
+ }
+
+ /**
+ * Sets Mailer to send message using the qmail MTA.
+ * @return void
+ */
+ function IsQmail() {
+ $this->Sendmail = '/var/qmail/bin/sendmail';
+ $this->Mailer = 'sendmail';
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, RECIPIENTS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds a "To" address.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ function AddAddress($address, $name = '') {
+ $cur = count($this->to);
+ $this->to[$cur][0] = trim($address);
+ $this->to[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Cc" address. Note: this function works
+ * with the SMTP mailer on win32, not with the "mail"
+ * mailer.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ function AddCC($address, $name = '') {
+ $cur = count($this->cc);
+ $this->cc[$cur][0] = trim($address);
+ $this->cc[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Bcc" address. Note: this function works
+ * with the SMTP mailer on win32, not with the "mail"
+ * mailer.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ function AddBCC($address, $name = '') {
+ $cur = count($this->bcc);
+ $this->bcc[$cur][0] = trim($address);
+ $this->bcc[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Reply-To" address.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ function AddReplyTo($address, $name = '') {
+ $cur = count($this->ReplyTo);
+ $this->ReplyTo[$cur][0] = trim($address);
+ $this->ReplyTo[$cur][1] = $name;
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, MAIL SENDING
+ /////////////////////////////////////////////////
+
+ /**
+ * Creates message and assigns Mailer. If the message is
+ * not sent successfully then it returns false. Use the ErrorInfo
+ * variable to view description of the error.
+ * @return bool
+ */
+ function Send() {
+ $header = '';
+ $body = '';
+ $result = true;
+
+ if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
+ $this->SetError($this->Lang('provide_address'));
+ return false;
+ }
+
+ /* Set whether the message is multipart/alternative */
+ if(!empty($this->AltBody)) {
+ $this->ContentType = 'multipart/alternative';
+ }
+
+ $this->error_count = 0; // reset errors
+ $this->SetMessageType();
+ $header .= $this->CreateHeader();
+ $body = $this->CreateBody();
+
+ if($body == '') {
+ return false;
+ }
+
+ /* Choose the mailer */
+ switch($this->Mailer) {
+ case 'sendmail':
+ $result = $this->SendmailSend($header, $body);
+ break;
+ case 'smtp':
+ $result = $this->SmtpSend($header, $body);
+ break;
+ case 'mail':
+ $result = $this->MailSend($header, $body);
+ break;
+ default:
+ $result = $this->MailSend($header, $body);
+ break;
+ //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
+ //$result = false;
+ //break;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sends mail using the $Sendmail program.
+ * @access private
+ * @return bool
+ */
+ function SendmailSend($header, $body) {
+ if ($this->Sender != '') {
+ $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+ } else {
+ $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+ }
+
+ if(!@$mail = popen($sendmail, 'w')) {
+ $this->SetError($this->Lang('execute') . $this->Sendmail);
+ return false;
+ }
+
+ fputs($mail, $header);
+ fputs($mail, $body);
+
+ $result = pclose($mail);
+ if (version_compare(phpversion(), '4.2.3') == -1) {
+ $result = $result >> 8 & 0xFF;
+ }
+ if($result != 0) {
+ $this->SetError($this->Lang('execute') . $this->Sendmail);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends mail using the PHP mail() function.
+ * @access private
+ * @return bool
+ */
+ function MailSend($header, $body) {
+
+ $to = '';
+ for($i = 0; $i < count($this->to); $i++) {
+ if($i != 0) { $to .= ', '; }
+ $to .= $this->AddrFormat($this->to[$i]);
+ }
+
+ $toArr = split(',', $to);
+
+ $params = sprintf("-oi -f %s", $this->Sender);
+ if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
+ $old_from = ini_get('sendmail_from');
+ ini_set('sendmail_from', $this->Sender);
+ if ($this->SingleTo === true && count($toArr) > 1) {
+ foreach ($toArr as $key => $val) {
+ $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ if ($this->SingleTo === true && count($toArr) > 1) {
+ foreach ($toArr as $key => $val) {
+ $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
+ }
+ }
+
+ if (isset($old_from)) {
+ ini_set('sendmail_from', $old_from);
+ }
+
+ if(!$rt) {
+ $this->SetError($this->Lang('instantiate'));
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends mail via SMTP using PhpSMTP (Author:
+ * Chris Ryan). Returns bool. Returns false if there is a
+ * bad MAIL FROM, RCPT, or DATA input.
+ * @access private
+ * @return bool
+ */
+ function SmtpSend($header, $body) {
+ include_once($this->PluginDir . 'class.smtp.php');
+ $error = '';
+ $bad_rcpt = array();
+
+ if(!$this->SmtpConnect()) {
+ return false;
+ }
+
+ $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+ if(!$this->smtp->Mail($smtp_from)) {
+ $error = $this->Lang('from_failed') . $smtp_from;
+ $this->SetError($error);
+ $this->smtp->Reset();
+ return false;
+ }
+
+ /* Attempt to send attach all recipients */
+ for($i = 0; $i < count($this->to); $i++) {
+ if(!$this->smtp->Recipient($this->to[$i][0])) {
+ $bad_rcpt[] = $this->to[$i][0];
+ }
+ }
+ for($i = 0; $i < count($this->cc); $i++) {
+ if(!$this->smtp->Recipient($this->cc[$i][0])) {
+ $bad_rcpt[] = $this->cc[$i][0];
+ }
+ }
+ for($i = 0; $i < count($this->bcc); $i++) {
+ if(!$this->smtp->Recipient($this->bcc[$i][0])) {
+ $bad_rcpt[] = $this->bcc[$i][0];
+ }
+ }
+
+ if(count($bad_rcpt) > 0) { // Create error message
+ for($i = 0; $i < count($bad_rcpt); $i++) {
+ if($i != 0) {
+ $error .= ', ';
+ }
+ $error .= $bad_rcpt[$i];
+ }
+ $error = $this->Lang('recipients_failed') . $error;
+ $this->SetError($error);
+ $this->smtp->Reset();
+ return false;
+ }
+
+ if(!$this->smtp->Data($header . $body)) {
+ $this->SetError($this->Lang('data_not_accepted'));
+ $this->smtp->Reset();
+ return false;
+ }
+ if($this->SMTPKeepAlive == true) {
+ $this->smtp->Reset();
+ } else {
+ $this->SmtpClose();
+ }
+
+ return true;
+ }
+
+ /**
+ * Initiates a connection to an SMTP server. Returns false if the
+ * operation failed.
+ * @access private
+ * @return bool
+ */
+ function SmtpConnect() {
+ if($this->smtp == NULL) {
+ $this->smtp = new SMTP();
+ }
+
+ $this->smtp->do_debug = $this->SMTPDebug;
+ $hosts = explode(';', $this->Host);
+ $index = 0;
+ $connection = ($this->smtp->Connected());
+
+ /* Retry while there is no connection */
+ while($index < count($hosts) && $connection == false) {
+ $hostinfo = array();
+ if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+ $host = $hostinfo[1];
+ $port = $hostinfo[2];
+ } else {
+ $host = $hosts[$index];
+ $port = $this->Port;
+ }
+
+ if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
+ if ($this->Helo != '') {
+ $this->smtp->Hello($this->Helo);
+ } else {
+ $this->smtp->Hello($this->ServerHostname());
+ }
+
+ $connection = true;
+ if($this->SMTPAuth) {
+ if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
+ $this->SetError($this->Lang('authenticate'));
+ $this->smtp->Reset();
+ $connection = false;
+ }
+ }
+ }
+ $index++;
+ }
+ if(!$connection) {
+ $this->SetError($this->Lang('connect_host'));
+ }
+
+ return $connection;
+ }
+
+ /**
+ * Closes the active SMTP session if one exists.
+ * @return void
+ */
+ function SmtpClose() {
+ if($this->smtp != NULL) {
+ if($this->smtp->Connected()) {
+ $this->smtp->Quit();
+ $this->smtp->Close();
+ }
+ }
+ }
+
+ /**
+ * Sets the language for all class error messages. Returns false
+ * if it cannot load the language file. The default language type
+ * is English.
+ * @param string $lang_type Type of language (e.g. Portuguese: "br")
+ * @param string $lang_path Path to the language file directory
+ * @access public
+ * @return bool
+ */
+ function SetLanguage($lang_type, $lang_path = 'language/') {
+ if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
+ include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
+ } elseif (file_exists($lang_path.'phpmailer.lang-en.php')) {
+ include($lang_path.'phpmailer.lang-en.php');
+ } else {
+ $PHPMAILER_LANG = array();
+ $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
+ $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+ $PHPMAILER_LANG["execute"] = 'Could not execute: ';
+ $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
+ $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
+ $PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
+ $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
+ $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
+ $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
+ $PHPMAILER_LANG["file_access"] = 'Could not access file: ';
+ $PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
+ $PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+ $PHPMAILER_LANG["signing"] = 'Signing Error: ';
+ }
+ $this->language = $PHPMAILER_LANG;
+
+ return true;
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, MESSAGE CREATION
+ /////////////////////////////////////////////////
+
+ /**
+ * Creates recipient headers.
+ * @access private
+ * @return string
+ */
+ function AddrAppend($type, $addr) {
+ $addr_str = $type . ': ';
+ $addr_str .= $this->AddrFormat($addr[0]);
+ if(count($addr) > 1) {
+ for($i = 1; $i < count($addr); $i++) {
+ $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
+ }
+ }
+ $addr_str .= $this->LE;
+
+ return $addr_str;
+ }
+
+ /**
+ * Formats an address correctly.
+ * @access private
+ * @return string
+ */
+ function AddrFormat($addr) {
+ if(empty($addr[1])) {
+ $formatted = $this->SecureHeader($addr[0]);
+ } else {
+ $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
+ }
+
+ return $formatted;
+ }
+
+ /**
+ * Wraps message for use with mailers that do not
+ * automatically perform wrapping and for quoted-printable.
+ * Original written by philippe.
+ * @access private
+ * @return string
+ */
+ function WrapText($message, $length, $qp_mode = false) {
+ $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+ // If utf-8 encoding is used, we will need to make sure we don't
+ // split multibyte characters when we wrap
+ $is_utf8 = (strtolower($this->CharSet) == "utf-8");
+
+ $message = $this->FixEOL($message);
+ if (substr($message, -1) == $this->LE) {
+ $message = substr($message, 0, -1);
+ }
+
+ $line = explode($this->LE, $message);
+ $message = '';
+ for ($i=0 ;$i < count($line); $i++) {
+ $line_part = explode(' ', $line[$i]);
+ $buf = '';
+ for ($e = 0; $e<count($line_part); $e++) {
+ $word = $line_part[$e];
+ if ($qp_mode and (strlen($word) > $length)) {
+ $space_left = $length - strlen($buf) - 1;
+ if ($e != 0) {
+ if ($space_left > 20) {
+ $len = $space_left;
+ if ($is_utf8) {
+ $len = $this->UTF8CharBoundary($word, $len);
+ } elseif (substr($word, $len - 1, 1) == "=") {
+ $len--;
+ } elseif (substr($word, $len - 2, 1) == "=") {
+ $len -= 2;
+ }
+ $part = substr($word, 0, $len);
+ $word = substr($word, $len);
+ $buf .= ' ' . $part;
+ $message .= $buf . sprintf("=%s", $this->LE);
+ } else {
+ $message .= $buf . $soft_break;
+ }
+ $buf = '';
+ }
+ while (strlen($word) > 0) {
+ $len = $length;
+ if ($is_utf8) {
+ $len = $this->UTF8CharBoundary($word, $len);
+ } elseif (substr($word, $len - 1, 1) == "=") {
+ $len--;
+ } elseif (substr($word, $len - 2, 1) == "=") {
+ $len -= 2;
+ }
+ $part = substr($word, 0, $len);
+ $word = substr($word, $len);
+
+ if (strlen($word) > 0) {
+ $message .= $part . sprintf("=%s", $this->LE);
+ } else {
+ $buf = $part;
+ }
+ }
+ } else {
+ $buf_o = $buf;
+ $buf .= ($e == 0) ? $word : (' ' . $word);
+
+ if (strlen($buf) > $length and $buf_o != '') {
+ $message .= $buf_o . $soft_break;
+ $buf = $word;
+ }
+ }
+ }
+ $message .= $buf . $this->LE;
+ }
+
+ return $message;
+ }
+
+ /**
+ * Finds last character boundary prior to maxLength in a utf-8
+ * quoted (printable) encoded string.
+ * Original written by Colin Brown.
+ * @access private
+ * @param string $encodedText utf-8 QP text
+ * @param int $maxLength find last character boundary prior to this length
+ * @return int
+ */
+ function UTF8CharBoundary($encodedText, $maxLength) {
+ $foundSplitPos = false;
+ $lookBack = 3;
+ while (!$foundSplitPos) {
+ $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
+ $encodedCharPos = strpos($lastChunk, "=");
+ if ($encodedCharPos !== false) {
+ // Found start of encoded character byte within $lookBack block.
+ // Check the encoded byte value (the 2 chars after the '=')
+ $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
+ $dec = hexdec($hex);
+ if ($dec < 128) { // Single byte character.
+ // If the encoded char was found at pos 0, it will fit
+ // otherwise reduce maxLength to start of the encoded char
+ $maxLength = ($encodedCharPos == 0) ? $maxLength :
+ $maxLength - ($lookBack - $encodedCharPos);
+ $foundSplitPos = true;
+ } elseif ($dec >= 192) { // First byte of a multi byte character
+ // Reduce maxLength to split at start of character
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+ $foundSplitPos = true;
+ } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
+ $lookBack += 3;
+ }
+ } else {
+ // No encoded character found
+ $foundSplitPos = true;
+ }
+ }
+ return $maxLength;
+ }
+
+ /**
+ * Set the body wrapping.
+ * @access private
+ * @return void
+ */
+ function SetWordWrap() {
+ if($this->WordWrap < 1) {
+ return;
+ }
+
+ switch($this->message_type) {
+ case 'alt':
+ /* fall through */
+ case 'alt_attachments':
+ $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+ break;
+ default:
+ $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+ break;
+ }
+ }
+
+ /**
+ * Assembles message header.
+ * @access private
+ * @return string
+ */
+ function CreateHeader() {
+ $result = '';
+
+ /* Set the boundaries */
+ $uniq_id = md5(uniqid(time()));
+ $this->boundary[1] = 'b1_' . $uniq_id;
+ $this->boundary[2] = 'b2_' . $uniq_id;
+
+ $result .= $this->HeaderLine('Date', $this->RFCDate());
+ if($this->Sender == '') {
+ $result .= $this->HeaderLine('Return-Path', trim($this->From));
+ } else {
+ $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
+ }
+
+ /* To be created automatically by mail() */
+ if($this->Mailer != 'mail') {
+ if(count($this->to) > 0) {
+ $result .= $this->AddrAppend('To', $this->to);
+ } elseif (count($this->cc) == 0) {
+ $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
+ }
+ }
+
+ $from = array();
+ $from[0][0] = trim($this->From);
+ $from[0][1] = $this->FromName;
+ $result .= $this->AddrAppend('From', $from);
+
+ /* sendmail and mail() extract Cc from the header before sending */
+ if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
+ $result .= $this->AddrAppend('Cc', $this->cc);
+ }
+
+ /* sendmail and mail() extract Bcc from the header before sending */
+ if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
+ $result .= $this->AddrAppend('Bcc', $this->bcc);
+ }
+
+ if(count($this->ReplyTo) > 0) {
+ $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
+ }
+
+ /* mail() sets the subject itself */
+ if($this->Mailer != 'mail') {
+ $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
+ }
+
+ if($this->MessageID != '') {
+ $result .= $this->HeaderLine('Message-ID',$this->MessageID);
+ } else {
+ $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+ }
+ $result .= $this->HeaderLine('X-Priority', $this->Priority);
+ $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
+
+ if($this->ConfirmReadingTo != '') {
+ $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
+ }
+
+ // Add custom headers
+ for($index = 0; $index < count($this->CustomHeader); $index++) {
+ $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+ }
+ if (!$this->sign_key_file) {
+ $result .= $this->HeaderLine('MIME-Version', '1.0');
+ $result .= $this->GetMailMIME();
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns the message MIME.
+ * @access private
+ * @return string
+ */
+ function GetMailMIME() {
+ $result = '';
+ switch($this->message_type) {
+ case 'plain':
+ $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
+ $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
+ break;
+ case 'attachments':
+ /* fall through */
+ case 'alt_attachments':
+ if($this->InlineImageExists()){
+ $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
+ } else {
+ $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+ }
+ break;
+ case 'alt':
+ $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+ break;
+ }
+
+ if($this->Mailer != 'mail') {
+ $result .= $this->LE.$this->LE;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Assembles the message body. Returns an empty string on failure.
+ * @access private
+ * @return string
+ */
+ function CreateBody() {
+ $result = '';
+ if ($this->sign_key_file) {
+ $result .= $this->GetMailMIME();
+ }
+
+ $this->SetWordWrap();
+
+ switch($this->message_type) {
+ case 'alt':
+ $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+ $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->EndBoundary($this->boundary[1]);
+ break;
+ case 'plain':
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ break;
+ case 'attachments':
+ $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE;
+ $result .= $this->AttachAll();
+ break;
+ case 'alt_attachments':
+ $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+ $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
+ $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+ $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->EndBoundary($this->boundary[2]);
+ $result .= $this->AttachAll();
+ break;
+ }
+
+ if($this->IsError()) {
+ $result = '';
+ } else if ($this->sign_key_file) {
+ $file = tempnam("", "mail");
+ $fp = fopen($file, "w");
+ fwrite($fp, $result);
+ fclose($fp);
+ $signed = tempnam("", "signed");
+
+ if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_cert_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+ $fp = fopen($signed, "r");
+ $result = fread($fp, filesize($this->sign_key_file));
+ $result = '';
+ while(!feof($fp)){
+ $result = $result . fread($fp, 1024);
+ }
+ fclose($fp);
+ } else {
+ $this->SetError($this->Lang("signing").openssl_error_string());
+ $result = '';
+ }
+
+ unlink($file);
+ unlink($signed);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns the start of a message boundary.
+ * @access private
+ */
+ function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+ $result = '';
+ if($charSet == '') {
+ $charSet = $this->CharSet;
+ }
+ if($contentType == '') {
+ $contentType = $this->ContentType;
+ }
+ if($encoding == '') {
+ $encoding = $this->Encoding;
+ }
+ $result .= $this->TextLine('--' . $boundary);
+ $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
+ $result .= $this->LE;
+ $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
+ $result .= $this->LE;
+
+ return $result;
+ }
+
+ /**
+ * Returns the end of a message boundary.
+ * @access private
+ */
+ function EndBoundary($boundary) {
+ return $this->LE . '--' . $boundary . '--' . $this->LE;
+ }
+
+ /**
+ * Sets the message type.
+ * @access private
+ * @return void
+ */
+ function SetMessageType() {
+ if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+ $this->message_type = 'plain';
+ } else {
+ if(count($this->attachment) > 0) {
+ $this->message_type = 'attachments';
+ }
+ if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
+ $this->message_type = 'alt';
+ }
+ if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
+ $this->message_type = 'alt_attachments';
+ }
+ }
+ }
+
+ /* Returns a formatted header line.
+ * @access private
+ * @return string
+ */
+ function HeaderLine($name, $value) {
+ return $name . ': ' . $value . $this->LE;
+ }
+
+ /**
+ * Returns a formatted mail line.
+ * @access private
+ * @return string
+ */
+ function TextLine($value) {
+ return $value . $this->LE;
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, ATTACHMENTS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds an attachment from a path on the filesystem.
+ * Returns false if the file could not be found
+ * or accessed.
+ * @param string $path Path to the attachment.
+ * @param string $name Overrides the attachment name.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return bool
+ */
+ function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+ if(!@is_file($path)) {
+ $this->SetError($this->Lang('file_access') . $path);
+ return false;
+ }
+
+ $filename = basename($path);
+ if($name == '') {
+ $name = $filename;
+ }
+
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $path;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $name;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = false; // isStringAttachment
+ $this->attachment[$cur][6] = 'attachment';
+ $this->attachment[$cur][7] = 0;
+
+ return true;
+ }
+
+ /**
+ * Attaches all fs, string, and binary attachments to the message.
+ * Returns an empty string on failure.
+ * @access private
+ * @return string
+ */
+ function AttachAll() {
+ /* Return text of body */
+ $mime = array();
+
+ /* Add all attachments */
+ for($i = 0; $i < count($this->attachment); $i++) {
+ /* Check for string attachment */
+ $bString = $this->attachment[$i][5];
+ if ($bString) {
+ $string = $this->attachment[$i][0];
+ } else {
+ $path = $this->attachment[$i][0];
+ }
+
+ $filename = $this->attachment[$i][1];
+ $name = $this->attachment[$i][2];
+ $encoding = $this->attachment[$i][3];
+ $type = $this->attachment[$i][4];
+ $disposition = $this->attachment[$i][6];
+ $cid = $this->attachment[$i][7];
+
+ $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
+ $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $this->EncodeHeader($this->SecureHeader($name)), $this->LE);
+ $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
+
+ if($disposition == 'inline') {
+ $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+ }
+
+ $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $this->EncodeHeader($this->SecureHeader($name)), $this->LE.$this->LE);
+
+ /* Encode as string attachment */
+ if($bString) {
+ $mime[] = $this->EncodeString($string, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
+ } else {
+ $mime[] = $this->EncodeFile($path, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
+ }
+ }
+
+ $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+ return join('', $mime);
+ }
+
+ /**
+ * Encodes attachment in requested format. Returns an
+ * empty string on failure.
+ * @access private
+ * @return string
+ */
+ function EncodeFile ($path, $encoding = 'base64') {
+ if(!@$fd = fopen($path, 'rb')) {
+ $this->SetError($this->Lang('file_open') . $path);
+ return '';
+ }
+ $magic_quotes = get_magic_quotes_runtime();
+ set_magic_quotes_runtime(0);
+ $file_buffer = fread($fd, filesize($path));
+ $file_buffer = $this->EncodeString($file_buffer, $encoding);
+ fclose($fd);
+ set_magic_quotes_runtime($magic_quotes);
+
+ return $file_buffer;
+ }
+
+ /**
+ * Encodes string to requested format. Returns an
+ * empty string on failure.
+ * @access private
+ * @return string
+ */
+ function EncodeString ($str, $encoding = 'base64') {
+ $encoded = '';
+ switch(strtolower($encoding)) {
+ case 'base64':
+ /* chunk_split is found in PHP >= 3.0.6 */
+ $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+ break;
+ case '7bit':
+ case '8bit':
+ $encoded = $this->FixEOL($str);
+ if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+ $encoded .= $this->LE;
+ break;
+ case 'binary':
+ $encoded = $str;
+ break;
+ case 'quoted-printable':
+ $encoded = $this->EncodeQP($str);
+ break;
+ default:
+ $this->SetError($this->Lang('encoding') . $encoding);
+ break;
+ }
+ return $encoded;
+ }
+
+ /**
+ * Encode a header string to best of Q, B, quoted or none.
+ * @access private
+ * @return string
+ */
+ function EncodeHeader ($str, $position = 'text') {
+ $x = 0;
+
+ switch (strtolower($position)) {
+ case 'phrase':
+ if (!preg_match('/[\200-\377]/', $str)) {
+ /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
+ $encoded = addcslashes($str, "\0..\37\177\\\"");
+ if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+ return ($encoded);
+ } else {
+ return ("\"$encoded\"");
+ }
+ }
+ $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+ break;
+ case 'comment':
+ $x = preg_match_all('/[()"]/', $str, $matches);
+ /* Fall-through */
+ case 'text':
+ default:
+ $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+ break;
+ }
+
+ if ($x == 0) {
+ return ($str);
+ }
+
+ $maxlen = 75 - 7 - strlen($this->CharSet);
+ /* Try to select the encoding which should produce the shortest output */
+ if (strlen($str)/3 < $x) {
+ $encoding = 'B';
+ if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
+ // Use a custom function which correctly encodes and wraps long
+ // multibyte strings without breaking lines within a character
+ $encoded = $this->Base64EncodeWrapMB($str);
+ } else {
+ $encoded = base64_encode($str);
+ $maxlen -= $maxlen % 4;
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+ }
+ } else {
+ $encoding = 'Q';
+ $encoded = $this->EncodeQ($str, $position);
+ $encoded = $this->WrapText($encoded, $maxlen, true);
+ $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
+ }
+
+ $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+ $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+ return $encoded;
+ }
+
+ /**
+ * Checks if a string contains multibyte characters.
+ * @access private
+ * @param string $str multi-byte text to wrap encode
+ * @return bool
+ */
+ function HasMultiBytes($str) {
+ if (function_exists('mb_strlen')) {
+ return (strlen($str) > mb_strlen($str, $this->CharSet));
+ } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
+ return False;
+ }
+ }
+
+ /**
+ * Correctly encodes and wraps long multibyte strings for mail headers
+ * without breaking lines within a character.
+ * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
+ * @access private
+ * @param string $str multi-byte text to wrap encode
+ * @return string
+ */
+ function Base64EncodeWrapMB($str) {
+ $start = "=?".$this->CharSet."?B?";
+ $end = "?=";
+ $encoded = "";
+
+ $mb_length = mb_strlen($str, $this->CharSet);
+ // Each line must have length <= 75, including $start and $end
+ $length = 75 - strlen($start) - strlen($end);
+ // Average multi-byte ratio
+ $ratio = $mb_length / strlen($str);
+ // Base64 has a 4:3 ratio
+ $offset = $avgLength = floor($length * $ratio * .75);
+
+ for ($i = 0; $i < $mb_length; $i += $offset) {
+ $lookBack = 0;
+
+ do {
+ $offset = $avgLength - $lookBack;
+ $chunk = mb_substr($str, $i, $offset, $this->CharSet);
+ $chunk = base64_encode($chunk);
+ $lookBack++;
+ }
+ while (strlen($chunk) > $length);
+
+ $encoded .= $chunk . $this->LE;
+ }
+
+ // Chomp the last linefeed
+ $encoded = substr($encoded, 0, -strlen($this->LE));
+ return $encoded;
+ }
+
+ /**
+ * Encode string to quoted-printable.
+ * @access private
+ * @return string
+ */
+ function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+ $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+ $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
+ $eol = "\r\n";
+ $escape = '=';
+ $output = '';
+ while( list(, $line) = each($lines) ) {
+ $linlen = strlen($line);
+ $newline = '';
+ for($i = 0; $i < $linlen; $i++) {
+ $c = substr( $line, $i, 1 );
+ $dec = ord( $c );
+ if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
+ $c = '=2E';
+ }
+ if ( $dec == 32 ) {
+ if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
+ $c = '=20';
+ } else if ( $space_conv ) {
+ $c = '=20';
+ }
+ } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
+ $h2 = floor($dec/16);
+ $h1 = floor($dec%16);
+ $c = $escape.$hex[$h2].$hex[$h1];
+ }
+ if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+ $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
+ $newline = '';
+ // check if newline first character will be point or not
+ if ( $dec == 46 ) {
+ $c = '=2E';
+ }
+ }
+ $newline .= $c;
+ } // end of for
+ $output .= $newline.$eol;
+ } // end of while
+ return $output;
+ }
+
+ /**
+ * Encode string to q encoding.
+ * @access private
+ * @return string
+ */
+ function EncodeQ ($str, $position = 'text') {
+ /* There should not be any EOL in the string */
+ $encoded = preg_replace("[\r\n]", '', $str);
+
+ switch (strtolower($position)) {
+ case 'phrase':
+ $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ break;
+ case 'comment':
+ $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ case 'text':
+ default:
+ /* Replace every high ascii, control =, ? and _ characters */
+ $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
+ "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ break;
+ }
+
+ /* Replace every spaces to _ (more readable than =20) */
+ $encoded = str_replace(' ', '_', $encoded);
+
+ return $encoded;
+ }
+
+ /**
+ * Adds a string or binary attachment (non-filesystem) to the list.
+ * This method can be used to attach ascii or binary data,
+ * such as a BLOB record from a database.
+ * @param string $string String attachment data.
+ * @param string $filename Name of the attachment.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return void
+ */
+ function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
+ /* Append to $attachment array */
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $string;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $filename;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = true; // isString
+ $this->attachment[$cur][6] = 'attachment';
+ $this->attachment[$cur][7] = 0;
+ }
+
+ /**
+ * Adds an embedded attachment. This can include images, sounds, and
+ * just about any other document. Make sure to set the $type to an
+ * image type. For JPEG images use "image/jpeg" and for GIF images
+ * use "image/gif".
+ * @param string $path Path to the attachment.
+ * @param string $cid Content ID of the attachment. Use this to identify
+ * the Id for accessing the image in an HTML form.
+ * @param string $name Overrides the attachment name.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return bool
+ */
+ function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+
+ if(!@is_file($path)) {
+ $this->SetError($this->Lang('file_access') . $path);
+ return false;
+ }
+
+ $filename = basename($path);
+ if($name == '') {
+ $name = $filename;
+ }
+
+ /* Append to $attachment array */
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $path;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $name;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = false;
+ $this->attachment[$cur][6] = 'inline';
+ $this->attachment[$cur][7] = $cid;
+
+ return true;
+ }
+
+ /**
+ * Returns true if an inline attachment is present.
+ * @access private
+ * @return bool
+ */
+ function InlineImageExists() {
+ $result = false;
+ for($i = 0; $i < count($this->attachment); $i++) {
+ if($this->attachment[$i][6] == 'inline') {
+ $result = true;
+ break;
+ }
+ }
+
+ return $result;
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, MESSAGE RESET
+ /////////////////////////////////////////////////
+
+ /**
+ * Clears all recipients assigned in the TO array. Returns void.
+ * @return void
+ */
+ function ClearAddresses() {
+ $this->to = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the CC array. Returns void.
+ * @return void
+ */
+ function ClearCCs() {
+ $this->cc = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the BCC array. Returns void.
+ * @return void
+ */
+ function ClearBCCs() {
+ $this->bcc = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the ReplyTo array. Returns void.
+ * @return void
+ */
+ function ClearReplyTos() {
+ $this->ReplyTo = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the TO, CC and BCC
+ * array. Returns void.
+ * @return void
+ */
+ function ClearAllRecipients() {
+ $this->to = array();
+ $this->cc = array();
+ $this->bcc = array();
+ }
+
+ /**
+ * Clears all previously set filesystem, string, and binary
+ * attachments. Returns void.
+ * @return void
+ */
+ function ClearAttachments() {
+ $this->attachment = array();
+ }
+
+ /**
+ * Clears all custom headers. Returns void.
+ * @return void
+ */
+ function ClearCustomHeaders() {
+ $this->CustomHeader = array();
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, MISCELLANEOUS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds the error message to the error container.
+ * Returns void.
+ * @access private
+ * @return void
+ */
+ function SetError($msg) {
+ $this->error_count++;
+ $this->ErrorInfo = $msg;
+ }
+
+ /**
+ * Returns the proper RFC 822 formatted date.
+ * @access private
+ * @return string
+ */
+ function RFCDate() {
+ $tz = date('Z');
+ $tzs = ($tz < 0) ? '-' : '+';
+ $tz = abs($tz);
+ $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
+ $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
+
+ return $result;
+ }
+
+ /**
+ * Returns the appropriate server variable. Should work with both
+ * PHP 4.1.0+ as well as older versions. Returns an empty string
+ * if nothing is found.
+ * @access private
+ * @return mixed
+ */
+ function ServerVar($varName) {
+ global $HTTP_SERVER_VARS;
+ global $HTTP_ENV_VARS;
+
+ if(!isset($_SERVER)) {
+ $_SERVER = $HTTP_SERVER_VARS;
+ if(!isset($_SERVER['REMOTE_ADDR'])) {
+ $_SERVER = $HTTP_ENV_VARS; // must be Apache
+ }
+ }
+
+ if(isset($_SERVER[$varName])) {
+ return $_SERVER[$varName];
+ } else {
+ return '';
+ }
+ }
+
+ /**
+ * Returns the server hostname or 'localhost.localdomain' if unknown.
+ * @access private
+ * @return string
+ */
+ function ServerHostname() {
+ if ($this->Hostname != '') {
+ $result = $this->Hostname;
+ } elseif ($this->ServerVar('SERVER_NAME') != '') {
+ $result = $this->ServerVar('SERVER_NAME');
+ } else {
+ $result = 'localhost.localdomain';
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns a message in the appropriate language.
+ * @access private
+ * @return string
+ */
+ function Lang($key) {
+ if(count($this->language) < 1) {
+ $this->SetLanguage('en'); // set the default language
+ }
+
+ if(isset($this->language[$key])) {
+ return $this->language[$key];
+ } else {
+ return 'Language string failed to load: ' . $key;
+ }
+ }
+
+ /**
+ * Returns true if an error occurred.
+ * @return bool
+ */
+ function IsError() {
+ return ($this->error_count > 0);
+ }
+
+ /**
+ * Changes every end of line from CR or LF to CRLF.
+ * @access private
+ * @return string
+ */
+ function FixEOL($str) {
+ $str = str_replace("\r\n", "\n", $str);
+ $str = str_replace("\r", "\n", $str);
+ $str = str_replace("\n", $this->LE, $str);
+ return $str;
+ }
+
+ /**
+ * Adds a custom header.
+ * @return void
+ */
+ function AddCustomHeader($custom_header) {
+ $this->CustomHeader[] = explode(':', $custom_header, 2);
+ }
+
+ /**
+ * Evaluates the message and returns modifications for inline images and backgrounds
+ * @access public
+ * @return $message
+ */
+ function MsgHTML($message,$basedir='') {
+ preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
+ if(isset($images[2])) {
+ foreach($images[2] as $i => $url) {
+ // do not change urls for absolute images (thanks to corvuscorax)
+ if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+ $filename = basename($url);
+ $directory = dirname($url);
+ ($directory == '.')?$directory='':'';
+ $cid = 'cid:' . md5($filename);
+ $fileParts = split("\.", $filename);
+ $ext = $fileParts[1];
+ $mimeType = $this->_mime_types($ext);
+ if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
+ if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
+ if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
+ $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
+ }
+ }
+ }
+ }
+ $this->IsHTML(true);
+ $this->Body = $message;
+ $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
+ if ( !empty($textMsg) && empty($this->AltBody) ) {
+ $this->AltBody = html_entity_decode($textMsg);
+ }
+ if ( empty($this->AltBody) ) {
+ $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+ }
+ }
+
+ /**
+ * Gets the mime type of the embedded or inline image
+ * @access private
+ * @return mime type of ext
+ */
+ function _mime_types($ext = '') {
+ $mimes = array(
+ 'ai' => 'application/postscript',
+ 'aif' => 'audio/x-aiff',
+ 'aifc' => 'audio/x-aiff',
+ 'aiff' => 'audio/x-aiff',
+ 'avi' => 'video/x-msvideo',
+ 'bin' => 'application/macbinary',
+ 'bmp' => 'image/bmp',
+ 'class' => 'application/octet-stream',
+ 'cpt' => 'application/mac-compactpro',
+ 'css' => 'text/css',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dll' => 'application/octet-stream',
+ 'dms' => 'application/octet-stream',
+ 'doc' => 'application/msword',
+ 'dvi' => 'application/x-dvi',
+ 'dxr' => 'application/x-director',
+ 'eml' => 'message/rfc822',
+ 'eps' => 'application/postscript',
+ 'exe' => 'application/octet-stream',
+ 'gif' => 'image/gif',
+ 'gtar' => 'application/x-gtar',
+ 'htm' => 'text/html',
+ 'html' => 'text/html',
+ 'jpe' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'hqx' => 'application/mac-binhex40',
+ 'js' => 'application/x-javascript',
+ 'lha' => 'application/octet-stream',
+ 'log' => 'text/plain',
+ 'lzh' => 'application/octet-stream',
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mif' => 'application/vnd.mif',
+ 'mov' => 'video/quicktime',
+ 'movie' => 'video/x-sgi-movie',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => 'audio/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpga' => 'audio/mpeg',
+ 'oda' => 'application/oda',
+ 'pdf' => 'application/pdf',
+ 'php' => 'application/x-httpd-php',
+ 'php3' => 'application/x-httpd-php',
+ 'php4' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'phtml' => 'application/x-httpd-php',
+ 'png' => 'image/png',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ 'ps' => 'application/postscript',
+ 'psd' => 'application/octet-stream',
+ 'qt' => 'video/quicktime',
+ 'ra' => 'audio/x-realaudio',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'rtf' => 'text/rtf',
+ 'rtx' => 'text/richtext',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'sea' => 'application/octet-stream',
+ 'shtml' => 'text/html',
+ 'sit' => 'application/x-stuffit',
+ 'so' => 'application/octet-stream',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'swf' => 'application/x-shockwave-flash',
+ 'tar' => 'application/x-tar',
+ 'text' => 'text/plain',
+ 'txt' => 'text/plain',
+ 'tgz' => 'application/x-tar',
+ 'tif' => 'image/tiff',
+ 'tiff' => 'image/tiff',
+ 'wav' => 'audio/x-wav',
+ 'wbxml' => 'application/vnd.wap.wbxml',
+ 'wmlc' => 'application/vnd.wap.wmlc',
+ 'word' => 'application/msword',
+ 'xht' => 'application/xhtml+xml',
+ 'xhtml' => 'application/xhtml+xml',
+ 'xl' => 'application/excel',
+ 'xls' => 'application/vnd.ms-excel',
+ 'xml' => 'text/xml',
+ 'xsl' => 'text/xml',
+ 'zip' => 'application/zip'
+ );
+ return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
+ }
+
+ /**
+ * Set (or reset) Class Objects (variables)
+ *
+ * Usage Example:
+ * $page->set('X-Priority', '3');
+ *
+ * @access public
+ * @param string $name Parameter Name
+ * @param mixed $value Parameter Value
+ * NOTE: will not work with arrays, there are no arrays to set/reset
+ */
+ function set ( $name, $value = '' ) {
+ if ( isset($this->$name) ) {
+ $this->$name = $value;
+ } else {
+ $this->SetError('Cannot set or reset variable ' . $name);
+ return false;
+ }
+ }
+
+ /**
+ * Read a file from a supplied filename and return it.
+ *
+ * @access public
+ * @param string $filename Parameter File Name
+ */
+ function getFile($filename) {
+ $return = '';
+ if ($fp = fopen($filename, 'rb')) {
+ while (!feof($fp)) {
+ $return .= fread($fp, 1024);
+ }
+ fclose($fp);
+ return $return;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Strips newlines to prevent header injection.
+ * @access private
+ * @param string $str String
+ * @return string
+ */
+ function SecureHeader($str) {
+ $str = trim($str);
+ $str = str_replace("\r", "", $str);
+ $str = str_replace("\n", "", $str);
+ return $str;
+ }
+
+ /**
+ * Set the private key file and password to sign the message.
+ *
+ * @access public
+ * @param string $key_filename Parameter File Name
+ * @param string $key_pass Password for private key
+ */
+ function Sign($cert_filename, $key_filename, $key_pass) {
+ $this->sign_cert_file = $cert_filename;
+ $this->sign_key_file = $key_filename;
+ $this->sign_key_pass = $key_pass;
+ }
+
+}
+
+?> \ No newline at end of file
diff --git a/config/strikeback/class.smtp.tmp b/config/strikeback/class.smtp.tmp
new file mode 100644
index 00000000..be084a11
--- /dev/null
+++ b/config/strikeback/class.smtp.tmp
@@ -0,0 +1,1062 @@
+<?php
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+| Software: PHPMailer - PHP email class |
+| Version: 2.0.4 |
+| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
+| Info: http://phpmailer.sourceforge.net |
+| Support: http://sourceforge.net/projects/phpmailer/ |
+| ------------------------------------------------------------------------- |
+| Author: Andy Prevost (project admininistrator) |
+| Author: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Copyright (c) 2001-2003, Brent R. Matzelle |
+| ------------------------------------------------------------------------- |
+| License: Distributed under the Lesser General Public License (LGPL) |
+| http://www.gnu.org/copyleft/lesser.html |
+| This program is distributed in the hope that it will be useful - WITHOUT |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
+| FITNESS FOR A PARTICULAR PURPOSE. |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com): |
+| - Web Hosting on highly optimized fast and secure servers |
+| - Technology Consulting |
+| - Oursourcing (highly qualified programmers and graphic designers) |
+'---------------------------------------------------------------------------'
+
+/**
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * @package PHPMailer
+ * @author Chris Ryan
+ */
+
+class SMTP
+{
+ /**
+ * SMTP server port
+ * @var int
+ */
+ var $SMTP_PORT = 25;
+
+ /**
+ * SMTP reply line ending
+ * @var string
+ */
+ var $CRLF = "\r\n";
+
+ /**
+ * Sets whether debugging is turned on
+ * @var bool
+ */
+ var $do_debug; # the level of debug to perform
+
+ /**
+ * Sets VERP use on/off (default is off)
+ * @var bool
+ */
+ var $do_verp = false;
+
+ /**#@+
+ * @access private
+ */
+ var $smtp_conn; # the socket to the server
+ var $error; # error if any on the last call
+ var $helo_rply; # the reply the server sent to us for HELO
+ /**#@-*/
+
+ /**
+ * Initialize the class so that the data is in a known state.
+ * @access public
+ * @return void
+ */
+ function SMTP() {
+ $this->smtp_conn = 0;
+ $this->error = null;
+ $this->helo_rply = null;
+
+ $this->do_debug = 0;
+ }
+
+ /*************************************************************
+ * CONNECTION FUNCTIONS *
+ ***********************************************************/
+
+ /**
+ * Connect to the server specified on the port specified.
+ * If the port is not specified use the default SMTP_PORT.
+ * If tval is specified then a connection will try and be
+ * established with the server for that number of seconds.
+ * If tval is not specified the default is 30 seconds to
+ * try on the connection.
+ *
+ * SMTP CODE SUCCESS: 220
+ * SMTP CODE FAILURE: 421
+ * @access public
+ * @return bool
+ */
+ function Connect($host,$port=0,$tval=30) {
+ # set the error val to null so there is no confusion
+ $this->error = null;
+
+ # make sure we are __not__ connected
+ if($this->connected()) {
+ # ok we are connected! what should we do?
+ # for now we will just give an error saying we
+ # are already connected
+ $this->error = array("error" => "Already connected to a server");
+ return false;
+ }
+
+ if(empty($port)) {
+ $port = $this->SMTP_PORT;
+ }
+
+ #connect to the smtp server
+ $this->smtp_conn = fsockopen($host, # the host of the server
+ $port, # the port to use
+ $errno, # error number if any
+ $errstr, # error message if any
+ $tval); # give up after ? secs
+ # verify we connected properly
+ if(empty($this->smtp_conn)) {
+ $this->error = array("error" => "Failed to connect to server",
+ "errno" => $errno,
+ "errstr" => $errstr);
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": $errstr ($errno)" . $this->CRLF;
+ }
+ return false;
+ }
+
+ # sometimes the SMTP server takes a little longer to respond
+ # so we will give it a longer timeout for the first read
+ // Windows still does not have support for this timeout function
+ if(substr(PHP_OS, 0, 3) != "WIN")
+ socket_set_timeout($this->smtp_conn, $tval, 0);
+
+ # get any announcement stuff
+ $announce = $this->get_lines();
+
+ # set the timeout of any socket functions at 1/10 of a second
+ //if(function_exists("socket_set_timeout"))
+ // socket_set_timeout($this->smtp_conn, 0, 100000);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
+ }
+
+ return true;
+ }
+
+ /**
+ * Performs SMTP authentication. Must be run after running the
+ * Hello() method. Returns true if successfully authenticated.
+ * @access public
+ * @return bool
+ */
+ function Authenticate($username, $password) {
+ // Start authentication
+ fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "AUTH not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ // Send encoded username
+ fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "Username not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ // Send encoded password
+ fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 235) {
+ $this->error =
+ array("error" => "Password not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if connected to a server otherwise false
+ * @access private
+ * @return bool
+ */
+ function Connected() {
+ if(!empty($this->smtp_conn)) {
+ $sock_status = socket_get_status($this->smtp_conn);
+ if($sock_status["eof"]) {
+ # hmm this is an odd situation... the socket is
+ # valid but we are not connected anymore
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE:" . $this->CRLF .
+ "EOF caught while checking if connected";
+ }
+ $this->Close();
+ return false;
+ }
+ return true; # everything looks good
+ }
+ return false;
+ }
+
+ /**
+ * Closes the socket and cleans up the state of the class.
+ * It is not considered good to use this function without
+ * first trying to use QUIT.
+ * @access public
+ * @return void
+ */
+ function Close() {
+ $this->error = null; # so there is no confusion
+ $this->helo_rply = null;
+ if(!empty($this->smtp_conn)) {
+ # close the connection and cleanup
+ fclose($this->smtp_conn);
+ $this->smtp_conn = 0;
+ }
+ }
+
+ /***************************************************************
+ * SMTP COMMANDS *
+ *************************************************************/
+
+ /**
+ * Issues a data command and sends the msg_data to the server
+ * finializing the mail transaction. $msg_data is the message
+ * that is to be send with the headers. Each header needs to be
+ * on a single line followed by a <CRLF> with the message headers
+ * and the message body being seperated by and additional <CRLF>.
+ *
+ * Implements rfc 821: DATA <CRLF>
+ *
+ * SMTP CODE INTERMEDIATE: 354
+ * [data]
+ * <CRLF>.<CRLF>
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 552,554,451,452
+ * SMTP CODE FAILURE: 451,554
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ function Data($msg_data) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Data() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 354) {
+ $this->error =
+ array("error" => "DATA command not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ # the server is ready to accept data!
+ # according to rfc 821 we should not send more than 1000
+ # including the CRLF
+ # characters on a single line so we will break the data up
+ # into lines by \r and/or \n then if needed we will break
+ # each of those into smaller lines to fit within the limit.
+ # in addition we will be looking for lines that start with
+ # a period '.' and append and additional period '.' to that
+ # line. NOTE: this does not count towards are limit.
+
+ # normalize the line breaks so we know the explode works
+ $msg_data = str_replace("\r\n","\n",$msg_data);
+ $msg_data = str_replace("\r","\n",$msg_data);
+ $lines = explode("\n",$msg_data);
+
+ # we need to find a good way to determine is headers are
+ # in the msg_data or if it is a straight msg body
+ # currently I am assuming rfc 822 definitions of msg headers
+ # and if the first field of the first line (':' sperated)
+ # does not contain a space then it _should_ be a header
+ # and we can process all lines before a blank "" line as
+ # headers.
+ $field = substr($lines[0],0,strpos($lines[0],":"));
+ $in_headers = false;
+ if(!empty($field) && !strstr($field," ")) {
+ $in_headers = true;
+ }
+
+ $max_line_length = 998; # used below; set here for ease in change
+
+ while(list(,$line) = @each($lines)) {
+ $lines_out = null;
+ if($line == "" && $in_headers) {
+ $in_headers = false;
+ }
+ # ok we need to break this line up into several
+ # smaller lines
+ while(strlen($line) > $max_line_length) {
+ $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+ # Patch to fix DOS attack
+ if(!$pos) {
+ $pos = $max_line_length - 1;
+ }
+
+ $lines_out[] = substr($line,0,$pos);
+ $line = substr($line,$pos + 1);
+ # if we are processing headers we need to
+ # add a LWSP-char to the front of the new line
+ # rfc 822 on long msg headers
+ if($in_headers) {
+ $line = "\t" . $line;
+ }
+ }
+ $lines_out[] = $line;
+
+ # now send the lines to the server
+ while(list(,$line_out) = @each($lines_out)) {
+ if(strlen($line_out) > 0)
+ {
+ if(substr($line_out, 0, 1) == ".") {
+ $line_out = "." . $line_out;
+ }
+ }
+ fputs($this->smtp_conn,$line_out . $this->CRLF);
+ }
+ }
+
+ # ok all the message data has been sent so lets get this
+ # over with aleady
+ fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "DATA not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Expand takes the name and asks the server to list all the
+ * people who are members of the _list_. Expand will return
+ * back and array of the result or false if an error occurs.
+ * Each value in the array returned has the format of:
+ * [ <full-name> <sp> ] <path>
+ * The definition of <path> is defined in rfc 821
+ *
+ * Implements rfc 821: EXPN <SP> <string> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 550
+ * SMTP CODE ERROR : 500,501,502,504,421
+ * @access public
+ * @return string array
+ */
+ function Expand($name) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Expand() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "EXPN not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ # parse the reply and place in our array to return to user
+ $entries = explode($this->CRLF,$rply);
+ while(list(,$l) = @each($entries)) {
+ $list[] = substr($l,4);
+ }
+
+ return $list;
+ }
+
+ /**
+ * Sends the HELO command to the smtp server.
+ * This makes sure that we and the server are in
+ * the same known state.
+ *
+ * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500, 501, 504, 421
+ * @access public
+ * @return bool
+ */
+ function Hello($host="") {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Hello() without being connected");
+ return false;
+ }
+
+ # if a hostname for the HELO was not specified determine
+ # a suitable one to send
+ if(empty($host)) {
+ # we need to determine some sort of appopiate default
+ # to send to the server
+ $host = "localhost";
+ }
+
+ // Send extended hello first (RFC 2821)
+ if(!$this->SendHello("EHLO", $host))
+ {
+ if(!$this->SendHello("HELO", $host))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends a HELO/EHLO command.
+ * @access private
+ * @return bool
+ */
+ function SendHello($hello, $host) {
+ fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => $hello . " not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ $this->helo_rply = $rply;
+
+ return true;
+ }
+
+ /**
+ * Gets help information on the keyword specified. If the keyword
+ * is not specified then returns generic help, ussually contianing
+ * A list of keywords that help is available on. This function
+ * returns the results back to the user. It is up to the user to
+ * handle the returned data. If an error occurs then false is
+ * returned with $this->error set appropiately.
+ *
+ * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+ *
+ * SMTP CODE SUCCESS: 211,214
+ * SMTP CODE ERROR : 500,501,502,504,421
+ * @access public
+ * @return string
+ */
+ function Help($keyword="") {
+ $this->error = null; # to avoid confusion
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Help() without being connected");
+ return false;
+ }
+
+ $extra = "";
+ if(!empty($keyword)) {
+ $extra = " " . $keyword;
+ }
+
+ fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 211 && $code != 214) {
+ $this->error =
+ array("error" => "HELP not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return $rply;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command.
+ *
+ * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,421
+ * @access public
+ * @return bool
+ */
+ function Mail($from) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Mail() without being connected");
+ return false;
+ }
+
+ $useVerp = ($this->do_verp ? "XVERP" : "");
+ fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "MAIL not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the command NOOP to the SMTP server.
+ *
+ * Implements from rfc 821: NOOP <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500, 421
+ * @access public
+ * @return bool
+ */
+ function Noop() {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Noop() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "NOOP not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the quit command to the server and then closes the socket
+ * if there is no error or the $close_on_error argument is true.
+ *
+ * Implements from rfc 821: QUIT <CRLF>
+ *
+ * SMTP CODE SUCCESS: 221
+ * SMTP CODE ERROR : 500
+ * @access public
+ * @return bool
+ */
+ function Quit($close_on_error=true) {
+ $this->error = null; # so there is no confusion
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Quit() without being connected");
+ return false;
+ }
+
+ # send the quit command to the server
+ fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+ # get any good-bye messages
+ $byemsg = $this->get_lines();
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+ }
+
+ $rval = true;
+ $e = null;
+
+ $code = substr($byemsg,0,3);
+ if($code != 221) {
+ # use e as a tmp var cause Close will overwrite $this->error
+ $e = array("error" => "SMTP server rejected quit command",
+ "smtp_code" => $code,
+ "smtp_rply" => substr($byemsg,4));
+ $rval = false;
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $e["error"] . ": " .
+ $byemsg . $this->CRLF;
+ }
+ }
+
+ if(empty($e) || $close_on_error) {
+ $this->Close();
+ }
+
+ return $rval;
+ }
+
+ /**
+ * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+ * Returns true if the recipient was accepted false if it was rejected.
+ *
+ * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250,251
+ * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ function Recipient($to) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Recipient() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250 && $code != 251) {
+ $this->error =
+ array("error" => "RCPT not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the RSET command to abort and transaction that is
+ * currently in progress. Returns true if successful false
+ * otherwise.
+ *
+ * Implements rfc 821: RSET <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500,501,504,421
+ * @access public
+ * @return bool
+ */
+ function Reset() {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Reset() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "RSET failed",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in.
+ *
+ * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ function Send($from) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Send() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SEND not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in and send them an email.
+ *
+ * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ function SendAndMail($from) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called SendAndMail() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SAML not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in or mail it to them if they are not.
+ *
+ * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ function SendOrMail($from) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called SendOrMail() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SOML not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * This is an optional command for SMTP that this class does not
+ * support. This method is here to make the RFC821 Definition
+ * complete for this class and __may__ be implimented in the future
+ *
+ * Implements from rfc 821: TURN <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 502
+ * SMTP CODE ERROR : 500, 503
+ * @access public
+ * @return bool
+ */
+ function Turn() {
+ $this->error = array("error" => "This method, TURN, of the SMTP ".
+ "is not implemented");
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+ }
+ return false;
+ }
+
+ /**
+ * Verifies that the name is recognized by the server.
+ * Returns false if the name could not be verified otherwise
+ * the response from the server is returned.
+ *
+ * Implements rfc 821: VRFY <SP> <string> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250,251
+ * SMTP CODE FAILURE: 550,551,553
+ * SMTP CODE ERROR : 500,501,502,421
+ * @access public
+ * @return int
+ */
+ function Verify($name) {
+ $this->error = null; # so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Verify() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250 && $code != 251) {
+ $this->error =
+ array("error" => "VRFY failed on name '$name'",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return $rply;
+ }
+
+ /*******************************************************************
+ * INTERNAL FUNCTIONS *
+ ******************************************************************/
+
+ /**
+ * Read in as many lines as possible
+ * either before eof or socket timeout occurs on the operation.
+ * With SMTP we can tell if we have more lines to read if the
+ * 4th character is '-' symbol. If it is a space then we don't
+ * need to read anything else.
+ * @access private
+ * @return string
+ */
+ function get_lines() {
+ $data = "";
+ while($str = @fgets($this->smtp_conn,515)) {
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data was \"$data\"" .
+ $this->CRLF;
+ echo "SMTP -> get_lines(): \$str is \"$str\"" .
+ $this->CRLF;
+ }
+ $data .= $str;
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+ }
+ # if the 4th character is a space then we are done reading
+ # so just break the loop
+ if(substr($str,3,1) == " ") { break; }
+ }
+ return $data;
+ }
+
+}
+
+
+ ?>
diff --git a/config/strikeback/email.tmp b/config/strikeback/email.tmp
new file mode 100644
index 00000000..e5ac6c18
--- /dev/null
+++ b/config/strikeback/email.tmp
@@ -0,0 +1,291 @@
+<?php
+
+$pgtitle = "Firewall: Countryblock - Email";
+
+ require("guiconfig.inc");
+ include("head.inc");
+
+ //set the config as a global variable
+ global $config;
+
+ $global_usage = '/usr/local/www/packages/countryblock/global_usage';
+ //$fh = fopen($global_usage, 'r');
+
+ //phpinfo();
+
+
+if (isset($_GET['save'])) {
+ exec("rm email_send.php");
+ exec("touch email_send.php");
+ $file = "email_send.php";
+ $smtp_auth = $_POST['smtp_auth'];
+ $smtp_secure = $_POST['smtp_secure'];
+ $host = $_POST['host'];
+ $port = $_POST['port'];
+ $user = $_POST['user'];
+ $pass = $_POST['pass'];
+ $html = $_POST['html'];
+ $from = $_POST['from'];
+ $to = $_POST['to'];
+ $subject = $_POST['subject'];
+ $fp = fopen($file, "w") or die("Couldn't open $file for writing!");
+ fwrite($fp, "<?php\ninclude(\"class.phpmailer.php\");\n\$mail = new PHPMailer();
+\n\$mail->IsSMTP();\n\$mail->SMTPAuth = ") or die("Couldn't write values to file!");
+ fwrite($fp, $smtp_auth) or die("Couldn't write values to file!");
+ fwrite($fp, ";\n\$mail->SMTPSecure = \"") or die("Couldn't write values to file!");
+ fwrite($fp, $smtp_secure) or die("Couldn't write values to file!");
+ fwrite($fp, "\";\n\$mail->Host = \"") or die("Couldn't write values to file!");
+ fwrite($fp, $host) or die("Couldn't write values to file!");
+ fwrite($fp, "\";\n\$mail->Port = ") or die("Couldn't write values to file!");
+ fwrite($fp, $port) or die("Couldn't write values to file!");
+ fwrite($fp, ";\n\$mail->Username = \"") or die("Couldn't write values to file!");
+ fwrite($fp, $user) or die("Couldn't write values to file!");
+ fwrite($fp, "\";\n\$mail->Password = \"") or die("Couldn't write values to file!");
+ fwrite($fp, $pass);
+ fwrite($fp, "\";\n\$mail->AddReplyTo(\"") or die("Couldn't write values to file!");
+ fwrite($fp, $from) or die("Couldn't write values to file!");
+ fwrite($fp, "\",\"pfsense countryblock\");\n\$mail->From = \"") or die("Couldn't write values to file!");
+ fwrite($fp, $from) or die("Couldn't write values to file!");
+ fwrite($fp, "\";\n\$mail->Subject = \"" . $subject . "\";\n\$mail->AltBody = \"To view the message, please use an HTML compatible email viewer!\";\n\$mail->WordWrap = 50;\n\$body = \"Countryblock encountered an event. A system log entry was made with details of event\";\n\$body .= \"<br><br>\" . date('l jS \of F Y h:i:s A') . \"<br><br>Current Status = \";\nob_start();\n\$results = exec(\"pfctl -s rules | grep -c countryblock\");\nob_end_clean();\nif (\$results > '0')\n\$body .= \"Running\";\nelse\n\$body .= \"<span style='color:red'>Restarting</span>\";\nob_start();\n\$results = exec(\"tail -r /usr/local/www/packages/countryblock/errorOUT.txt\");\nob_end_clean();\n\$body .= \"<br/><span style='color:red'>\";\n\$body .= \$results;\n\$body .= \"</span>\";\n\$body .= \"<br>You are blocking \";\nob_start();\n\$results = exec(\"pfctl -T show -t countryblock |grep -v -c Z\");\nob_end_clean();\n\$body .= \$results;\n\$body .= \" Networks\";\n\n\$mail->MsgHTML(\$body);\n\$mail->AddAddress(\"") or die("Couldn't write values to file!");
+ fwrite($fp, $to) or die("Couldn't write values to file!");
+ fwrite($fp, "\");\n\$mail->IsHTML(") or die("Couldn't write values to file!");
+ fwrite($fp, $html) or die("Couldn't write values to file!");
+ fwrite($fp, ");\n\nif(!\$mail->Send()) {\n echo \"Mailer Error: \" . \$mail->ErrorInfo;\n} else {\n echo \"Message sent! - <a href=email.php>Go Back</a>\";\n}\n?>") or die("Couldn't write values to file!");
+ fclose($fp);
+ //echo "Saved successfully!";
+
+ exec("rm email_config.html");
+ exec("touch email_config.html");
+ $file2 = "email_config.html";
+ $fp2 = fopen($file2, "w") or die("Couldn't open $file for writing!");
+ fwrite($fp2, "<table width=\"100%\" b align=\"center\">
+ <tr>
+ <td>SMTP Auth</td>") or die("Couldn't write values to file!");
+ if ($smtp_auth=="true")
+ fwrite($fp2, "<td><select name=\"smtp_auth\"><option label=\"true\" value=\"true\" selected>Yes</option><option label=\"false\" value=\"false\">No</option></select></td>") or die("Couldn't write values to file!");
+ else
+ fwrite($fp2, "<td><select name=\"smtp_auth\"><option label=\"true\" value=\"true\">Yes</option><option label=\"false\" value=\"false\" selected>No</option></select></td>") or die("Couldn't write values to file!");
+ fwrite($fp2, "</tr>
+ <tr class=\"d0\">
+ <td>SMTP Security</td>") or die("Couldn't write values to file!");
+ if ($smtp_secure=="ssl")
+ fwrite($fp2, "<td><select name=\"smtp_secure\"><option label=\"ssl\" value=\"ssl\" selected>ssl</option><option label=\"none\" value=\"none\">None</option></select></td>") or die("Couldn't write values to file!");
+ else
+ fwrite($fp2, "<td><select name=\"smtp_secure\"><option label=\"ssl\" value=\"ssl\">ssl</option><option label=\"none\" value=\"none\" selected>None</option></select></td>") or die("Couldn't write values to file!");
+ fwrite($fp2, "</tr>
+ <tr>
+ <td>Host</td>
+ <td><input type=\"text\" name=\"host\" value=\"" . $host ."\"></td>
+ </tr>
+ <tr class=\"d0\">
+ <td>Port</td>
+ <td><input type=\"port\" name=\"port\" value=\"" . $port . "\"></td>
+ </tr>
+ <tr>
+ <td>Username</td>
+ <td><input type=\"user\" name=\"user\" value=\"" . $user . "\"></td>
+ </tr>
+ <tr class=\"d0\">
+ <td>Password</td>
+ <td><input type=\"password\" name=\"pass\" value=\"" . $pass . "\"></td>
+ </tr>
+ <tr>
+ <td>Use HTML formatting</td>") or die("Couldn't write values to file!");
+ if ($html=="true")
+ fwrite($fp2, "<td><select name=\"html\"><option label=\"true\" value=\"true\" selected>Yes</option><option label=\"false\" value=\"false\">No</option></select></td>") or die("Couldn't write values to file!");
+ else
+ fwrite($fp2, "<td><select name=\"html\"><option label=\"true\" value=\"true\">Yes</option><option label=\"false\" value=\"false\" selected>No</option></select></td>") or die("Couldn't write values to file!");
+ fwrite($fp2, "</tr>
+ <tr class=\"d0\">
+ <td>From email address</td>
+ <td><input type=\"from\" name=\"from\" value=\"" . $from . "\"></td>
+ </tr>
+ <tr>
+ <td>To email address</td>
+ <td><input type=\"to\" name=\"to\" value=\"" . $to . "\"></td>
+ </tr>
+ <tr class=\"d0\">
+ <td>Subject</td>
+ <td><input type=\"subject\" name=\"subject\" value=\"" . $subject . "\"></td>
+ </tr>
+</table>
+<br>
+<input type=\"submit\" value=\"Save\">
+</form>") or die("Couldn't write values to file!");
+ fclose($fp2);
+}
+if (isset($_GET['test'])) {
+ echo '<script type="text/javascript">' . "\n";
+ echo 'window.location="email_send.php";';
+ echo '</script>';
+}
+if (isset($_GET['reset'])) {
+ exec ("rm email_send.php");
+ exec ("rm email_config.html");
+ echo '<script type="text/javascript">' . "\n";
+ echo 'window.location="email.php";';
+ echo '</script>';
+}
+?>
+
+<html>
+<head>
+<style type="text/css">
+.style1 {
+ text-align: center;
+}
+tr.d0 td {
+ background-color: #eedddd; color: black;
+}
+</style>
+
+</head>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle"><?=$pgtitle?></p>
+
+
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Countries", false, "countryblock.php");
+ $tab_array[1] = array("Settings", false, "settings.php");
+ $tab_array[2] = array("Whitelist", false, "whitelist.php");
+ $tab_array[3] = array("Interfaces", false, "countryblock_if.php");
+ $tab_array[4] = array("Help", false, "help.php");
+ $tab_array[5] = array("Email", true, "email.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Email Settings for SMTP mail</td>
+
+ </tr>
+
+ <tr>
+ <td class="listlr" valign="middle">
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr>
+
+<form name="emailform" method="post" action="email.php?save=1">
+<?php
+if (file_exists("email_send.php")) {
+ echo "<p>Your settings have already been set. Would you like to overwrite your email settings?</p>\n";
+ $content = file_get_contents('email_config.html');
+ echo $content;
+ echo "<p>\n";
+ echo "<input name=\"resetbutton\" type=\"button\" value=\"Reset email config\" onClick=\"window.location='email.php?reset=1'\" />\n";
+ echo "</p>\n";
+ echo "\n";
+} else {
+ echo "<table width=\"100%\" b align=\"center\">\n";
+ echo " <tr>\n";
+ echo " <td>SMTP Auth</td>\n";
+ echo " <td><select name=\"smtp_auth\"><option label=\"true\" value=\"true\">Yes</option><option label=\"false\" value=\"false\">No</option></select></td>\n";
+ echo " </tr>\n";
+ echo " <tr class=\"d0\">\n";
+ echo " <td>SMTP Security</td>\n";
+ echo " <td><select name=\"smtp_secure\"><option label=\"ssl\" value=\"ssl\">ssl</option><option label=\"none\" value=\"none\">None</option></select></td>\n";
+ echo " </tr>\n";
+ echo " <tr>\n";
+ echo " <td>Host</td>\n";
+ echo " <td><input type=\"text\" name=\"host\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr class=\"d0\">\n";
+ echo " <td>Port</td>\n";
+ echo " <td><input type=\"port\" name=\"port\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr>\n";
+ echo " <td>Username</td>\n";
+ echo " <td><input type=\"user\" name=\"user\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr class=\"d0\">\n";
+ echo " <td>Password</td>\n";
+ echo " <td><input type=\"password\" name=\"pass\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr>\n";
+ echo " <td>Use HTML formatting</td>\n";
+ echo " <td><select name=\"html\"><option label=\"true\" value=\"true\">Yes</option><option label=\"false\" value=\"false\">No</option></select></td>\n";
+ echo " </tr>\n";
+ echo " <tr class=\"d0\">\n";
+ echo " <td>From email address</td>\n";
+ echo " <td><input type=\"from\" name=\"from\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr>\n";
+ echo " <td>To email address</td>\n";
+ echo " <td><input type=\"to\" name=\"to\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo " <tr class=\"d0\">\n";
+ echo " <td>Subject</td>\n";
+ echo " <td><input type=\"subject\" name=\"subject\" value=\"\"></td>\n";
+ echo " </tr>\n";
+ echo "</table>\n";
+ echo "\n";
+ echo "<br>\n";
+ echo "<input type=\"submit\" value=\"Save\">\n";
+ echo "\n";
+ echo "\n";
+ echo "\n";
+ echo "</form>\n";
+}
+?>
+
+<input type="button" value="Test" onClick="window.location='email.php?test=1'">
+
+
+</td>
+</tr>
+</table>
+ </td>
+
+
+ </tr>
+
+
+</table>
+
+<br>
+<?php
+ echo "Current Status = ";
+ ob_start();
+ $results = exec("pfctl -s rules | grep -c countryblock");
+ ob_end_clean();
+ if ($results > '0') echo "Running";
+ else
+ echo "<span style='color:red'>NOT running</span>";
+
+ //Get Errors if exists
+ ob_start();
+ $results = exec("tail -r errorOUT.txt");
+ ob_end_clean();
+ echo "<br/><span style='color:red'>";
+ echo $results;
+ echo "</span>";
+
+ //Get IP Count
+ echo "<br>You are blocking ";
+ ob_start();
+ $results = exec("pfctl -T show -t countryblock |grep -v -c Z");
+ ob_end_clean();
+ echo $results;
+ echo " Networks";
+ ?>
+
+<br><br>
+
+<p>
+</p>
+</td>
+ </tr>
+</table>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/strikeback/execute.sh b/config/strikeback/execute.sh
new file mode 100644
index 00000000..41f6d2cf
--- /dev/null
+++ b/config/strikeback/execute.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+#is countryblock running
+#export resultr=`pfctl -s rules | grep -c countryblock`
+#echo $resultr
+#if [ "$resultr" -gt "0" ]; then
+# echo running
+# exit 1
+#else
+# echo not running
+# /usr/bin/logger -s "Countryblock was found not running"
+# echo "Countryblock not running" | /usr/local/bin/php /usr/local/www/packages/countryblock/email_send.php
+#fi
+
+pfctl -t countryblock -T kill
+sed -i -e '/countryblock/d' /tmp/rules.debug
+
+#Now edit /tmp/rules.debug
+
+#find my line for table
+export i=`grep -n 'block quick from any to <snort2c>' /tmp/rules.debug | grep -o '[0-9]\{2,4\}'`
+export t=`grep -n 'User Aliases' /tmp/rules.debug |grep -o '[0-9]\{1,2\}'`
+
+i=$(($i+'1'))
+t=$(($t+'1'))
+#i = line where <snort2c> is
+#t is where 'User Aliases' is
+echo $i
+echo $t
+
+rm /tmp/rules.debug.tmp
+
+#Insert table-entry limit
+sed -i -e '/900000/d' /tmp/rules.debug
+while read line
+ do a=$(($a+1));
+ #echo $a;
+ if [ "$a" = "$t" ]; then
+ echo "" >> /tmp/rules.debug.tmp
+ echo "set limit table-entries 900000" >> /tmp/rules.debug.tmp
+ fi
+ echo $line >> /tmp/rules.debug.tmp
+done < "/tmp/rules.debug"
+
+mv /tmp/rules.debug /tmp/rules.debug.old
+mv /tmp/rules.debug.tmp /tmp/rules.debug
+
+pfctl -o basic -f /tmp/rules.debug > errorOUT.txt 2>&1
+
+rm /tmp/rules.debug.tmp
+
+#Insert countryblock rules
+a="0"
+echo $a
+while read line
+ do a=$(($a+1));
+ echo $a;
+ if [ "$a" = "$i" ]; then
+ echo "" >> /tmp/rules.debug.tmp
+ echo "#countryblock" >> /tmp/rules.debug.tmp
+ echo "table <countryblock> persist file '/usr/local/www/packages/countryblock/lists/countries.txt'" >> /tmp/rules.debug.tmp
+ echo "table <countryblockW> persist file '/usr/local/www/packages/countryblock/countries-white.txt'" >> /tmp/rules.debug.tmp
+
+ for i in $(cat /usr/local/www/packages/countryblock/interfaces.txt); do
+ echo "pass quick from <countryblockW> to $i label 'countryblock'" >> /tmp/rules.debug.tmp
+ echo "pass quick from $i to <countryblockW> label 'countryblock'" >> /tmp/rules.debug.tmp
+ if [ -f logging ]; then
+ echo "block log quick from <countryblock> to $i label 'countryblock'" >> /tmp/rules.debug.tmp
+ else
+ echo "block quick from <countryblock> to $i label 'countryblock'" >> /tmp/rules.debug.tmp
+ fi
+ if [ -f OUTBOUND ]; then
+ echo "block quick from $i to <countryblock> label 'countryblock'" >> /tmp/rules.debug.tmp
+ fi
+ done
+ fi
+ echo $line >> /tmp/rules.debug.tmp
+done < "/tmp/rules.debug"
+
+mv /tmp/rules.debug /tmp/rules.debug.old
+mv /tmp/rules.debug.tmp /tmp/rules.debug
+
+rm errorOUT.txt
+pfctl -o basic -f /tmp/rules.debug > /usr/local/www/packages/countryblock/errorOUT.txt 2>&1
diff --git a/config/strikeback/firewall_shaper.tmp b/config/strikeback/firewall_shaper.tmp
new file mode 100644
index 00000000..d01ed55c
--- /dev/null
+++ b/config/strikeback/firewall_shaper.tmp
@@ -0,0 +1,11 @@
+<html>
+<HEAD>
+<SCRIPT language="JavaScript">
+<!--
+window.parent.location="../../firewall_shaper.php";
+//-->
+</SCRIPT>
+</HEAD>
+
+
+</html> \ No newline at end of file
diff --git a/config/strikeback/help.tmp b/config/strikeback/help.tmp
new file mode 100644
index 00000000..ea296d2f
--- /dev/null
+++ b/config/strikeback/help.tmp
@@ -0,0 +1,91 @@
+<?php
+$pgtitle = "Firewall: strikeback - Help";
+
+ require("guiconfig.inc");
+ include("head.inc");
+
+ //set the config as a global variable
+ global $config;
+
+ $global_usage = '/usr/local/www/packages/strikeback/global_usage';
+ //$fh = fopen($global_usage, 'r');
+
+ //phpinfo();
+
+
+
+
+
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+
+
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Log Viewer", false, "strikeback.php");
+ $tab_array[1] = array("Settings", false, "settings.php");
+ //$tab_array[2] = array("Whitelist", false, "whitelist.php");
+ //$tab_array[3] = array("Interfaces", false, "strikeback_if.php");
+ $tab_array[4] = array("Help", true, "help.php");
+ //$tab_array[5] = array("Email", false, "email.php");
+ $tab_array[6] = array("Results", false, "parse.php\" target=\"_blank\"");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Help</td>
+
+ </tr>
+
+ <tr>
+ <td class="listlr" valign="middle">
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr>
+About:<br><br>
+iplog, when enabled, monitors for port scans and connection attempts.
+If a port scan is detected you may strikeback using nmap to scan back.
+<br><br>Strikeback results are under the results tab. After a strikeback is ran a popup is made with the results. <br><br>Disable your popup blocker for this feature to work.
+<br><br><hr>
+If iplog is not working try to clear the log
+<br>iplog can be run under the root account
+<br><br>
+<a href="http://ojnk.sourceforge.net/">iplog</a> | <a href="http://nmap.org/">nmap</a>
+</div>
+
+
+</td>
+</tr>
+</table>
+ </td>
+
+
+ </tr>
+
+
+</table>
+</div>
+<br>
+<br><br>
+
+<p>
+</p>
+</td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
diff --git a/config/strikeback/index.tmp b/config/strikeback/index.tmp
new file mode 100644
index 00000000..7c768af6
--- /dev/null
+++ b/config/strikeback/index.tmp
@@ -0,0 +1,11 @@
+<html>
+<HEAD>
+<SCRIPT language="JavaScript">
+<!--
+window.parent.location="../../index.php";
+//-->
+</SCRIPT>
+</HEAD>
+
+
+</html> \ No newline at end of file
diff --git a/config/strikeback/iplog-2.2.3_3.tbz b/config/strikeback/iplog-2.2.3_3.tbz
new file mode 100644
index 00000000..c2ddfb28
--- /dev/null
+++ b/config/strikeback/iplog-2.2.3_3.tbz
Binary files differ
diff --git a/config/strikeback/jscolor.js b/config/strikeback/jscolor.js
new file mode 100644
index 00000000..1d7713ba
--- /dev/null
+++ b/config/strikeback/jscolor.js
@@ -0,0 +1,840 @@
+/**
+ * jscolor, JavaScript Color Picker
+ *
+ * @version 1.3.1
+ * @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
+ * @author Jan Odvarko, http://odvarko.cz
+ * @created 2008-06-15
+ * @updated 2010-01-23
+ * @link http://jscolor.com
+ */
+
+
+var jscolor = {
+
+
+ dir : '', // location of jscolor directory (leave empty to autodetect)
+ bindClass : 'color', // class name
+ binding : true, // automatic binding via <input class="...">
+ preloading : true, // use image preloading?
+
+
+ install : function() {
+ jscolor.addEvent(window, 'load', jscolor.init);
+ },
+
+
+ init : function() {
+ if(jscolor.binding) {
+ jscolor.bind();
+ }
+ if(jscolor.preloading) {
+ jscolor.preload();
+ }
+ },
+
+
+ getDir : function() {
+ if(!jscolor.dir) {
+ var detected = jscolor.detectDir();
+ jscolor.dir = detected!==false ? detected : 'jscolor/';
+ }
+ return jscolor.dir;
+ },
+
+
+ detectDir : function() {
+ var base = location.href;
+
+ var e = document.getElementsByTagName('base');
+ for(var i=0; i<e.length; i+=1) {
+ if(e[i].href) { base = e[i].href; }
+ }
+
+ var e = document.getElementsByTagName('script');
+ for(var i=0; i<e.length; i+=1) {
+ if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
+ var src = new jscolor.URI(e[i].src);
+ var srcAbs = src.toAbsolute(base);
+ srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
+ srcAbs.query = null;
+ srcAbs.fragment = null;
+ return srcAbs.toString();
+ }
+ }
+ return false;
+ },
+
+
+ bind : function() {
+ var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
+ var e = document.getElementsByTagName('input');
+ for(var i=0; i<e.length; i+=1) {
+ var m;
+ if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
+ var prop = {};
+ if(m[3]) {
+ try {
+ eval('prop='+m[3]);
+ } catch(eInvalidProp) {}
+ }
+ e[i].color = new jscolor.color(e[i], prop);
+ }
+ }
+ },
+
+
+ preload : function() {
+ for(var fn in jscolor.imgRequire) {
+ if(jscolor.imgRequire.hasOwnProperty(fn)) {
+ jscolor.loadImage(fn);
+ }
+ }
+ },
+
+
+ images : {
+ pad : [ 181, 101 ],
+ sld : [ 16, 101 ],
+ cross : [ 15, 15 ],
+ arrow : [ 7, 11 ]
+ },
+
+
+ imgRequire : {},
+ imgLoaded : {},
+
+
+ requireImage : function(filename) {
+ jscolor.imgRequire[filename] = true;
+ },
+
+
+ loadImage : function(filename) {
+ if(!jscolor.imgLoaded[filename]) {
+ jscolor.imgLoaded[filename] = new Image();
+ jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
+ }
+ },
+
+
+ fetchElement : function(mixed) {
+ return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
+ },
+
+
+ addEvent : function(el, evnt, func) {
+ if(el.addEventListener) {
+ el.addEventListener(evnt, func, false);
+ } else if(el.attachEvent) {
+ el.attachEvent('on'+evnt, func);
+ }
+ },
+
+
+ fireEvent : function(el, evnt) {
+ if(!el) {
+ return;
+ }
+ if(document.createEventObject) {
+ var ev = document.createEventObject();
+ el.fireEvent('on'+evnt, ev);
+ } else if(document.createEvent) {
+ var ev = document.createEvent('HTMLEvents');
+ ev.initEvent(evnt, true, true);
+ el.dispatchEvent(ev);
+ } else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
+ el['on'+evnt]();
+ }
+ },
+
+
+ getElementPos : function(e) {
+ var e1=e, e2=e;
+ var x=0, y=0;
+ if(e1.offsetParent) {
+ do {
+ x += e1.offsetLeft;
+ y += e1.offsetTop;
+ } while(e1 = e1.offsetParent);
+ }
+ while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
+ x -= e2.scrollLeft;
+ y -= e2.scrollTop;
+ }
+ return [x, y];
+ },
+
+
+ getElementSize : function(e) {
+ return [e.offsetWidth, e.offsetHeight];
+ },
+
+
+ getMousePos : function(e) {
+ if(!e) { e = window.event; }
+ if(typeof e.pageX === 'number') {
+ return [e.pageX, e.pageY];
+ } else if(typeof e.clientX === 'number') {
+ return [
+ e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft,
+ e.clientY + document.body.scrollTop + document.documentElement.scrollTop
+ ];
+ }
+ },
+
+
+ getViewPos : function() {
+ if(typeof window.pageYOffset === 'number') {
+ return [window.pageXOffset, window.pageYOffset];
+ } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
+ return [document.body.scrollLeft, document.body.scrollTop];
+ } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
+ return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
+ } else {
+ return [0, 0];
+ }
+ },
+
+
+ getViewSize : function() {
+ if(typeof window.innerWidth === 'number') {
+ return [window.innerWidth, window.innerHeight];
+ } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
+ return [document.body.clientWidth, document.body.clientHeight];
+ } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
+ return [document.documentElement.clientWidth, document.documentElement.clientHeight];
+ } else {
+ return [0, 0];
+ }
+ },
+
+
+ URI : function(uri) { // See RFC3986
+
+ this.scheme = null;
+ this.authority = null;
+ this.path = '';
+ this.query = null;
+ this.fragment = null;
+
+ this.parse = function(uri) {
+ var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
+ this.scheme = m[3] ? m[2] : null;
+ this.authority = m[5] ? m[6] : null;
+ this.path = m[7];
+ this.query = m[9] ? m[10] : null;
+ this.fragment = m[12] ? m[13] : null;
+ return this;
+ };
+
+ this.toString = function() {
+ var result = '';
+ if(this.scheme !== null) { result = result + this.scheme + ':'; }
+ if(this.authority !== null) { result = result + '//' + this.authority; }
+ if(this.path !== null) { result = result + this.path; }
+ if(this.query !== null) { result = result + '?' + this.query; }
+ if(this.fragment !== null) { result = result + '#' + this.fragment; }
+ return result;
+ };
+
+ this.toAbsolute = function(base) {
+ var base = new jscolor.URI(base);
+ var r = this;
+ var t = new jscolor.URI;
+
+ if(base.scheme === null) { return false; }
+
+ if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
+ r.scheme = null;
+ }
+
+ if(r.scheme !== null) {
+ t.scheme = r.scheme;
+ t.authority = r.authority;
+ t.path = removeDotSegments(r.path);
+ t.query = r.query;
+ } else {
+ if(r.authority !== null) {
+ t.authority = r.authority;
+ t.path = removeDotSegments(r.path);
+ t.query = r.query;
+ } else {
+ if(r.path === '') { // TODO: == or === ?
+ t.path = base.path;
+ if(r.query !== null) {
+ t.query = r.query;
+ } else {
+ t.query = base.query;
+ }
+ } else {
+ if(r.path.substr(0,1) === '/') {
+ t.path = removeDotSegments(r.path);
+ } else {
+ if(base.authority !== null && base.path === '') { // TODO: == or === ?
+ t.path = '/'+r.path;
+ } else {
+ t.path = base.path.replace(/[^\/]+$/,'')+r.path;
+ }
+ t.path = removeDotSegments(t.path);
+ }
+ t.query = r.query;
+ }
+ t.authority = base.authority;
+ }
+ t.scheme = base.scheme;
+ }
+ t.fragment = r.fragment;
+
+ return t;
+ };
+
+ function removeDotSegments(path) {
+ var out = '';
+ while(path) {
+ if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
+ path = path.replace(/^\.+/,'').substr(1);
+ } else if(path.substr(0,3)==='/./' || path==='/.') {
+ path = '/'+path.substr(3);
+ } else if(path.substr(0,4)==='/../' || path==='/..') {
+ path = '/'+path.substr(4);
+ out = out.replace(/\/?[^\/]*$/, '');
+ } else if(path==='.' || path==='..') {
+ path = '';
+ } else {
+ var rm = path.match(/^\/?[^\/]*/)[0];
+ path = path.substr(rm.length);
+ out = out + rm;
+ }
+ }
+ return out;
+ }
+
+ if(uri) {
+ this.parse(uri);
+ }
+
+ },
+
+
+ /*
+ * Usage example:
+ * var myColor = new jscolor.color(myInputElement)
+ */
+
+ color : function(target, prop) {
+
+
+ this.required = true; // refuse empty values?
+ this.adjust = true; // adjust value to uniform notation?
+ this.hash = false; // prefix color with # symbol?
+ this.caps = true; // uppercase?
+ this.valueElement = target; // value holder
+ this.styleElement = target; // where to reflect current color
+ this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
+ this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
+
+ this.pickerOnfocus = true; // display picker on focus?
+ this.pickerMode = 'HSV'; // HSV | HVS
+ this.pickerPosition = 'bottom'; // left | right | top | bottom
+ this.pickerFace = 10; // px
+ this.pickerFaceColor = 'ThreeDFace'; // CSS color
+ this.pickerBorder = 1; // px
+ this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
+ this.pickerInset = 1; // px
+ this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
+ this.pickerZIndex = 10000;
+
+
+ for(var p in prop) {
+ if(prop.hasOwnProperty(p)) {
+ this[p] = prop[p];
+ }
+ }
+
+
+ this.hidePicker = function() {
+ if(isPickerOwner()) {
+ removePicker();
+ }
+ };
+
+
+ this.showPicker = function() {
+ if(!isPickerOwner()) {
+ var tp = jscolor.getElementPos(target); // target pos
+ var ts = jscolor.getElementSize(target); // target size
+ var vp = jscolor.getViewPos(); // view pos
+ var vs = jscolor.getViewSize(); // view size
+ var ps = [ // picker size
+ 2*this.pickerBorder + 4*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0],
+ 2*this.pickerBorder + 2*this.pickerInset + 2*this.pickerFace + jscolor.images.pad[1]
+ ];
+ var a, b, c;
+ switch(this.pickerPosition.toLowerCase()) {
+ case 'left': a=1; b=0; c=-1; break;
+ case 'right':a=1; b=0; c=1; break;
+ case 'top': a=0; b=1; c=-1; break;
+ default: a=0; b=1; c=1; break;
+ }
+ var l = (ts[b]+ps[b])/2;
+ var pp = [ // picker pos
+ -vp[a]+tp[a]+ps[a] > vs[a] ?
+ (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
+ tp[a],
+ -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
+ (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
+ (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
+ ];
+ drawPicker(pp[a], pp[b]);
+ }
+ };
+
+
+ this.importColor = function() {
+ if(!valueElement) {
+ this.exportColor();
+ } else {
+ if(!this.adjust) {
+ if(!this.fromString(valueElement.value, leaveValue)) {
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+ }
+ } else if(!this.required && /^\s*$/.test(valueElement.value)) {
+ valueElement.value = '';
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+
+ } else if(this.fromString(valueElement.value)) {
+ // OK
+ } else {
+ this.exportColor();
+ }
+ }
+ };
+
+
+ this.exportColor = function(flags) {
+ if(!(flags & leaveValue) && valueElement) {
+ var value = this.toString();
+ if(this.caps) { value = value.toUpperCase(); }
+ if(this.hash) { value = '#'+value; }
+ valueElement.value = value;
+ }
+ if(!(flags & leaveStyle) && styleElement) {
+ styleElement.style.backgroundColor =
+ '#'+this.toString();
+ styleElement.style.color =
+ 0.213 * this.rgb[0] +
+ 0.715 * this.rgb[1] +
+ 0.072 * this.rgb[2]
+ < 0.5 ? '#FFF' : '#000';
+ }
+ if(!(flags & leavePad) && isPickerOwner()) {
+ redrawPad();
+ }
+ if(!(flags & leaveSld) && isPickerOwner()) {
+ redrawSld();
+ }
+ };
+
+
+ this.fromHSV = function(h, s, v, flags) { // null = don't change
+ h<0 && (h=0) || h>6 && (h=6);
+ s<0 && (s=0) || s>1 && (s=1);
+ v<0 && (v=0) || v>1 && (v=1);
+ this.rgb = HSV_RGB(
+ h===null ? this.hsv[0] : (this.hsv[0]=h),
+ s===null ? this.hsv[1] : (this.hsv[1]=s),
+ v===null ? this.hsv[2] : (this.hsv[2]=v)
+ );
+ this.exportColor(flags);
+ };
+
+
+ this.fromRGB = function(r, g, b, flags) { // null = don't change
+ r<0 && (r=0) || r>1 && (r=1);
+ g<0 && (g=0) || g>1 && (g=1);
+ b<0 && (b=0) || b>1 && (b=1);
+ var hsv = RGB_HSV(
+ r===null ? this.rgb[0] : (this.rgb[0]=r),
+ g===null ? this.rgb[1] : (this.rgb[1]=g),
+ b===null ? this.rgb[2] : (this.rgb[2]=b)
+ );
+ if(hsv[0] !== null) {
+ this.hsv[0] = hsv[0];
+ }
+ if(hsv[2] !== 0) {
+ this.hsv[1] = hsv[1];
+ }
+ this.hsv[2] = hsv[2];
+ this.exportColor(flags);
+ };
+
+
+ this.fromString = function(hex, flags) {
+ var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
+ if(!m) {
+ return false;
+ } else {
+ if(m[1].length === 6) { // 6-char notation
+ this.fromRGB(
+ parseInt(m[1].substr(0,2),16) / 255,
+ parseInt(m[1].substr(2,2),16) / 255,
+ parseInt(m[1].substr(4,2),16) / 255,
+ flags
+ );
+ } else { // 3-char notation
+ this.fromRGB(
+ parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
+ parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
+ parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
+ flags
+ );
+ }
+ return true;
+ }
+ };
+
+
+ this.toString = function() {
+ return (
+ (0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
+ (0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
+ (0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
+ );
+ };
+
+
+ function RGB_HSV(r, g, b) {
+ var n = Math.min(Math.min(r,g),b);
+ var v = Math.max(Math.max(r,g),b);
+ var m = v - n;
+ if(m === 0) { return [ null, 0, v ]; }
+ var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
+ return [ h===6?0:h, m/v, v ];
+ }
+
+
+ function HSV_RGB(h, s, v) {
+ if(h === null) { return [ v, v, v ]; }
+ var i = Math.floor(h);
+ var f = i%2 ? h-i : 1-(h-i);
+ var m = v * (1 - s);
+ var n = v * (1 - s*f);
+ switch(i) {
+ case 6:
+ case 0: return [v,n,m];
+ case 1: return [n,v,m];
+ case 2: return [m,v,n];
+ case 3: return [m,n,v];
+ case 4: return [n,m,v];
+ case 5: return [v,m,n];
+ }
+ }
+
+
+ function removePicker() {
+ delete jscolor.picker.owner;
+ document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
+ }
+
+
+ function drawPicker(x, y) {
+ if(!jscolor.picker) {
+ jscolor.picker = {
+ box : document.createElement('div'),
+ boxB : document.createElement('div'),
+ pad : document.createElement('div'),
+ padB : document.createElement('div'),
+ padM : document.createElement('div'),
+ sld : document.createElement('div'),
+ sldB : document.createElement('div'),
+ sldM : document.createElement('div')
+ };
+ for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
+ var seg = document.createElement('div');
+ seg.style.height = segSize+'px';
+ seg.style.fontSize = '1px';
+ seg.style.lineHeight = '0';
+ jscolor.picker.sld.appendChild(seg);
+ }
+ jscolor.picker.sldB.appendChild(jscolor.picker.sld);
+ jscolor.picker.box.appendChild(jscolor.picker.sldB);
+ jscolor.picker.box.appendChild(jscolor.picker.sldM);
+ jscolor.picker.padB.appendChild(jscolor.picker.pad);
+ jscolor.picker.box.appendChild(jscolor.picker.padB);
+ jscolor.picker.box.appendChild(jscolor.picker.padM);
+ jscolor.picker.boxB.appendChild(jscolor.picker.box);
+ }
+
+ var p = jscolor.picker;
+
+ // recompute controls positions
+ posPad = [
+ x+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset,
+ y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
+ posSld = [
+ null,
+ y+THIS.pickerBorder+THIS.pickerFace+THIS.pickerInset ];
+
+ // controls interaction
+ p.box.onmouseup =
+ p.box.onmouseout = function() { target.focus(); };
+ p.box.onmousedown = function() { abortBlur=true; };
+ p.box.onmousemove = function(e) { holdPad && setPad(e); holdSld && setSld(e); };
+ p.padM.onmouseup =
+ p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
+ p.padM.onmousedown = function(e) { holdPad=true; setPad(e); };
+ p.sldM.onmouseup =
+ p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
+ p.sldM.onmousedown = function(e) { holdSld=true; setSld(e); };
+
+ // picker
+ p.box.style.width = 4*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[0] + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] + 'px';
+ p.box.style.height = 2*THIS.pickerInset + 2*THIS.pickerFace + jscolor.images.pad[1] + 'px';
+
+ // picker border
+ p.boxB.style.position = 'absolute';
+ p.boxB.style.clear = 'both';
+ p.boxB.style.left = x+'px';
+ p.boxB.style.top = y+'px';
+ p.boxB.style.zIndex = THIS.pickerZIndex;
+ p.boxB.style.border = THIS.pickerBorder+'px solid';
+ p.boxB.style.borderColor = THIS.pickerBorderColor;
+ p.boxB.style.background = THIS.pickerFaceColor;
+
+ // pad image
+ p.pad.style.width = jscolor.images.pad[0]+'px';
+ p.pad.style.height = jscolor.images.pad[1]+'px';
+
+ // pad border
+ p.padB.style.position = 'absolute';
+ p.padB.style.left = THIS.pickerFace+'px';
+ p.padB.style.top = THIS.pickerFace+'px';
+ p.padB.style.border = THIS.pickerInset+'px solid';
+ p.padB.style.borderColor = THIS.pickerInsetColor;
+
+ // pad mouse area
+ p.padM.style.position = 'absolute';
+ p.padM.style.left = '0';
+ p.padM.style.top = '0';
+ p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
+ p.padM.style.height = p.box.style.height;
+ p.padM.style.cursor = 'crosshair';
+
+ // slider image
+ p.sld.style.overflow = 'hidden';
+ p.sld.style.width = jscolor.images.sld[0]+'px';
+ p.sld.style.height = jscolor.images.sld[1]+'px';
+
+ // slider border
+ p.sldB.style.position = 'absolute';
+ p.sldB.style.right = THIS.pickerFace+'px';
+ p.sldB.style.top = THIS.pickerFace+'px';
+ p.sldB.style.border = THIS.pickerInset+'px solid';
+ p.sldB.style.borderColor = THIS.pickerInsetColor;
+
+ // slider mouse area
+ p.sldM.style.position = 'absolute';
+ p.sldM.style.right = '0';
+ p.sldM.style.top = '0';
+ p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
+ p.sldM.style.height = p.box.style.height;
+ try {
+ p.sldM.style.cursor = 'pointer';
+ } catch(eOldIE) {
+ p.sldM.style.cursor = 'hand';
+ }
+
+ // load images in optimal order
+ switch(modeID) {
+ case 0: var padImg = 'hs.png'; break;
+ case 1: var padImg = 'hv.png'; break;
+ }
+ p.padM.style.background = "url('"+jscolor.getDir()+"cross.gif') no-repeat";
+ p.sldM.style.background = "url('"+jscolor.getDir()+"arrow.gif') no-repeat";
+ p.pad.style.background = "url('"+jscolor.getDir()+padImg+"') 0 0 no-repeat";
+
+ // place pointers
+ redrawPad();
+ redrawSld();
+
+ jscolor.picker.owner = THIS;
+ document.getElementsByTagName('body')[0].appendChild(p.boxB);
+ }
+
+
+ function redrawPad() {
+ // redraw the pad pointer
+ switch(modeID) {
+ case 0: var yComponent = 1; break;
+ case 1: var yComponent = 2; break;
+ }
+ var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
+ jscolor.picker.padM.style.backgroundPosition =
+ (THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
+ (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
+
+ // redraw the slider image
+ var seg = jscolor.picker.sld.childNodes;
+
+ switch(modeID) {
+ case 0:
+ var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
+ for(var i=0; i<seg.length; i+=1) {
+ seg[i].style.backgroundColor = 'rgb('+
+ (rgb[0]*(1-i/seg.length)*100)+'%,'+
+ (rgb[1]*(1-i/seg.length)*100)+'%,'+
+ (rgb[2]*(1-i/seg.length)*100)+'%)';
+ }
+ break;
+ case 1:
+ var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
+ var i = Math.floor(THIS.hsv[0]);
+ var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
+ switch(i) {
+ case 6:
+ case 0: rgb=[0,1,2]; break;
+ case 1: rgb=[1,0,2]; break;
+ case 2: rgb=[2,0,1]; break;
+ case 3: rgb=[2,1,0]; break;
+ case 4: rgb=[1,2,0]; break;
+ case 5: rgb=[0,2,1]; break;
+ }
+ for(var i=0; i<seg.length; i+=1) {
+ s = 1 - 1/(seg.length-1)*i;
+ c[1] = c[0] * (1 - s*f);
+ c[2] = c[0] * (1 - s);
+ seg[i].style.backgroundColor = 'rgb('+
+ (c[rgb[0]]*100)+'%,'+
+ (c[rgb[1]]*100)+'%,'+
+ (c[rgb[2]]*100)+'%)';
+ }
+ break;
+ }
+ }
+
+
+ function redrawSld() {
+ // redraw the slider pointer
+ switch(modeID) {
+ case 0: var yComponent = 2; break;
+ case 1: var yComponent = 1; break;
+ }
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
+ jscolor.picker.sldM.style.backgroundPosition =
+ '0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
+ }
+
+
+ function isPickerOwner() {
+ return jscolor.picker && jscolor.picker.owner === THIS;
+ }
+
+
+ function blurTarget() {
+ if(valueElement === target) {
+ THIS.importColor();
+ }
+ if(THIS.pickerOnfocus) {
+ THIS.hidePicker();
+ }
+ }
+
+
+ function blurValue() {
+ if(valueElement !== target) {
+ THIS.importColor();
+ }
+ }
+
+
+ function setPad(e) {
+ var posM = jscolor.getMousePos(e);
+ var x = posM[0]-posPad[0];
+ var y = posM[1]-posPad[1];
+ switch(modeID) {
+ case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
+ case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
+ }
+ }
+
+
+ function setSld(e) {
+ var posM = jscolor.getMousePos(e);
+ var y = posM[1]-posPad[1];
+ switch(modeID) {
+ case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
+ case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
+ }
+ }
+
+
+ var THIS = this;
+ var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
+ var abortBlur = false;
+ var
+ valueElement = jscolor.fetchElement(this.valueElement),
+ styleElement = jscolor.fetchElement(this.styleElement);
+ var
+ holdPad = false,
+ holdSld = false;
+ var
+ posPad,
+ posSld;
+ var
+ leaveValue = 1<<0,
+ leaveStyle = 1<<1,
+ leavePad = 1<<2,
+ leaveSld = 1<<3;
+
+ // target
+ jscolor.addEvent(target, 'focus', function() {
+ if(THIS.pickerOnfocus) { THIS.showPicker(); }
+ });
+ jscolor.addEvent(target, 'blur', function() {
+ if(!abortBlur) {
+ window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
+ } else {
+ abortBlur = false;
+ }
+ });
+
+ // valueElement
+ if(valueElement) {
+ var updateField = function() {
+ THIS.fromString(valueElement.value, leaveValue);
+ };
+ jscolor.addEvent(valueElement, 'keyup', updateField);
+ jscolor.addEvent(valueElement, 'input', updateField);
+ jscolor.addEvent(valueElement, 'blur', blurValue);
+ valueElement.setAttribute('autocomplete', 'off');
+ }
+
+ // styleElement
+ if(styleElement) {
+ styleElement.jscStyle = {
+ backgroundColor : styleElement.style.backgroundColor,
+ color : styleElement.style.color
+ };
+ }
+
+ // require images
+ switch(modeID) {
+ case 0: jscolor.requireImage('hs.png'); break;
+ case 1: jscolor.requireImage('hv.png'); break;
+ }
+ jscolor.requireImage('cross.gif');
+ jscolor.requireImage('arrow.gif');
+
+ this.importColor();
+ }
+
+};
+
+
+jscolor.install();
diff --git a/config/strikeback/lua-5.1.4.tbz b/config/strikeback/lua-5.1.4.tbz
new file mode 100644
index 00000000..83fa2f42
--- /dev/null
+++ b/config/strikeback/lua-5.1.4.tbz
Binary files differ
diff --git a/config/strikeback/nmap.tbz b/config/strikeback/nmap.tbz
new file mode 100644
index 00000000..2cb1d954
--- /dev/null
+++ b/config/strikeback/nmap.tbz
Binary files differ
diff --git a/config/strikeback/parse.tmp b/config/strikeback/parse.tmp
new file mode 100644
index 00000000..085a73fb
--- /dev/null
+++ b/config/strikeback/parse.tmp
@@ -0,0 +1,289 @@
+#!/usr/local/bin/php
+<?php
+/**
+ * Script to transform multiple nmap XML output files (presumably of the same host/port range with different scan options) into a HTML table
+ *
+ * The canonical source of the latest version of this script is:
+ * <http://svn.jasonantman.com/misc-scripts/nmap-xml-to-table.php>
+ *
+ * Copyright 2011 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com> all rights reserved.
+ * Distribution and use of this script is unlimited, provided that you leave this notice intact and send any corrections/additions back to me.
+ *
+ * This is assuming a relatively simple scan - only one protocol, one or more hosts, one or more ports, and that different scans will be differentiated only by type
+ *
+ * USAGE: nmap-xml-to-table.php [xml file] [xml file] [...]
+ *
+ * $LastChangedRevision$
+ * $HeadURL$
+ *
+ */
+header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
+
+exec("mkdir /usr/local/www/packages/strikeback/reports");
+
+$dir = 'reports/';
+$reports = scandir($dir);
+//print_r($reports);
+
+foreach($reports as $i => $value){
+ $reports[$i] = "reports/".$reports[$i];
+ $i++;
+}
+
+array_shift($reports);
+array_shift($reports);
+//print_r($reports);
+//array_shift($argv); // get rid of script name
+
+
+
+
+//print_r($reports);
+$files = array();
+//foreach($argv as $file)
+foreach($reports as $file)
+{
+ if(file_exists($file) && is_readable($file))
+ {
+ $files[] = $file;
+ }
+ else
+ {
+ fwrite(STDERR, "File $file does not exist or is not readable, skipping.\n");
+ }
+}
+
+$results = array();
+$scanInfo = array();
+$hostAndPort = array();
+
+$count = 0;
+foreach($files as $file)
+{
+ $info = getScanResults($file);
+ $results[$count] = $info['hosts'];
+ $info['scan']['filename'] = $file;
+ $scanInfo[$count] = $info['scan'];
+ foreach($info['hosts'] as $host => $portArr)
+ {
+ if(! isset($hostAndPort[$host])){ $hostAndPort[$host] = array();}
+ foreach($portArr as $port => $foo)
+ {
+ $hostAndPort[$host][$port] = $foo['service'];
+ }
+ }
+ $count++;
+}
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>Condensed NMAP scan results</title>
+
+<style type="text/css">
+table.result {
+ border-width: 1px 1px 1px 1px;
+ border-spacing: 0px;
+ border-style: solid solid solid solid;
+ border-color: black black black black;
+ border-collapse: separate;
+ background-color: white;
+ margin-left: auto;
+ margin-right: auto;
+}
+table.result th {
+ border-width: 1px 1px 1px 1px;
+ padding: 2px 2px 2px 2px;
+ border-style: solid solid solid solid;
+ border-color: black black black black;
+ background-color: white;
+ -moz-border-radius: 0px 0px 0px 0px;
+}
+table.result td {
+ border-width: 1px 1px 1px 1px;
+ padding: 2px 2px 2px 2px;
+ border-style: solid solid solid solid;
+ border-color: black black black black;
+ background-color: white;
+ -moz-border-radius: 0px 0px 0px 0px;
+}
+h2 { text-align: center;}
+.lookhere { color: red;}
+</style>
+<script type="text/javascript" language="javascript">
+function show_hide(show) {
+<?php
+$tableint = 0;
+foreach($scanInfo as $num => $arr)
+{
+ $tableint++;
+
+ echo "if (tbl = document.getElementById(\"td".$tableint."\")) {\n";
+ echo "if (null == show) show = tbl.style.display == 'none';\n";
+ echo "tbl.style.display = (show ? '' : 'none');\n";
+ echo "}\n";
+
+ echo "if (tbl = document.getElementById(\"th".$tableint."\")) {\n";
+ echo "if (null == show) show = tbl.style.display == 'none';\n";
+ echo "tbl.style.display = (show ? '' : 'none');\n";
+ echo "}\n";
+}
+?>
+}
+</script>
+</head>
+<body>
+<h2>Nmap scan results (condensed)</h2>
+<a href="javascript:void();" onclick="show_hide()">Show/Hide scanned services</a>
+<?php
+
+// output scan information
+echo '<table class="result">'."\n";
+echo '<tr><th colspan="7">Scans</th></tr>'."\n";
+//echo '<tr><th>Num</th><th>proto</th><th>type</th><th>Services</th><th>num hosts</th><th>command</th><th>filename</th></tr>'."\n";
+echo '<tr><th>Num</th><th>proto</th><th>type</th><th id="th'.$tableint.'" style="display:none;">Services</th><th>filename</th><th>Delete</th></tr>'."\n";
+
+if(isset($_GET[delete])) {
+ echo($_GET[delete]);
+
+
+ exec("rm ".$_GET[delete]);
+ unlink($_GET[delete]);
+
+
+ echo "<script type=\"text/javascript\">\n";
+ echo "<!--\n";
+ echo "window.location = \"parse.php\"\n";
+ echo "//-->\n";
+ echo "<\/script>\n";
+
+}
+
+$tableint = 0;
+foreach($scanInfo as $num => $arr)
+{
+ $tableint++;
+ //echo($tableint);
+ //echo '<tr><td>'.$num.'</td><td>'.$arr['protocol'].'</td><td>'.$arr['type'].'</td><td>'.$arr['services'].'</td><td>'.$arr['numHosts'].'</td><td><pre>'.$arr['command'].'</pre></td><td>'.$arr['filename'].'</td></tr>'."\n";
+ echo '<tr><td>'.$num.'</td><td>'.$arr['protocol'].'</td><td>'.$arr['type'].'</td><td id="td'.$tableint.'" style="display:none;">'.$arr['services'].'</td><td>'.$arr['filename'].'</td><td><a href=parse.php?delete='.$arr['filename'].'>Delete</a></td></tr>'."\n";
+}
+echo '</table>'."\n";
+
+echo '<br />'."\n";
+
+echo '<table class="result">'."\n";
+echo '<tr><th colspan="'.(count($scanInfo)+1).'">Results</th></tr>'."\n";
+echo '<tr><th>Port</th>';
+for($i = 0; $i < count($scanInfo); $i++){ echo '<th>'.$i.' ('.$scanInfo[$i]['type'].')</th>';}
+echo '</tr>'."\n";
+foreach($hostAndPort as $host => $portArr)
+{
+ echo '<tr><th colspan="'.(count($scanInfo)+1).'">'.$host.'</th></tr>'."\n";
+
+ foreach($portArr as $portName => $service)
+ {
+ echo '<tr><td>'.$portName.($service != "" ? " (".$service.")" : "").'</td>';
+ foreach($scanInfo as $scanNum => $arr)
+ {
+ if(isset($results[$scanNum][$host][$portName]))
+ {
+ echo '<td>'.(($results[$scanNum][$host][$portName]['state'] == "open" || $results[$scanNum][$host][$portName]['state'] == "closed" || $results[$scanNum][$host][$portName]['state'] == "unfiltered") ? '<span class="lookhere">' : '').$results[$scanNum][$host][$portName]['state'].' ('.$results[$scanNum][$host][$portName]['state_reason'].(isset($results[$scanNum][$host][$portName]['state_reason_ip']) ? ' '.$results[$scanNum][$host][$portName]['state_reason_ip'] : '').')'.(($results[$scanNum][$host][$portName]['state'] == "open" || $results[$scanNum][$host][$portName]['state'] == "closed" || $results[$scanNum][$host][$portName]['state'] == "unfiltered") ? '</span>' : '').'</td>';
+ }
+ else
+ {
+ echo '<td><em>n/a</em></td>';
+ }
+ }
+ echo '</tr>'."\n";
+ }
+
+}
+echo '</table>'."\n";
+
+/**
+ * Parse meaningful information from a nmap XML output file and return it as an array
+ *
+ * @return array
+ */
+function handleError($errno, $errstr, $errfile, $errline, array $errcontext)
+{
+ // error was suppressed with the @-operator
+ if (0 === error_reporting()) {
+ return false;
+ }
+
+ throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
+}
+set_error_handler('handleError');
+
+function getScanResults($file)
+{
+ try {
+ $xml = simplexml_load_file($file);
+
+ $result = array("scan" => array(), "hosts" => array());
+
+ $command = $xml->attributes();
+ $command = (string)$command['args'];
+ $result['scan']['command'] = $command;
+
+ $foo = $xml->scaninfo->attributes();
+ $result['scan']['type'] = (string)$foo['type'];
+ $result['scan']['protocol'] = (string)$foo['protocol'];
+ $result['scan']['services'] = (string)$foo['services'];
+
+ $count = 0;
+ foreach($xml->host as $host)
+ {
+ $count++;
+
+ $foo = $host->address->attributes();
+ $addr = (string)$foo['addr'];
+
+ $arr = array(); // array to hold ports and results
+
+ // <port protocol="tcp" portid="445"><state state="filtered" reason="admin-prohibited" reason_ttl="241" reason_ip="67.83.255.41"/><service name="microsoft-ds" method="table" conf="3" /></port>
+ foreach($host->ports->port as $port)
+ {
+ $foo = $port->attributes();
+ $bar = array();
+
+ $name = (string)($foo['protocol']." ".$foo['portid']);
+ $bar['protocol'] = (string)$foo['protocol'];
+ $bar['portid'] = (string)$foo['portid'];
+ $bar['name'] = $name;
+
+ $foo = $port->state->attributes();
+ $bar['state'] = (string)$foo['state'];
+ $bar['state_reason'] = (string)$foo['reason'];
+ $bar['state_reason_ttl'] = (string)$foo['reason_ttl'];
+ if(isset($foo['reason_ip'])){ $bar['state_reason_ip'] = (string)$foo['reason_ip'];}
+
+ if($port->service)
+ {
+ $foo = $port->service->attributes();
+ $bar['service'] = (string)$foo['name'];
+ }
+
+ $arr[$name] = $bar;
+ }
+ $result['hosts'][$addr] = $arr;
+ }
+
+ $result['scan']['numHosts'] = $count;
+ return $result;
+
+} catch (ErrorException $e) {
+ echo ("fail");
+}
+}
+
+?>
+</body>
+</html> \ No newline at end of file
diff --git a/config/strikeback/pcre-8.02.tbz b/config/strikeback/pcre-8.02.tbz
new file mode 100644
index 00000000..ff3f3087
--- /dev/null
+++ b/config/strikeback/pcre-8.02.tbz
Binary files differ
diff --git a/config/strikeback/pkg-config-0.23_1.tbz b/config/strikeback/pkg-config-0.23_1.tbz
new file mode 100644
index 00000000..5c44aafd
--- /dev/null
+++ b/config/strikeback/pkg-config-0.23_1.tbz
Binary files differ
diff --git a/config/strikeback/settings.tmp b/config/strikeback/settings.tmp
new file mode 100644
index 00000000..f9c05357
--- /dev/null
+++ b/config/strikeback/settings.tmp
@@ -0,0 +1,337 @@
+<?php
+$pgtitle = "Services: strikeback - Settings";
+ // TomSchaefer.org strikeback package 2011
+ //
+ // Notes: Find: ^(.*)$
+ // Replace: ob_start();\n$results = exec("cat countries.txt | grep XX");\nob_end_clean();\n\tif ($results == 'XX')\n\t\techo "\1";\n\telse\n\t\techo "\1";\n
+ //
+ //
+ //
+ //
+ //require_once('config.inc');
+ require("guiconfig.inc");
+ include("head.inc");
+
+ //set the config as a global variable
+ global $config;
+
+ $global_usage = '/usr/local/www/packages/countryblock/global_usage';
+ //$fh = fopen($global_usage, 'r');
+
+ //phpinfo();
+
+ /* read DB into array */
+function strikeback_read_db() {
+ global $g;
+
+ $sbdb = array();
+
+ $sbdblck = lock('strikebackdb');
+ $fd = @fopen("{$g['vardb_path']}/strikeback.db", "r");
+ if ($fd) {
+ while (!feof($fd)) {
+ $line = trim(fgets($fd));
+ if ($line)
+ $sbdb[] = explode(",", $line);
+ }
+ fclose($fd);
+ }
+ unlock($sbdblck);
+ return $sbdb;
+}
+
+/* write DB */
+function strikeback_write_db($sbdb) {
+ global $g;
+
+ $sbdblck = lock('strikebackdb', LOCK_EX);
+ $fd = @fopen("{$g['vardb_path']}/strikeback.db", "w");
+ if ($fd) {
+ //foreach ($sbdb as $cpent) {
+ //fwrite($fd, join(",", $cpent) . "\n");
+ fwrite($fd, join(",", $sbdb) . "\n");
+ //}
+ fclose($fd);
+ }
+ unlock($sbdblck);
+}
+
+?>
+<head>
+<script type="text/javascript" src="http://jscolor.com/jscolor/jscolor.js"></script>
+
+</head>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<form method=POST action="">
+
+<?php if ($savemsg_cb) print_info_box($savemsg_cb);
+ //if ($output) print_info_box($output,$output2);
+ echo($output);
+ echo($output2);
+ ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Log Viewer", false, "strikeback.php");
+ $tab_array[1] = array("Settings", true, "settings.php");
+
+ $tab_array[4] = array("Help", false, "help.php");
+ //$tab_array[5] = array("Email", false, "email.php");
+ $tab_array[6] = array("Results", false, "parse.php\" target=\"_blank\"");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Settings</td>
+
+ </tr>
+
+ <tr>
+ <td class="listlr" valign="middle">
+
+<?php
+
+conf_mount_rw();
+
+
+
+ if(isset($_POST['formSubmit']))
+ {
+
+ if(isset($_POST["log_ip"])) {
+ $var_log_ip = "set log_ip true";
+ }else{
+ $var_log_ip = "set log_ip false";
+ }
+ if(isset($_POST["ignore_dns"])) {
+ $var_ignore_dns = "set ignore_dns";
+ }else{
+ $var_ignore_dns = "# set ignore_dns";
+ }
+ if(isset($_POST["ignore_80"])) {
+ $var_ignore_80 = "ignore tcp dport 80";
+ }else{
+ $var_ignore_80 = "# ignore tcp dport 80";
+ }
+ if(isset($_POST["ignore_ICMP"])) {
+ $var_ignore_ICMP = "ignore icmp type unreach \n ignore icmp type !echo";
+ }else{
+ $var_ignore_ICMP = "# ignore icmp type unreach \n # ignore icmp type !echo";
+ }
+ $sbdbpost = array($_POST["https_color"],$_POST["imaps_color"],$_POST["ftp_color"],$_POST["submission_color"],$_POST["auth_color"],$_POST["netbios-ssn_color"],$_POST["smtp_color"],$_POST["pop3_color"],$_POST["telnet_color"],$_POST["blackjack_color"],$_POST["rap_color"],$_POST["rdp_color"],$_POST["portscan_color"],$_POST["dgram_color"],$_POST["ssh_color"],$_POST["runas"],$_POST["runasgrp"],$var_log_ip,$var_ignore_dns,$_POST["ignore_dns_sev1"],$_POST["ignore_dns_sev2"],$_POST["ignore_dns_sev3"],$var_ignore_80,$var_ignore_ICMP);
+
+ strikeback_write_db($sbdbpost);
+
+ //write settings file
+ mwexec('touch /usr/local/etc/iplog.conf');
+ $fp = fopen('/usr/local/etc/iplog.conf', 'w');
+ //fwrite($fp, '/*'."\n".'** $Id: example-iplog.conf,v 1.2 2000/12/31 18:40:40 odin Exp $'."\n".'**'."\n".'** Example iplog configuration file.'."\n".'** Edit me and copy me to'."\n".'/usr/local/etc/iplog.conf'."\n".'**'."\n".'** See iplog.conf(5) for details on syntax and a full description'."\n".'** of available options.'."\n".'*/'."\n".'');
+ fwrite($fp, 'user '.$_POST["runas"]."\n");
+ fwrite($fp, 'group '.$_POST["runasgrp"]."\n");
+ fwrite($fp, 'pid-file /var/run/iplog/iplog.pid'."\n");
+ fwrite($fp, 'logfile /var/log/iplog'."\n".'facility log_daemon'."\n".'priority log_info'."\n");
+ fwrite($fp, $var_log_ip."\n");
+ fwrite($fp, 'set log_dest false'."\n");
+ fwrite($fp, $var_ignore_dns."\n");
+ fwrite($fp, 'ignore udp from '.$_POST["ignore_dns_sev1"].' sport 53'."\n");
+ fwrite($fp, 'ignore udp from '.$_POST["ignore_dns_sev2"].' sport 53'."\n");
+ fwrite($fp, 'ignore udp from '.$_POST["ignore_dns_sev3"].' sport 53'."\n");
+ fwrite($fp, 'log tcp dport 1045:1055 sport ftp-data'."\n");
+ fwrite($fp, 'ignore tcp dport 1024: sport 20'."\n");
+ fwrite($fp, $var_ignore_80."\n");
+ fwrite($fp, $var_ignore_ICMP."\n");
+ fwrite($fp, 'ignore udp from 127.1.2/24'."\n");
+ fwrite($fp, 'ignore udp from 127.1.2/255.255.255.0'."\n");
+ fclose($fp);
+
+ }
+conf_mount_ro();
+?>
+
+
+
+
+</head>
+
+
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr>
+ <td >
+
+
+ </form>
+
+ <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
+ <?php
+ global $sbdb;
+ $sbdb = strikeback_read_db();
+
+ ?>
+ <p>Log Viewer Color Settings <img src="color.png" height="20" width="20"></p>
+ <hr>
+ <table width="100%" border="0">
+
+ <tr>
+ <td>https<br />
+ <input type="text" name="https_color" class="color" value="<?php print_r($sbdb[0][0]); ?>"></td>
+ <td>imaps<br />
+ <input type="text" name="imaps_color" class="color" value="<?php print_r($sbdb[0][1]); ?>"></td>
+ <td>ftp<br />
+ <input type="text" name="ftp_color" class="color" value="<?php print_r($sbdb[0][2]); ?>"></td>
+ <td>submission<br />
+ <input type="text" name="submission_color" class="color" value="<?php print_r($sbdb[0][3]); ?>"></td>
+ </tr>
+ <tr>
+ <td>auth<br />
+ <input type="text" name="auth_color" class="color" value="<?php print_r($sbdb[0][4]); ?>"></td>
+ <td>netbios-ssn<br />
+ <input type="text" name="netbios-ssn_color" class="color" value="<?php print_r($sbdb[0][5]); ?>"></td>
+ <td>smtp<br />
+ <input type="text" name="smtp_color" class="color" value="<?php print_r($sbdb[0][6]); ?>"></td>
+ <td>pop3<br />
+ <input type="text" name="pop3_color" class="color" value="<?php print_r($sbdb[0][7]); ?>"></td>
+ </tr>
+ <tr>
+ <td>telnet<br />
+ <input type="text" name="telnet_color" class="color" value="<?php print_r($sbdb[0][8]); ?>"></td>
+ <td>blackjack<br />
+ <input type="text" name="blackjack_color" class="color" value="<?php print_r($sbdb[0][9]); ?>"></td>
+ <td>rap<br />
+ <input type="text" name="rap_color" class="color" value="<?php print_r($sbdb[0][10]); ?>"></td>
+ <td>RDP<br />
+ <input type="text" name="rdp_color" class="color" value="<?php print_r($sbdb[0][11]); ?>"></td>
+ </tr>
+ <tr>
+ <td>port scan<br />
+ <input type="text" name="portscan_color" class="color" value="<?php print_r($sbdb[0][12]); ?>"></td>
+ <td>dgram<br />
+ <input type="text" name="dgram_color" class="color" value="<?php print_r($sbdb[0][13]); ?>"></td>
+ <td>SSH<br />
+ <input type="text" name="ssh_color" class="color" value="<?php print_r($sbdb[0][14]); ?>"></td>
+
+ </tr>
+</table>
+<br/><br/>
+ <p>iplog Settings</p>
+ <hr>
+ <table width="100%" border="0">
+ <tr>
+ <td>Run as user<br />
+ <input type="text" name="runas" value="<?php print_r($sbdb[0][15]); ?>"></td>
+ <td>Run as group<br />
+ <input type="text" name="runasgrp" value="<?php print_r($sbdb[0][16]); ?>"></td>
+ <td>Log IP<br />
+ <?php
+ if ($sbdb[0][17] == "set log_ip true"){
+ echo "<input type='checkbox' checked name='log_ip'>";
+ }else{
+ echo "<input type='checkbox' name='log_ip'>";
+ }
+ ?>
+ </td>
+
+ <td>Ignore DNS<br />
+ <?php
+ if ($sbdb[0][18] == "set ignore_dns"){
+ echo "<input type='checkbox' checked name='ignore_dns'>";
+ }else{
+ echo "<input type='checkbox' name='ignore_dns'>";
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+
+ <td>Ignore DNS Server<br />
+ <input type="text" name="ignore_dns_sev1" value="<?php print_r($sbdb[0][19]); ?>"></td>
+ <td>Ignore DNS Server 2<br />
+ <input type="text" name="ignore_dns_sev2" value="<?php print_r($sbdb[0][20]); ?>"></td>
+ <td>Ignore DNS Server 3<br />
+ <input type="text" name="ignore_dns_sev3" value="<?php print_r($sbdb[0][21]); ?>"></td>
+ <td>&nbsp;</td>
+ </tr>
+ <tr>
+ <td>Ignore port 80<br />
+ <?php
+ if ($sbdb[0][22] == "ignore tcp dport 80"){
+ echo "<input type='checkbox' checked name='ignore_80'>";
+ }else{
+ echo "<input type='checkbox' name='ignore_80'>";
+ }
+ ?>
+ </td>
+ <td>Ignore ICMP<br />
+ <?php
+ if ($sbdb[0][23] == "ignore icmp type unreach"){
+ echo "<input type='checkbox' checked name='ignore_ICMP'>";
+ }else{
+ echo "<input type='checkbox' name='ignore_ICMP'>";
+ }
+ ?>
+ </td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+
+</table>
+
+
+ <br />
+ <br/>
+
+
+
+
+
+
+
+ <input type="submit" name="formSubmit" value="Save" /><br><br>
+ </p>
+
+ <br/>
+ <a href="http://ojnk.sourceforge.net/stuff/iplog.readme">iplog</a> config file: /usr/local/etc/iplog.conf
+
+
+ </div>
+ <?php
+ //This input guarantees that a POST is sent
+ echo "<input type='hidden' name='zzz' value='required'>";
+ ?>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+
+
+ </tr>
+
+
+ </table>
+ </div>
+ <br>
+
+ <br><br>
+
+ </p>
+ <p>
+</p>
+</td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
diff --git a/config/strikeback/strikeback.db b/config/strikeback/strikeback.db
new file mode 100644
index 00000000..5f8873ef
--- /dev/null
+++ b/config/strikeback/strikeback.db
@@ -0,0 +1,2 @@
+000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,000000,FF0A0A,DBDBDB,5940FF,root,nogroup,set log_ip true,set ignore_dns,208.67.222.222,208.67.220.220,8.8.8.8,ignore tcp dport 80,# ignore icmp type unreach
+ # ignore icmp type !echo
diff --git a/config/strikeback/strikeback.tmp b/config/strikeback/strikeback.tmp
new file mode 100644
index 00000000..864e467b
--- /dev/null
+++ b/config/strikeback/strikeback.tmp
@@ -0,0 +1,364 @@
+<?php
+$pgtitle = "Services: Strikeback";
+ // TomSchaefer.org strikeback package 2011
+ //
+ // Notes: Find: ^(.*)$
+ // Replace: ob_start();\n$results = exec("cat countries.txt | grep XX");\nob_end_clean();\n\tif ($results == 'XX')\n\t\techo "\1";\n\telse\n\t\techo "\1";\n
+ //
+ //
+ //
+ //
+ //require_once('config.inc');
+ require_once("functions.inc");
+ require("guiconfig.inc");
+ include("head.inc");
+
+ //set the config as a global variable
+ global $config;
+
+ $global_usage = '/usr/local/www/packages/strikeback/global_usage';
+ //$fh = fopen($global_usage, 'r');
+
+ //phpinfo();
+
+ /* read DB into array */
+function strikeback_read_db() {
+ global $g;
+
+ $sbdb = array();
+
+ $sbdblck = lock('strikebackdb');
+ $fd = @fopen("{$g['vardb_path']}/strikeback.db", "r");
+ if ($fd) {
+ while (!feof($fd)) {
+ $line = trim(fgets($fd));
+ if ($line)
+ $sbdb[] = explode(",", $line);
+ }
+ fclose($fd);
+ }
+ unlock($sbdblck);
+ return $sbdb;
+}
+
+/* write DB */
+function strikeback_write_db($sbdb) {
+ global $g;
+
+ $sbdblck = lock('strikebackdb', LOCK_EX);
+ $fd = @fopen("{$g['vardb_path']}/strikeback.db", "w");
+ if ($fd) {
+ //foreach ($sbdb as $cpent) {
+ //fwrite($fd, join(",", $cpent) . "\n");
+ fwrite($fd, join(",", $sbdb) . "\n");
+ //}
+ fclose($fd);
+ }
+ unlock($sbdblck);
+}
+if(isset($_GET[target])) {
+ mwexec("mkdir /usr/local/www/packages/strikeback/reports");
+ //mwexec("/usr/local/bin/nmap -oX /usr/local/www/packages/strikeback/reports/".$_GET[target].".xml -vvsS -sU -sY -O ".$_GET[target]."> /dev/null 2>&1 &");
+ mwexec("/usr/local/bin/nmap -oX /usr/local/www/packages/strikeback/reports/".$_GET[target].".xml -vv -sS -sU -sY -O ".$_GET[target]);
+
+ echo "<script type=\"text/javascript\">\n";
+ echo "\n";
+ echo "window.open( \"parse.php\" )\n";
+ echo "</script> \n";
+
+}
+if (count($_POST)>0) {
+
+ conf_mount_rw();
+
+ $ent = array();
+
+ if ($_POST['enable'] == 1) {
+ //echo "enabled";
+ $config['installedpackages']['strikeback_settings']['config'][0]['enable'] = 1;
+ mwexec("/usr/bin/sed -i -e 's/iplog_enable=\"NO\"/iplog_enable=\"YES\"/g' /usr/local/etc/rc.d/iplog");
+ mwexec("rm /usr/local/etc/rc.d/iplog-e");
+ mwexec("/usr/local/etc/rc.d/iplog start");
+ mwexec("touch /usr/local/www/packages/strikeback/ENABLED");
+
+
+ }
+ else {
+ //echo "disabled";
+ $config['installedpackages']['strikeback_settings']['config'][0]['enable'] = 0;
+ mwexec("/usr/bin/sed -i -e 's/iplog_enable=\"YES\"/iplog_enable=\"NO\"/g' /usr/local/etc/rc.d/iplog");
+ mwexec("rm /usr/local/etc/rc.d/iplog-e");
+ mwexec("/usr/local/etc/rc.d/iplog stop");
+ mwexec("rm /usr/local/www/packages/strikeback/ENABLED");
+
+ }
+
+
+ //write_config();
+ //services_dnsmasq_configure();
+ sleep(1);
+ $savemsg_cb = "strikeback settings have been saved/updated. ";
+ conf_mount_ro();
+}
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<form method=POST action="">
+<?php
+
+if (file_exists("/usr/local/www/packages/strikeback/ENABLED")){
+ echo "<input name='enable' type='checkbox' value='1' checked>\n";
+} else {
+ echo "<input name='enable' type='checkbox' value='1'>\n";
+}
+
+//if ($config['installedpackages']['strikeback_settings']['config'][0]['enable'] == 1) {
+ //echo('enabled');
+ //echo "<input name='enable' type='checkbox' value='1' checked>\n";
+//}
+//elseif ($resultstop > '0') {
+//echo "<input name='enable' type='checkbox' value='1' checked>\n";
+//}
+//else {
+// echo "<input name='enable' type='checkbox' value='1'>\n";
+//}
+?><strong>Enable Strikeback</strong><br><br>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array("Log Viewer", true, "strikeback.php");
+ $tab_array[1] = array("Settings", false, "settings.php");
+ //$tab_array[2] = array("Whitelist", false, "whitelist.php");
+ //$tab_array[3] = array("Interfaces", false, "strikeback_if.php");
+ $tab_array[4] = array("Help", false, "help.php");
+ //$tab_array[5] = array("Email", false, "email.php");
+ $tab_array[6] = array("Results", false, "parse.php\" target=\"_blank\"");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr">Main</td>
+
+ </tr>
+
+ <tr>
+ <td class="listlr" valign="middle">
+
+<?php
+
+conf_mount_rw();
+
+if (file_exists("/var/log/iplog")){
+
+}else{
+echo("iplog not started");
+
+}
+
+ if(isset($_POST['formSubmit']))
+ {
+
+ mwexec("mkdir /var/run/iplog");
+ mwexec("rm /var/log/iplog");
+ mwexec("touch /var/log/iplog");
+ mwexec("/usr/local/etc/rc.d/iplog restart");
+
+
+ }
+conf_mount_ro();
+?>
+<style type="text/css">
+
+a img {border:none; }
+
+</style>
+</head>
+
+
+
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr>
+ <td >
+
+
+ </form>
+
+ <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
+ <p>
+
+ </p>
+ <h3><p style="font-family:Arial, Helvetica, sans-serif">
+ <?php
+ //TESTING AREA
+ //echo("testing AREA <br />");
+ $sbdb = strikeback_read_db();
+
+ //print just one element out of db
+ //print_r($sbdb[0][1]);
+ //print line out of db
+ //print_r($sbdb[0]);
+
+ //$cpdbtest = array("blueT","yellow","testing","enddblineTom");
+ //print_r($cpdbtest);
+ //strikeback_write_db($cpdbtest);
+
+
+ //echo("<br />END testing AREA <br />");
+ //END TESTING
+ //mwexec("touch /var/log/iplog"); //suppress errors so noobs on forums won't bother me
+ if (file_exists("/var/log/iplog")){
+ $lines = file('/var/log/iplog');
+ }
+
+ //arrays to catch the things you need
+ $ssh = array();
+ $port_scan = array();
+ $ip_addr = array();
+
+ // fill the arrays
+ if (file_exists("/var/log/iplog")){
+ foreach($lines as $line){
+ if(preg_match('/ssh connection attempt/',$line)){ $ssh[] = $line; }
+ if(preg_match('/(\d+).(\d+).(\d+).(\d+)/',$line)){ $ip_addr[] = $line; }
+ }
+
+ foreach($lines as $line){
+ if(preg_match('/ssh connection attempt/',$line)){
+ echo("<font color='#" . $sbdb[0][14] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/port.scan/',$line)){
+ echo("<font color='#" . $sbdb[0][12] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ echo("<a href=strikeback.php?target=");
+ $ipaddress = preg_match_all('/(\d+)\.(\d+)\.(\d+)\.(\d+)/', $line, $out);
+ print_r($out[0][0]);
+ echo("><font style='text-decoration:underline;' color='#9933CC'>Execute Strikeback</font></a>");
+ //echo($out[0]);
+
+ }
+ elseif(preg_match('/dgram/',$line)){
+ echo("<font color='#" . $sbdb[0][13] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/https/',$line)){
+ echo("<font color='#" . $sbdb[0][0] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/imaps/',$line)){
+ echo("<font color='#" . $sbdb[0][1] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/ftp/',$line)){
+ echo("<font color='#" . $sbdb[0][2] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/submission/',$line)){
+ echo("<font color='#" . $sbdb[0][3] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/auth.connection/',$line)){
+ echo("<font color='#" . $sbdb[0][4] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/netbios-ssn/',$line)){
+ echo("<font color='#" . $sbdb[0][5] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/smtp/',$line)){
+ echo("<font color='#" . $sbdb[0][6] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/pop3/',$line)){
+ echo("<font color='#" . $sbdb[0][7] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/telnet/',$line)){
+ echo("<font color='#" . $sbdb[0][8] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/blackjack/',$line)){
+ echo("<font color='#" . $sbdb[0][9] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/rap.connection/',$line)){
+ echo("<font color='#" . $sbdb[0][10] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ elseif(preg_match('/port.3389/',$line)){
+ echo("<font color='#" . $sbdb[0][11] . "'>");
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ echo("</font>");
+ }
+ else {
+ echo preg_replace('/(\d+)\.(\d+)\.(\d+)\.(\d+)/','<a target="_blank" href=\'http://dnstools.com/?count=1&lookup=on&wwwhois=on&portNum=80&all=on&target=$1.$2.$3.$4&submit=Go%21\'>$1.$2.$3.$4</a>',$line);
+ }
+
+ echo("<br />");
+ }
+ }
+
+ ?>
+ <font color="#9933CC" >
+ <br/><br/>
+ <input type="submit" name="formSubmit" value="Clear Log" />
+ </p>
+</h3>
+</form>
+<br/>
+
+
+</div>
+<?php
+ //This input guarantees that a POST is sent
+ echo "<input type='hidden' name='zzz' value='required'>";
+?>
+
+</td>
+</tr>
+</table>
+ </td>
+
+
+ </tr>
+
+
+</table>
+</div>
+<br>
+
+<br><br>
+<input type="submit" value="Save"><br><br>
+<p>
+</p>
+</td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
+
diff --git a/config/strikeback/strikeback.xml b/config/strikeback/strikeback.xml
new file mode 100644
index 00000000..193ef61d
--- /dev/null
+++ b/config/strikeback/strikeback.xml
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* $Id$ */
+/* ========================================================================== */
+/*
+ strikeback.xml
+ Copyright (C) 2011 Tom Schaefer TomSchaefer.org
+ All rights reserved.
+ */
+/* ========================================================================== */
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+/* ========================================================================== */
+ ]]>
+ </copyright>
+ <description>Strikeback</description>
+ <requirements>Active Internet</requirements>
+ <faq>http://forum.pfsense.org/index.php/topic,37225.0.html</faq>
+ <name>Strikeback Settings</name>
+ <version>0.1</version>
+ <title>Settings</title>
+ <include_file>/usr/local/pkg/strikeback.inc</include_file>
+ <menu>
+ <name>Stikeback</name>
+ <tooltiptext>Strikeback settings</tooltiptext>
+ <section>Services</section>
+ <configfile>strikeback.xml</configfile>
+ <url>/packages/strikeback/strikeback.php</url>
+ </menu>
+ <tabs>
+ <tab>
+ <text>Settings</text>
+ <url>/packages/strikeback/strikeback.php</url>
+ <active/>
+ </tab>
+ </tabs>
+ <configpath>installedpackages->package->$packagename->configuration->strikeback</configpath>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/strikeback.xml</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/strikeback.inc</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/strikeback.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/index.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/firewall_shaper.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/help.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/settings.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/iplog-2.2.3_3.tbz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/parse.tmp</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/nmap.tbz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/strikeback.db</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/pkg-config-0.23_1.tbz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/lua-5.1.4.tbz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/pcre-8.02.tbz</item>
+ </additional_files_needed>
+ <additional_files_needed>
+ <prefix>/tmp/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.org/packages/config/strikeback/jscolor.js</item>
+ </additional_files_needed>
+ <fields>
+ <field>
+ <fielddescr>Variable One</fielddescr>
+ <fieldname>var1</fieldname>
+ <description>Enter the variable one here.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Variable Two</fielddescr>
+ <fieldname>var1</fieldname>
+ <description>Enter the variable one here.</description>
+ <type>input</type>
+ </field>
+ </fields>
+ <custom_add_php_command>
+ </custom_add_php_command>
+ <custom_php_resync_config_command>
+ php_sync_package_sb();
+ </custom_php_resync_config_command>
+ <custom_delete_php_command>
+ php_sync_package_sb();
+ </custom_delete_php_command>
+ <custom_php_install_command>
+ php_install_command_sb();
+ </custom_php_install_command>
+ <custom_php_deinstall_command>
+ deinstall_command_sb();
+ </custom_php_deinstall_command>
+</packagegui>