Ejemplo n.º 1
0
	def print_ipsdst_barras(self, file):
		s = sniffer()
		s.read_from_file(file)

		entropia = s.ipsdst_entropia()
		ips_info = s.ipsdst_info()
		
		ips = ips_info.keys()
		recv_pkts = ips_info.values()

		self.show_barras(ips, recv_pkts, entropia)
Ejemplo n.º 2
0
	def print_ipssrc_grafo(self, file):
		s = sniffer()
		s.read_from_file(file)

		total_pkts = s.total_pkts()

		#g = nx.cycle_graph(0)
		g = nx.DiGraph()

		for src in s.comunicaciones.keys():
				for dst in s.comunicaciones[src].keys():
					pkts = s.comunicaciones[src][dst]
					g.add_edge(src,dst, weight=0.1)

		# tamano de los nodos en funcion de la cantidad de paquetes mandados
		node_size = []
		for ip in g: 
			if s.ipssrc.has_key(ip):
				node_size.append( s.ipssrc[ip] / total_pkts * 5000+50 )
			else: 
				node_size.append( min( s.ipssrc.values() ) ) 
		
		# color de los nodos en funcion de la entropia		
		ips_info = s.ipssrc_info()
		entropia = s.ipssrc_entropia()
		node_color = []
		for ip in g: 
			if ips_info.has_key(ip) and ips_info[ip] < entropia: # si la informacion de la ip es menor de la entropia es distinguido
				node_color.append(2)
			else:
				node_color.append(0)

		graphviz_prog = ['twopi', 'gvcolor', 'wc', 'ccomps', 'tred', 'sccmap', 'fdp', 'circo', 'neato', 'acyclic', 'nop', 'gvpr', 'dot', 'sfdp']
		# grafico
		#pos=nx.spring_layout(g,iterations=100)
		#pos = nx.shell_layout(g)
		pos = nx.graphviz_layout(g,prog='twopi',args='')
		nx.draw(g,pos,
			node_size=node_size,
			node_color=node_color,
			alpha=0.7,
			edge_color='g'
			)
		plt.show()
Ejemplo n.º 3
0
    def combo(self):
        d = sniff.findInterfaces()
        for i in d:
           if "Loopback" not in i:
               self.Ui.comboBox.addItem(i[0])


    def get_data(self):
        if(sniff.run):
            self.Ui.pushButton.setText("Start  Sniffing")
            sniff.run =False
        else :
            d = sniff.findInterfaces()
            i=self.Ui.comboBox.currentIndex()
            interface = d[i][1]
            sniff.selectInterface(interface)
            filter_pkt=self.Ui.lineEdit.text()
            sniff.setFilter(filter_pkt)
            self.Ui.pushButton.setText("Stop  Sniffing")
            sniff.run = True
            sniff.start(self)
        return 0


        # self.setWindowIcon(QIcon('pic.png'))
sniff = sniffer()
app = QApplication(sys.argv)
Gui = window()
sys.exit(app.exec_())
Ejemplo n.º 4
0
            out_lck, "\n\nSelect one of the following actions ('e' to exit): ",
            ["Send file", "Receive file", "MiTm", "Sniffer"])
        if main_menu == 1:
            option = loop_menu(out_lck, "Select an option: ", ["TCP", "UDP"])
            if option == 1:
                TCPclient(out_lck, host, port)
            elif option == 2:
                UDPclient(out_lck, host, port)

        elif main_menu == 2:
            option = loop_menu(out_lck, "Select an option: ", ["TCP", "UDP"])
            if option == 1:
                TCPserver(out_lck, host, port, extension)
            elif option == 2:
                UDPserver(out_lck, host, port, extension)

        elif main_menu == 3:
            option = loop_menu(out_lck, "Select an option: ",
                               ["Arp Poisoner", "MAC Flooding"])
            if option == 1:
                arpoisoner(out_lck, interface)
            elif option == 2:
                macflooder(out_lck, interface)

        elif main_menu == 4:
            time = loop_input(out_lck, "Please insert a timeout:")
            sniffer(out_lck, time, port, interface)

        else:
            output(out_lck, "Please insert a valid option...\n")
Ejemplo n.º 5
0
from scapy.all import *
from sniffer import *

import sys

print len(sys.argv)

if( len(sys.argv) <= 2 or (sys.argv[1] == 'lan' and len(sys.argv) < 4)  ): 
	print 'Formato de uso: escucha_pasiva.py [file/lan] [archivo_entrada/archivo_salida] [tiempo_sniff]'
	sys.exit() 

if( sys.argv[1] == 'file' ):
	print "Se lee del archivo" 
	pkts_file = sys.argv[2]
	
	snf = sniffer()
	snf.read_from_file(pkts_file)

	snf.dump_grafo( "%s_del_archivo.dot" % (pkts_file,) )	
	sys.exit()

if( sys.argv[1] == 'lan' ): 
	print "Se lee de la LAN"
	lan_name = sys.argv[2]
	sniff_time = int(sys.argv[3]) * 60
	 
	snf = sniffer()

	def arp_monitor_callback(pkt):
		return snf.guardar_pkt(pkt)