cc: Add validation format (starts wih `~`) for ransomware linux target directory

This commit is contained in:
Shreya 2021-07-05 15:22:20 +05:30 committed by Mike Salvatore
parent 3496c717a9
commit dc305d8e16
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ const hostnameRegex = '^([A-Za-z0-9]*[A-Za-z]+[A-Za-z0-9]*.?)*([A-Za-z0-9]*[A-Za
const linuxAbsolutePathRegex = '^/' // path starts with `/` const linuxAbsolutePathRegex = '^/' // path starts with `/`
const linuxPathStartsWithEnvVariableRegex = '^\\$' // path starts with `$` const linuxPathStartsWithEnvVariableRegex = '^\\$' // path starts with `$`
const linuxPathStartsWithTilde = '^~' // path starts with `~`
const windowsAbsolutePathRegex = '^([A-Za-z]:(\\\\|\\/))' // path starts like `C:\` OR `C:/` const windowsAbsolutePathRegex = '^([A-Za-z]:(\\\\|\\/))' // path starts like `C:\` OR `C:/`
const windowsPathStartsWithEnvVariableRegex = '^\\$|^(%\\w*\\d*\\s*%)' // path starts like `$` OR `%abc%` const windowsPathStartsWithEnvVariableRegex = '^\\$|^(%\\w*\\d*\\s*%)' // path starts like `$` OR `%abc%`
@ -40,7 +41,8 @@ function buildValidRansomwarePathLinuxRegex() {
return new RegExp([ return new RegExp([
whitespacesOnlyRegex, whitespacesOnlyRegex,
linuxAbsolutePathRegex, linuxAbsolutePathRegex,
linuxPathStartsWithEnvVariableRegex linuxPathStartsWithEnvVariableRegex,
linuxPathStartsWithTilde
].join('|')) ].join('|'))
} }