Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions rem_rep_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,32 @@
from scapy.all import *

import getip
import csv
import threatcrowdfeed


def removerep():
makelist = []
#def removerep():
makelist = []
#remove repeating destination ip
a = open("filepath.txt","r")
#a = open("filepath.txt","r")
#dta stored in file using test .py can be accesed using filevar
filevar = a.read()
a.close()
packets = scapy.all.rdpcap(filevar)
#filevar = a.read()
#a.close()
packets = scapy.all.rdpcap(r"C:\Users\Jagmohan\Desktop\1.pcapng")

for p in packets:
for p in packets:
ip = getip.ipvarikafun()
makelist.append(ip)
makedict = list(dict.fromkeys(makelist))
counted = len(makedict)
no = 0
for elem in makedict:
return(elem)

makedict = list(dict.fromkeys(makelist))
counted = len(makedict)
no = 0
for elem in makedict:
with open(r'file1.csv','w') as writefile:
writer =csv.writer(writefile)
writing = [getip.getipf(),threatcrowdfeed.threatfeed()]
writer.writerow(writing)

#return(elem)