Skip to main content
. 2025 Jun 13;11:e2946. doi: 10.7717/peerj-cs.2946

Algorithm 1 . Function parameters encoding.

Require: parameter_list (a list of input parameters)
Ensure: feature_vector (a feature vector representing the parameters)
 1: Initialize an empty list called feature_vector
 2: for each parameter in parameter_list do
 3:   Identify the type of parameter using regular expressions:
 4:   if parameter matches an integer pattern then
 5:     Normalize the integer
 6:     Append the normalized value to feature_vector
 7:   esle if parameter matches a floating-point pattern then
 8:     Normalize the floating-point number
 9:      Append the normalized value to feature_vector
10:   else if parameter matches an IP address pattern then
11:     Decimal form of the IP address
12:     Boolean value indicating if it is a private IP
13:     General string encoding
14:     Append all encoded parts to feature_vector
15:   else if parameter matches a file path pattern then
16:     Root directory encoding
17:     First-level directory encoding
18:     Second-level directory encoding
19:     General string encoding
20:     Append all encoded parts to feature_vector
21:   else if parameter matches a file name pattern then
22:     File name encoding
23:     File extension encoding
24:     General string encoding
25:     Append all encoded parts to feature_vector
26:   else if parameter matches a URL pattern then
27:     Top-level domain encoding
28:     Second-level domain encoding
29:     Subdomain encoding
30:     General string encoding
31:     Append all encoded parts to feature_vector
32:   else if parameter matches a registry pattern then
33:     Registry root key encoding
34:     Second-level registry key encoding
35:     Third-level registry key encoding
36:     General string encoding
37:     Append all encoded parts to feature_vector
38:   else
39:     Append General string encoding to feature_vector
40:   end if
41: end for