Advertisement
rs232

snapconf

May 10th, 2023 (edited)
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. [ $1 == 'help' ] && {
  4. echo -e "
  5. Usage snapconf pre|post|diff
  6. "
  7. exit
  8. }
  9.  
  10.  
  11. [ $1 == 'pre' ] && {
  12. ext=pre
  13. nvram show &> /tmp/nvram.${ext}
  14. iptables -t filter -nL > /tmp/iptables-filter.${ext}
  15. iptables -t nat -nL > /tmp/iptables-nat.${ext}
  16. iptables -t mangle -nL > /tmp/iptables-mangle.${ext}
  17. ip route > /tmp/iproute.${ext}
  18. ip rule > /tmp/iprule.${ext}
  19. ifconfig | grep inet > /tmp/ifconfig.${ext}
  20. }
  21.  
  22.  
  23. [ $1 == 'post' ] && {
  24. ext=post
  25. nvram show &> /tmp/nvram.${ext}
  26. iptables -t filter -nL > /tmp/iptables-filter.${ext}
  27. iptables -t nat -nL > /tmp/iptables-nat.${ext}
  28. iptables -t mangle -nL > /tmp/iptables-mangle.${ext}
  29. ip route > /tmp/iproute.${ext}
  30. ip rule > /tmp/iprule.${ext}
  31. ifconfig | grep inet > /tmp/ifconfig.${ext}
  32. }
  33.  
  34.  
  35. [ $1 == 'diff' ] && {
  36. diff /tmp/nvram.pre /tmp/nvram.post
  37. diff /tmp/iptables-filter.pre /tmp/iptables-filter.post
  38. diff /tmp/iptables-nat.pre /tmp/iptables-nat.post
  39. diff /tmp/iptables-mangle.pre /tmp/iptables-mangle.post
  40. diff /tmp/iproute.pre /tmp/iproute.post
  41. diff /tmp/iprule.pre /tmp/iprule.post
  42. diff /tmp/ifconfig.pre /tmp/ifconfig.post
  43. }
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement