A tool for checking the integrity of your sites(the main or landing page of your site) in order to monitor for any possible defacement or unauthorized changes in the code.
- It sends a request to the url then saves the response in “page.txt” file.
- After reaching to the end of urls in “urls.txt”, it sends a request again then saves the response in the memory.
- Both responses are compared using “diff-match-patch” library created by Google.
- If any changes like adding or removing tags, strings and whatever are detected between these responses, it then makes an HTML file with added and removed parts with highlighted colors.
- It sends the generated HTML file via a Telegram Bot (or Bale Bot) to a Telegram/Bale group for SOC team to analyze the event.
- Create and name a file as “urls.txt” to cover all your assets then put the file in the “base_dir” variable in the code.
- Create a Telegram bot and group then add them to the source code:
Telegram: Telegram Bot
Bale: Bale Bot
- Run the code and analyse receiving events. If required try to tune the recieving alert.
Consider a web server's response that contains a VIEWSTATE value in every response. So we need to remove the VIEWSTATE value to provide more reliable alerts for security analysts. For every site there could be a "whitelist_.txt" file inside the created directory for each site. It is used for minimizing false positive alerts by defining some exceptions in the "whitelist_.txt".
Any html tag or content could be added to this file.
<input id="__VIEWSTATE" name="__VIEWSTATE" type="hidden" value="31DgVHUW6lLKGiKNEH93">
tag_name,attribute_name:attribute_value
input,id:__VIEWSTAT
Input tag containing “id= __VIEWSTATE” is removed from the response before compare.
<img src="WebResource.axd?id=11111">
tag_name,attribute_name:attribute_value,regex
img,src:WebResource.axd,regex
IMG tag containing “src= WebResource.axd?id=11111” is removed from the response before compare.
<script type="text/javascript"> var sd_persiandatepicker_MAXDATE = new Date(2022,5,9); </script>
tag_name,:string,regexstring
tag_name,:var sd_persiandatepicker_MAXDATE .?);,regexstring*
SCRIPT tag containing “sd_persiandatepicker_MAXDATE” string is removed from the response before compare.
<img alt="SMALL" src="https://example.com/pic.jpg" class=”in-press press-wired”>
ag_name,attribute_name:attribute_value string
div,class:in-press press-wired
IMG tag containing “class= in-press press-wired” is removed from the response before compare.
I love poll request.