Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scapy.all import *
- import time
- ip="192.168.1.28"
- #ip=input("enter ip address XXX.XXX.XXX.XXX")
- port=[11111,22222,33333]
- a=sniff(count=1,filter=ip)
- firstIndex=str(a[0])
- for i in firstIndex:
- li=list(firstIndex.split(" "))
- print(li)
- tcp_11111=sniff(count=1,filter=f"host{ip} and tcp port 11111")
- tcp_22222=sniff(count=1,filter=f"host{ip} and tcp port 22222")
- tcp_33333=sniff(count=1,filter=f"host{ip} and tcp port 33333")
- if tcp_11111 and tcp_22222 and tcp_33333:
- print("very good knocking")
- # subprocess.call(f'["iptables", "-I", "INPUT", "-p", "tcp", "-s {ip}", "--dport", "22", "-j", "ACCEPT"])
- # subprocess.call(["iptables-save"])
- # a=2
- # while 1<2:
- # choose=int(input("if you want more than 240 second press 1"))
- # if choose == 1:
- # time.sleep(240)
- # else:
- # subprocess.call(f'["iptables", "-I", "INPUT", "-p", "tcp", "-s {ip}", "--dport", "22", "-j", "DROP"])
- # subprocess.call(["iptables-save"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement