分析内容中的敏感信息
(cont, source string)
| 227 | |
| 228 | // 分析内容中的敏感信息 |
| 229 | func infoFind(cont, source string) { |
| 230 | info := mode.Info{} |
| 231 | //手机号码 |
| 232 | for i := range config.Phone { |
| 233 | phones := regexp.MustCompile(config.Phone[i]).FindAllStringSubmatch(cont, -1) |
| 234 | for i := range phones { |
| 235 | info.Phone = append(info.Phone, phones[i][1]) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | for i := range config.Email { |
| 240 | emails := regexp.MustCompile(config.Email[i]).FindAllStringSubmatch(cont, -1) |
| 241 | for i := range emails { |
| 242 | info.Email = append(info.Email, emails[i][1]) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | for i := range config.IDcard { |
| 247 | IDcards := regexp.MustCompile(config.IDcard[i]).FindAllStringSubmatch(cont, -1) |
| 248 | for i := range IDcards { |
| 249 | info.IDcard = append(info.IDcard, IDcards[i][1]) |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | for i := range config.Jwt { |
| 254 | Jwts := regexp.MustCompile(config.Jwt[i]).FindAllStringSubmatch(cont, -1) |
| 255 | for i := range Jwts { |
| 256 | info.JWT = append(info.JWT, Jwts[i][1]) |
| 257 | } |
| 258 | } |
| 259 | for i := range config.Other { |
| 260 | Others := regexp.MustCompile(config.Other[i]).FindAllStringSubmatch(cont, -1) |
| 261 | for i := range Others { |
| 262 | info.Other = append(info.Other, Others[i][1]) |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | info.Source = source |
| 267 | if len(info.Phone) != 0 || len(info.IDcard) != 0 || len(info.JWT) != 0 || len(info.Email) != 0 || len(info.Other) != 0 { |
| 268 | AppendInfo(info) |
| 269 | } |
| 270 | |
| 271 | } |