Showing posts with label internet. Show all posts
Showing posts with label internet. Show all posts

2025/05/20

Firefox: Prevent Google AI on web search

 grab Greasymonkey or similar

// ==UserScript==
// @name         Google Web tab redirect
// @match        https://www.google.com/search*
// @run-at       document-start
// ==/UserScript==

(function() {
    let url = new URL(location.href);
    if (!url.searchParams.has("udm")) {
        url.searchParams.set("udm", "14");
        location.replace(url.toString());
    }
})();

 

what it does: it automatically selects the "Web" option.

If tomorrow they change/remover the attribute one could simply hide it using uBlockOrigin. 


2021/01/05

Script to prevent SSH attacks while allowing you to connect from dynamic IP address.

while most of the time connecting to a remote server using openvpn would be a smart choice, sometimes it's not an option. This script is for a linux behind a firewall/router. It's intended to prevent SSH attacks (by simply denying access to the SSH port) while allowing you to connect from your own dynamic DNS, that is, if you have a dynamic ip given by your ISP, otherwise you could simply use iptables.

#!/bin/bash
valor=`host yourdyndns`
OK=$?
if [ $OK -ne 0 ]; then
  exit
fi
addr=$(echo $valor |egrep "address .*" -o)
ip=$(echo $parte |egrep "[0-9\.]*" -o)

whitelist=/root/whitelist
touch ${whitelist}

exists=`cat ${whitelist} | grep "${parte2}"`

if [ $? -ne 0 ]; then
  echo $ip >$whitelist
  iptables -F   iptables -A INPUT -s $ip -j ACCEPT
  iptables -A FORWARD -s $ip -j \ ACCEPT                                                                                         
  iptables -A INPUT -p tcp --dport 22022 -j DROP                                                                                   
fi

add this to rc.local to reload iptables during bootup:

# delete whitelist

rm /root/whitelist

# run previous script

/root/bin/testso.sh


2020/12/05

Script to reconnect wan via rc.inet1

My router is a Linux PC with 2 lan boards, one for local lan and the other directly connected to the ISP router (configured as bridge). Each time my ISP disconnects me for whatever reason I had to either reboot the computer or keep running rc.inet1 restart until the connection is made.

So, even if it doesn't happen often, at one point I got bored of it and decided to write an script to force the reconnection as soon as possible:

 #!/bin/bash
while true ; do
   clear
   ./rc.inet1 restart
   ping google.com -c 1
   if [ $? == 0 ]; then
      exit
   fi;
   sleep 30
done