-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheu.ndsrf.caf.bsn11test.xml
51 lines (50 loc) · 1.04 KB
/
eu.ndsrf.caf.bsn11test.xml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
<content>
<custom_function>
<namespace>ndsrf</namespace>
<name>isBSN</name>
<return_type>boolean</return_type>
<parameter_types>string</parameter_types>
<execute_function_name>isBSN</execute_function_name>
<init_function_name>onInit</init_function_name>
<script_engine>javascript</script_engine>
<script>
//
// Created by : [email protected]
//
// install with:
// /opt/qradar/bin/contentManagement.pl -a update -f eu.ndsrf.caf.bsn11proef.xml
//
// AQL usage sample:
// select "BSN" as ii, NDSRF::ISBSN(ii) as ff from events last 1 DAYS
//
function onInit() {
};
function isBSN(in_BSN) {
var BSN = false;
try {
bsnnr=in_BSN.toString();
var checksum=0;
if(isNaN(bsnnr) || bsnnr.length!=9){
BSN=false;
}
else{
for(var i=0;i<8;i++){
checksum += (bsnnr.charAt(i)*(9-i));
}
checksum -= bsnnr.charAt(8);
if(checksum%11==0) {
BSN=true;
}
}
}
catch(err) {
BSN = false;
}
finally {
return BSN;
}
}
</script>
<username>admin</username>
</custom_function>
</content>