<commit_before>if [ ! -d "serverdata" ]; then
   ./update-db.sh
fi

counter=0;
dialogstring=''

for filename in `ls serverdata`; do
   (( counter++ ))
   dialogstring=$dialogstring" "$counter" "$filename" off"
done

result=`dialog --stdout --checklist "Choose servers to block: " 30 40 $counter $dialogstring`

counter=0;
for filename in `ls serverdata`; do
   (( counter++ ))
   for number in $result; do
      if [ "$number" -eq "$counter" ]; then
         for ip in `cat serverdata/$filename`; do
            sudo iptables -A INPUT -s $ip -j DROP
         done
      fi
   done
done<commit_msg>Now it's possible to switch active iptables rules off.<commit_after>if [ ! -d "serverdata" ]; then
   ./update-db.sh
fi

counter=0;
dialogstring=''
iptables_rules=`sudo iptables --list INPUT | tail -n +3 | awk '{print $4}'`

for filename in `ls serverdata`; do
   (( counter++ ))
   dialogstring=$dialogstring" "$counter" "$filename

   is_ip_locked="false"
   for iptables_ip in $iptables_rules; do
      for file_ip in `cat serverdata/$filename`; do
         if [ "$iptables_ip" == "$file_ip" ]; then
            is_ip_locked="true"
         fi
      done
   done
   if [ "$is_ip_locked" == "true" ]; then
      dialogstring=$dialogstring" on"
   else
      dialogstring=$dialogstring" off"
   fi
done

result=`dialog --stdout --checklist "Choose servers to block: " 30 40 $counter $dialogstring`
counter=0;

for filename in `ls serverdata`; do
   for ip in `cat serverdata/$filename`; do
      sudo iptables -D INPUT -s $ip -j DROP 2> /dev/null
   done
done

for filename in `ls serverdata`; do
   (( counter++ ))
   for number in $result; do
      if [ "$number" -eq "$counter" ]; then
         for ip in `cat serverdata/$filename`; do
            sudo iptables -A INPUT -s $ip -j DROP
         done
      fi
   done
done
{'fraction_non_alphanumeric': 0.12897914379802414, 'fraction_numerical': 0.00823271130625686, 'mean_word_length': 2.758762886597938, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '689047', 'n_tokens_mistral': 614, 'n_tokens_neox': 593, 'n_words': 204}