Research Article
Cost-Sensitive Approach to Improve the HTTP Traffic Detection Performance on Imbalanced Data
Algorithm 1
Character-level feature (HTTP traffic path).
| | Input:HTTP traffic path | | (1) | Configure the resources occupied by the spark task | | (2) | Init spark session | | (3) | Initialize: Truncated fixed length: L, result: res | | (4) | feat-contract URL and post | | (5) | Filter non-ASCII characters of feat | | (6) | if(the length of feat ≥ L){ | | (7) | feat = the first L character of the feat | | (8) | } | | (9) | else{ | | (10) | do{ | | (11) | feat = merge two feat strings | | (12) | } | | (13) | While(getLength( feat) > L) | | (14) | } | | (15) | if(the length of feat ≥ L){ | | (16) | feat = the first L character of the feat | | (17) | } | | (18) | Return feat; //return the string of fixed length |
|