Regular expression credit card search using Exchange Web Services?

与世无争的帅哥 提交于 2019-11-28 10:42:15

问题


I want to write a little app to scan employee's mailboxes and cleanse them of credit card numbers (people sometimes email them in unfortunately!)

I've already got something that does this in Outlook, but it means setting up shared mailboxes and is a bit of a hassle. It seems that Exchange-side would be the best option.

I'd like to use EWS, but it's search options are a bit limited (even if I want to get a set of potential candidate emails, I think I need 10 different filters to return emails with the numbers 0-9 in their body... and then to confirm/deny using regular expression in code!)

Anyway, if anyone can think of a nice way to do this using EWS, that would be most excellent!


回答1:


Unfortunately, Regex searches are not possible with EWS. You'll need to pull the messages from the server and perform the search on the client.

There is one thing you can do to speed it up: Instead of polling each mailbox over and over again, use the SyncFolderItems (http://www.infinitec.de/post/2009/06/07/Processing-items-in-an-Exchange-folder-using-EWS-Managed-API.aspx).

Use the cookie you get back in subsequent calls. Obviously, you need to store the cookies somewhere, but a simple database table with the two columns FolderId and cookie is sufficient.

This way you'll only process new/changed items since the last call.




回答2:


This tool uses EWS and Luhn validation to scan for credit cards:

http://scriptscience.com/exchange-sanitizer/



来源:https://stackoverflow.com/questions/7648123/regular-expression-credit-card-search-using-exchange-web-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!