INNER CODE UNIT · Python

run_ipt_cmd

ab77/netflix-proxy · auth/auth.py:33

def run_ipt_cmd(ipaddr, op):
    iface = get_iface()
    web.debug('DEBUG: public iface=%s ipaddr=%s' % (iface, ipaddr))
    ipt_cmd = 'iptables -t nat -%s PREROUTING -s %s/32 -i %s -j ACCEPT -v && iptables-save > /etc/iptables/rules.v4' % (op, ipaddr, iface)
    web.debug('DEBUG: ipaddr=%s, op=%s, ipt_cmd=%s' % (ipaddr, op, ipt_cmd))
    p = Popen(ipt_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
    output, err = p.communicate()
    rc = p.returncode
    return rc, err, output


def run_ipt6_cmd(ipaddr, op):
    iface = get_iface()
    web.debug('DEBUG: public iface=%s ipaddr=%s' % (iface, ipaddr))
    ipt_cmd = 'ip6tables -t nat -%s PREROUTING -s %s/128 -i %s -j ACCEPT -v && ip6tables-save > /etc/iptables/rules.v6' % (op, ipaddr, iface)
    web.debug('DEBUG: ipaddr=%s, op=%s, ipt_cmd=%s' % (ipaddr, op, ipt_cmd))
    p = Popen(ipt_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
    output, err = p.communicate()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…