setConfig(arguments.ConfigPath, arguments.ConfigFilename);
this.ConfigPath = arguments.ConfigPath;
this.configFilename = arguments.ConfigFilename;
return this;
var IniEntries = GetProfileSections(arguments.ConfigPath & "/" & arguments.ConfigFilename).CFFormProtect;
var i = "";
variables.Config = StructNew();
for (i=1;i LTE ListLen(IniEntries);i=i+1) {
variables.Config[ListGetAt(IniEntries,i)] = GetProfileString(arguments.ConfigPath & "/" & arguments.ConfigFilename,"CFFormProtect",ListGetAt(IniEntries,i));
}
//set logfile
if (NOT Len(variables.Config.logFile)) { variables.Config.logFile = "CFFormProtect"; }
var Pass = true;
// each time a test fails, totalPoints is incremented by the user specified amount
var TotalPoints = 0;
// setup a variable to store a list of tests that failed, for informational purposes
var TestResults = StructNew();
// Begin tests
// Test for mouse movement
try {
if (getConfig().mouseMovement) {
TestResults.MouseMovement = testMouseMovement(arguments.FormStruct);
if (NOT TestResults.MouseMovement.Pass) {
// The mouse did not move
TotalPoints = TotalPoints + getConfig().mouseMovementPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test for used keyboard
try {
if (getConfig().usedKeyboard) {
TestResults.usedKeyboard = testUsedKeyboard(arguments.FormStruct);
if (NOT TestResults.usedKeyboard.Pass) {
// No keyboard activity was detected
TotalPoints = TotalPoints + getConfig().usedKeyboardPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test for time taken on the form
try {
if (getConfig().timedFormSubmission) {
TestResults.timedFormSubmission = testTimedFormSubmission(arguments.FormStruct);
if (NOT TestResults.timedFormSubmission.Pass) {
// Time was either too short, too long, or the form field was altered
TotalPoints = TotalPoints + getConfig().timedFormPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test for empty hidden form field
try {
if (getConfig().hiddenFormField) {
TestResults.hiddenFormField = testHiddenFormField(arguments.FormStruct);
if (NOT TestResults.hiddenFormField.Pass) {
// The submitter filled in a form field hidden via CSS
TotalPoints = TotalPoints + getConfig().hiddenFieldPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test Akismet
try {
if (getConfig().akismet) {
TestResults.akismet = testAkismet(arguments.FormStruct);
if (NOT TestResults.akismet.Pass) {
// Akismet says this form submission is spam
TotalPoints = TotalPoints + getConfig().akismetPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test LinkSleeve
try {
if (getConfig().linkSleeve) {
TestResults.linkSleeve = testLinkSleeve(arguments.FormStruct);
if (NOT TestResults.linkSleeve.Pass) {
// LinkSleeve says this form submission is spam
TotalPoints = TotalPoints + getConfig().linkSleevePoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test tooManyUrls
try {
if (getConfig().tooManyUrls) {
TestResults.tooManyUrls = TestTooManyUrls(arguments.FormStruct);
if (NOT TestResults.tooManyUrls.Pass) {
// Submitter has included too many urls in at least one form field
TotalPoints = TotalPoints + getConfig().tooManyUrlsPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test spamStrings
try {
if (getConfig().teststrings) {
TestResults.SpamStrings = testSpamStrings(arguments.FormStruct);
if (NOT TestResults.SpamStrings.Pass) {
// Submitter has included a spam string in at least one form field
TotalPoints = TotalPoints + getConfig().spamStringPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Test Project Honey Pot
try {
if (getConfig().projectHoneyPot) {
TestResults.ProjHoneyPot = testProjHoneyPot(arguments.FormStruct);
if (NOT TestResults.ProjHoneyPot.Pass) {
// Submitter has included a spam string in at least one form field
TotalPoints = TotalPoints + getConfig().projectHoneyPotPoints;
}
}
}
catch(any excpt) { /* an error occurred on this test, but we will move one */ }
// Compare the total points from the spam tests to the user specified failure limit
if (TotalPoints GTE getConfig().failureLimit) {
Pass = false;
try {
if (getConfig().emailFailedTests) {
emailReport(TestResults=TestResults,FormStruct=FormStruct,TotalPoints=TotalPoints);
}
}
catch(any excpt) { /* an error has occurred emailing the report, but we will move on */ }
try {
if (getConfig().logFailedTests) {
logFailure(TestResults=TestResults,FormStruct=FormStruct,TotalPoints=TotalPoints,LogFile=getConfig().logFile);
}
}
catch(any excpt) { /* an error has occurred logging the spam, but we will move on */ }
}
return pass;
var Result = StructNew();
Result.Pass = false;
if (StructKeyExists(arguments.FormStruct,"formfield1234567891") AND IsNumeric(arguments.FormStruct.formfield1234567891)) {
Result.Pass = true;
}
return Result;
var Result = StructNew();
Result.Pass = false;
if (StructKeyExists(arguments.FormStruct,"formfield1234567892") AND IsNumeric(arguments.FormStruct.formfield1234567892)) {
Result.Pass = true;
}
return Result;
var Result = StructNew();
var FormDate = "";
var FormTime = "";
var FormDateTime = "";
//var FormTimeElapsed = "";
Result.Pass = true;
// Decrypt the initial form load time
if (StructKeyExists(arguments.FormStruct,"formfield1234567893") AND ListLen(arguments.FormStruct.formfield1234567893) eq 2) {
FormDate = ListFirst(arguments.FormStruct.formfield1234567893)-19740206;
if (Len(FormDate) EQ 7) {
FormDate = "0" & FormDate;
}
FormTime = ListLast(arguments.FormStruct.formfield1234567893)-19740206;
if (Len(FormTime)) {
// in original form, FormTime was always padded with a "0" below. In my testing, this caused the timed test to fail
// consistantly after 9:59am due to the fact it was shifting the time digits one place to the right with 2 digit hours.
// To make this work I added NumberFormat()
FormTime = NumberFormat(FormTime,'000000');
}
FormDateTime = CreateDateTime(Left(FormDate,4),Mid(FormDate,5,2),Right(FormDate,2),Left(FormTime,2),Mid(FormTime,3,2),Right(FormTime,2));
// Calculate how many seconds elapsed
Result.FormTimeElapsed = DateDiff("s",FormDateTime,Now());
if (Result.FormTimeElapsed LT getConfig().timedFormMinSeconds OR Result.FormTimeElapsed GT getConfig().timedFormMaxSeconds) {
Result.Pass = false;
}
}
else {
Result.Pass = false;
}
return Result;
var Result = StructNew();
Result.Pass = false;
if (StructKeyExists(arguments.FormStruct,"formfield1234567894") AND NOT Len(arguments.FormStruct.formfield1234567894)) {
Result.Pass = true;
}
return Result;
var Result = StructNew();
var AkismetKeyIsValid = false;
var AkismetHTTPRequest = true;
var logfile = getConfig().logFile;
Result.Pass = true;
Result.ValidKey = false;
var Result = StructNew();
var linkSleeveHTTPRequest = true;
var linkSleeveResult = 0;
var formData = "";
Result.Pass = true;
slv
#formData#
var Result = StructNew();
var checkfield = "";
var urlRegex = "(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»“”‘’]))";
var UrlCount = "";
Result.Pass = true;
for (checkfield in arguments.FormStruct) {
UrlCount = arrayLen(rematch(urlRegex,arguments.FormStruct[checkfield])) - 1;
if (UrlCount GTE getConfig().tooManyUrlsMaxUrls) {
Result.Pass = false;
break;
}
}
return Result;
var Result = StructNew();
var value = 0;
var teststrings = getConfig().spamstrings;
var checkfield = '';
Result.Pass = true;
// Loop through the list of spam strings to see if they are found in the form submission
for (checkfield in arguments.FormStruct) {
if (Result.Pass IS true) {
Result.Pass = listFindOneOf(arguments.FormStruct[checkfield],teststrings);
}
}
return Result;
var falsePositiveURL = "";
var missedSpamURL = "";
This message was marked as spam because:
- No mouse movement was detected.
- No keyboard activity was detected.
- The time it took to fill out the form was
too short.
too long.
It took them #arguments.FormStruct.formfield1234567893# seconds to submit the form, and your allowed
threshold is #getConfig().timedFormMinSeconds#-#getConfig().timedFormMaxSeconds#
seconds.
- The time it took to fill out the form did not fall within your
configured threshold of #getConfig().timedFormMinSeconds#-#getConfig().timedFormMaxSeconds#
seconds. Also, I think the form data for this field was tampered with by the
spammer.
- The hidden form field that is supposed to be blank contained data.
- One of the configured spam strings was found in the form submission.
- Akisment thinks this is spam, if it's not please mark this as a
false positive by clicking here.
Akismet did not think this message was spam. If it was, please notify Akismet that it
missed one.
- There were too many URLs in the form contents
- The user's IP address has been flagged by Project Honey Pot.
Failure score: #totalPoints#
Your failure threshold: #getConfig().failureLimit#
IP address: #cgi.remote_addr#
User agent: #cgi.http_user_agent#
Previous page: #cgi.http_referer#
Form variables:
var falsePositiveURL = "";
var missedSpamURL = "";
var LogText = "Message marked as spam! ";