Policy that detects a specific Webmail keyword and gives an alert message

book

Article ID: 166777

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

Policy that detects a specific Webmail keyword and gives an alert message
How can I scan webmail for keywords?
You want a policy that detects a specific Webmail keyword and gives an alert message

Resolution

Below is a sample policy that looks for the keyword "hello".  To use another keyword, just replace it with whatever you want.

This policy generates a Javascript alert, but it can be replaced with other types of actions such as a redirect to the corporate web usage policy.

NOTE : This policy may be CPU intensive as it uses the javatransform method.

SAMPLE POLICY:

Sample Policy
<Proxy>
action.findme(yes)
<Cache>
action.ForceUncompressedResponse(yes)
define action ForceUncompressedResponse
     delete(request.header.Accept-Encoding)
end

define javascript findme
   prolog <<EOT
function findmytext(f) {
for (var j=0;j < f.elements.length;j++) {
var reg1=new RegExp("(hello)","g");
if (!(f.elements[j].value.length==0)) {
if (f.elements[j].value.match(reg1)) {
alert("This URL had a sensitive key word - be aware");
}
}
}
}

function findmytextinform() {
for (var i=0;i < document.forms.length;i++) {
findmytext(document.forms[i]);
}
}
function timer() {
     findmytextinform();
     setTimeout("timer()",1000);
}

EOT
onload <<EOT
timer();
EOT
end javascript findme

define action findme
   transform findme

end