File: profile_page_scripts.lua

package info (click to toggle)
modsecurity-crs 2.2.9-1+deb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 3,064 kB
  • ctags: 219
  • sloc: perl: 1,002; ansic: 727; ruby: 69; makefile: 18
file content (38 lines) | stat: -rwxr-xr-x 925 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/lua

function main()

  local response_body = m.getvar("RESPONSE_BODY", "none");
  
  if response_body ~= "" then
  
  local _, nscripts = string.gsub(response_body, "<script", "");
  local _, niframes = string.gsub(response_body, "<iframe", "");
  local _, nlinks = string.gsub(response_body, "a href", "");
  local _, nimages = string.gsub(response_body, "<img", "");

  if nscripts == nil then
    nscripts = 0
  end
  if niframes == nil then
    niframes = 0
  end
  if nlinks == nil then
    nlinks = 0
  end
  if nimages == nil then
    nimages = 0
  end
  m.log(3, "niframes[" .. niframes .. "]");
  m.setvar("tx.niframes", niframes);
  m.log(3, "nscripts[" .. nscripts .. "]");
  m.setvar("tx.nscripts", nscripts);  
  m.log(3, "nlinks[" .. nlinks .. "]");
  m.setvar("tx.nlinks", nlinks);
  m.log(3, "nimages[" .. nimages .. "]");
  m.setvar("tx.nimages", nimages); 
   return nil;
end

  return nil;
end