<commit_before>#!/bin/bash

# ------------------------ #
# Script escrito por zc00l #
# ------------------------ #

# Static variables 
SERVER_IP=($(hostname -I))
IPT=$(which iptables)

# Ports to enable
# Squid-proxy: 3128
# E-mails: 25, 587, 465, 110, 995
# HTTP and HTTPS: 80 & 443
ALLOW_PORTS=(22 25 80 443)

function clean_iptables 
{
	echo "[+] Clearing existing rules ..."
	${IPT} -F;
}

function allow_port 
{
	${IPT} -A INPUT -p tcp -d "$2" --sport $1 -m state --state ESTABLISHED -j ACCEPT;
	echo "[+] Created new rule: ACCEPT for $1 in CHAIN INPUT."
	${IPT} -A OUTPUT -p tcp -s "$2" --dport $1 -m state --state NEW,ESTABLISHED -j ACCEPT;
	echo "[+] Created new rule: ACCEPT for $1 in CHAIN OUTPUT."
}<commit_msg>Added ALLOWED services variable to enable incoming connections from vital services like SSH<commit_after>#!/bin/bash

# ------------------------ #
# Script escrito por zc00l #
# ------------------------ #

# Static variables 
SERVER_IP=($(hostname -I))
IPT=$(which iptables)

# Ports to enable
# Squid-proxy: 3128
# E-mails: 25, 587, 465, 110, 995
# HTTP and HTTPS: 80 & 443
ALLOW_PORTS=(22 25 80 443)
ALLOWED=(22)

function clean_iptables 
{
	echo "[+] Clearing existing rules ..."
	${IPT} -F;
}

function allow_port 
{
    # Check if input port is in ALLOWED_SERVICES variable
    for port in "${ALLOWED[@]}"
    do
        ${IPT} -A INPUT -p tcp -d "$2" --dport $1 -m state --state NEW,ESTABLISHED -j ACCEPT;
        ${IPT} -A OUTPUT -p tcp -d "$2" --sport $1 -m state --state NEW,ESTABLISHED -j ACCEPT;
    done
    
	${IPT} -A INPUT -p tcp -d "$2" --sport $1 -m state --state ESTABLISHED -j ACCEPT;
	echo "[+] Created new rule: ACCEPT for $1 in CHAIN INPUT."
	${IPT} -A OUTPUT -p tcp -s "$2" --dport $1 -m state --state NEW,ESTABLISHED -j ACCEPT;
	echo "[+] Created new rule: ACCEPT for $1 in CHAIN OUTPUT."
}
{'fraction_non_alphanumeric': 0.19814915623298857, 'fraction_numerical': 0.046815459989112684, 'mean_word_length': 2.5346153846153845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1596601', 'n_tokens_mistral': 767, 'n_tokens_neox': 684, 'n_words': 239}