def openByPort(self, port): return ExecUtil.execCommandList(["iptables -A INPUT -p tcp --dport " + port + " -j ACCEPT", "iptables -A OUTPUT -p tcp --sport " + port + " -j ACCEPT"])
def limitIp(self, ip, port): return ExecUtil.execCommandList(["iptables -A INPUT -s " + ip + " -p tcp --dport " + port + " -j DROP"])
def dropAll(self): ExecUtil.execCommandList( ["iptables -P INPUT DROP", "iptables -P FORWARD DROP", "iptables -P OUTPUT DROP", "service iptables save "])
def openWeb(self): return ExecUtil.execCommandList(["iptables -A INPUT -p tcp --dport 80 -j ACCEPT", "iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT"])
def limitIp(self, ip, port): return ExecUtil.execCommandList([ "iptables -A INPUT -s " + ip + " -p tcp --dport " + port + " -j DROP" ])
def openByPort(self, port): return ExecUtil.execCommandList([ "iptables -A INPUT -p tcp --dport " + port + " -j ACCEPT", "iptables -A OUTPUT -p tcp --sport " + port + " -j ACCEPT" ])
def openWeb(self): return ExecUtil.execCommandList([ "iptables -A INPUT -p tcp --dport 80 -j ACCEPT", "iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT" ])
def dropAll(self): ExecUtil.execCommandList([ "iptables -P INPUT DROP", "iptables -P FORWARD DROP", "iptables -P OUTPUT DROP", "service iptables save " ])
def updateYumToAli(self): return ExecUtil.execCommandList( ["mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup", "wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo", "yum makecache"])