Esempio n. 1
0
    def refresh(self, db):
        # refresh the log tree with the new database

        self.database = db
        hosts = self.database.get_hosts()

        self.host_liststore.clear()

        for host in hosts:
            #if not host in self.old_hosts:

            status = host.status

            try:  # add icon fot the os found
                icon = iconslib.get_icon(host.os_match)
            except:
                icon = iconslib.icon("unknown")

            try:
                self.host_liststore.append(
                    [icon, host.address, host.hostname, status, host.id])
            except:
                self.host_liststore.append(
                    [icon, host.address, "", status, host.id])

        self.hosttree.show()

        return True
Esempio n. 2
0
    def refresh(self, db, history=False):

        # refresh history
        self.database = db

        if history:
            # refresh ONLY history
            self.history_view.refresh(self.database, self.host)

            return True

        self.history_view.refresh(self.database, self.host)
        self.treeview.refresh(self.database, self.host)
        self.geolocation_map.refresh(self.database, self.host)
        self.info_tab.refresh(self.database, self.host)

        try:
            self.info_os_short.set_text(str(self.host.os_match).split("\n")[0])
            self.info_image.set_from_pixbuf(
                iconslib.get_icon(self.host.os_match, lg=True))
        except:
            pass

        # responsive stuff
        if self.w_row_1.get_allocation().width < 680:
            self.w_row_1.set_orientation(Gtk.Orientation.VERTICAL)
            self.w_row_2.set_orientation(Gtk.Orientation.VERTICAL)
            self.w_row_3.set_orientation(Gtk.Orientation.VERTICAL)
        else:
            self.w_row_1.set_orientation(Gtk.Orientation.HORIZONTAL)
            self.w_row_2.set_orientation(Gtk.Orientation.HORIZONTAL)
            self.w_row_3.set_orientation(Gtk.Orientation.HORIZONTAL)
Esempio n. 3
0
    def refresh(self, db, history=False):

        # refresh history
        self.database = db

        if history:
            # refresh ONLY history
            self.history_view.refresh(self.database, self.host)

            return True

        self.history_view.refresh(self.database, self.host)
        self.treeview.refresh(self.database, self.host)
        self.geolocation_map.refresh(self.database, self.host)
        self.info_tab.refresh(self.database, self.host)

        try:
            self.info_os_short.set_text(str(self.host.os_match).split("\n")[0])
            self.info_image.set_from_pixbuf(
                iconslib.get_icon(self.host.os_match, lg=True))
        except:
            pass
