wuseman

network-notify.sh

Oct 22nd, 2021 (edited)
1,288
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # - iNFO -----------------------------------------------------------------------------
  4. #
  5. #        Author: wuseman <wuseman@nr1.nu>
  6. #      FileName: network-notify.sh
  7. #       Version: 1.0
  8. #
  9. #       Created: 2021-10-22 (16:00:45)
  10. #      Modified: 2021-10-22 (16:06:05)
  11. #
  12. #           iRC: wuseman (Libera/EFnet/LinkNet)
  13. #       Website: https://www.nr1.nu/
  14. #        GitHub: https://github.com/wuseman/
  15. #
  16. # - Descrpiption --------------------------------------------------------------------
  17. #
  18. #       A simple script for detect new devices connected to our network
  19. #
  20. # - LiCENSE -------------------------------------------------------------------------
  21. #
  22. #      Copyright (C) 2021, wuseman                                    
  23. #                                                                      
  24. #      This program is free software; you can redistribute it and/or modify
  25. #      it under the terms of the GNU General Public License as published by
  26. #      the Free Software Foundation; either version 3 of the License, or    
  27. #      (at your option) any later version.                                  
  28. #                                                                      
  29. #      This program is distributed in the hope that it will be useful,      
  30. #      but WITHOUT ANY WARRANTY; without even the implied warranty of      
  31. #      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        
  32. #      GNU General Public License for more details.                        
  33. #                                                                      
  34. #      You must obey the GNU General Public License. If you will modify    
  35. #      the file(s), you may extend this exception to your version          
  36. #      of the file(s), but you are not obligated to do so.  If you do not  
  37. #      wish to do so, delete this exception statement from your version.    
  38. #      If you delete this exception statement from all source files in the  
  39. #      program, then also delete it here.                                  
  40. #
  41. #      You should have received a copy of the GNU General Public License
  42. #      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  43. #
  44. # - End of Header -------------------------------------------------------------
  45.  
  46. if [[ ! -f "/tmp/arp.log" ]]; then
  47.     arp > /tmp/arp.log
  48. fi
  49.  
  50. arp > /tmp/arp2.log
  51. diff <(cat /tmp/arp.log) <(cat /tmp/arp2.log) || \
  52.     echo "If something diff, we gonna send you the text file to prefered protocol"  | \
  53.     mutt -s "Network Info.." lars@sjostrom.com.com < /tmp/arp2.log
  54.  
  55.  
  56.  
RAW Paste Data