Esempio n. 4
0
    def __init__(self, host, database):
        """ hostview workspace tab """
        # initialization
        builder = Gtk.Builder()  # glade
        builder.add_from_file(
            os.path.dirname(os.path.abspath(__file__)) +
            "/../assets/ui/hostview.glade")

        self.database = database
        self.host = host

        self.notebook = builder.get_object("notebook1")
        self.portlistframe = builder.get_object("portlistframe")

        # tab title
        self.dash_title = builder.get_object("dash-title")
        self.dash_title.set_text("Target: %s" % self.host.address)

        # info-tab
        self.info_loc = builder.get_object("tab-info-location")
        self.info_tab = host_informations(self.database, self.host)

        self.info_loc.add(self.info_tab)

        # notes
        self.notes_place = builder.get_object("notes-place")
        self.notes_view = Notesview(database, host)
        self.notes_place.add(self.notes_view)

        # history tab
        self.history_box = builder.get_object("history-box")

        self.history_view = Historyview(self.database, self.host)

        scrolled_history = Gtk.ScrolledWindow()
        viewport = Gtk.Viewport()

        scrolled_history.add(viewport)
        scrolled_history.set_property("height-request", 450)
        viewport.add(self.history_view)

        self.history_box.add(scrolled_history)
        self.history_box.show_all()

        # Geolocation tab
        self.geoloc_box = builder.get_object("geoloc-box")
        self.geolocation_map = OSM(self.database, self.host)
        self.geoloc_box.add(self.geolocation_map)

        # title
        self.info_target = builder.get_object("target-label")
        self.info_os_short = builder.get_object("info-os-short")
        self.info_image = builder.get_object("target-image")

        self.info_target.set_text(self.host.address)

        # services
        self.treeview = PortsTree(
            self.database, self.host)  #Gtk.TreeView(model=self.port_liststore)

        scrolled = Gtk.ScrolledWindow()
        viewport = Gtk.Viewport()

        scrolled.add(viewport)
        scrolled.set_property("height-request", 450)
        viewport.add(self.treeview)
        scrolled.show_all()

        self.portlistframe.add(scrolled)

        # expand buttons
        tab_info_button = builder.get_object("tab-info-button")
        image2 = builder.get_object("image2")
        tab_services_button = builder.get_object("tab-services-button")
        image6 = builder.get_object("image6")
        tab_geoloc_button = builder.get_object("tab-geoloc-button")
        image3 = builder.get_object("image3")
        tab_notes_button = builder.get_object("tab-notes-button")
        image7 = builder.get_object("image7")
        tab_history_button = builder.get_object("tab-history-button")
        image5 = builder.get_object("image5")

        tab_services_button.connect("clicked", self.tab_clicked_max,
                                    "Services", scrolled, self.portlistframe,
                                    image6)
        tab_geoloc_button.connect("clicked", self.tab_clicked_max,
                                  "Geolocation", self.geolocation_map,
                                  self.geoloc_box, image3)
        tab_info_button.connect("clicked", self.tab_clicked_max,
                                "Informations", self.info_tab, self.info_loc,
                                image2)
        tab_notes_button.connect("clicked", self.tab_clicked_max, "Notes",
                                 self.notes_view, self.notes_place, image7)
        tab_history_button.connect("clicked", self.tab_clicked_max,
                                   "Task's history", scrolled_history,
                                   self.history_box, image5)

        self.fullscreen = []

        try:
            self.info_os_short.set_text(str(self.host.os_match).split("\n")[0])
            self.info_image.set_from_pixbuf(
                iconslib.get_icon(self.host.os_match, lg=True))
        except:
            pass
Esempio n. 5
0
    def refresh(self, db, history=False):

        # refresh history
        self.history_view.refresh(self.database)

        if history:
            # refresh ONLY history
            return True

        ports = self.database.get_ports_by_host(self.host)
        self.port_liststore.clear()

        for port in ports:
            # fill the list

            ports_list = []

            if port.state == "open" and port.service != "tcpwrapped":
                ports_list.append(iconslib.port_open_icon())
            else:
                ports_list.append(iconslib.port_closed_icon())

            ports_list.append(port.port)
            ports_list.append(port.state)
            ports_list.append(port.protocol)
            ports_list.append(port.service)
            ports_list.append(port.banner)  #.replace("product: ",""))
            ports_list.append(port.fingerprint)
            ports_list.append(port.id)

            self.port_liststore.append(ports_list)

        # Fill info tab
        host = self.host
        self.info_os.set_text(str(host.os_match))  #.split("\n")[0]
        self.info_os_short.set_text(str(host.os_match).split("\n")[0])
        self.info_image.set_from_pixbuf(
            iconslib.get_icon(host.os_match, lg=True))

        hostnamestring = ""

        self.info_status.set_text(host.status)
        self.info_hostnames.set_text(host.hostname)
        self.info_address.set_text(host.address)
        self.info_distance.set_text(str(host.distance) + " hops")
        self.info_mac.set_text(host.mac)
        self.info_vendor.set_text(host.vendor)
        self.info_uptime.set_text(str(host.uptime) + " seconds")
        self.info_tcpseq.set_text(host.tcpsequence)

        textbuffer = self.scripts_box.get_buffer()

        scripts_box = ""

        try:
            for script in literal_eval(host.scripts):

                scripts_box += "[+] " + script["id"] + ":\n" + script[
                    "output"] + "\n\n"

            textbuffer.set_text(scripts_box)

        except:
            pass