Changeset 829
- Timestamp:
- 06/17/07 20:15:42 (6 years ago)
- Files:
-
- 1 modified
-
branch/ggpolo/umitInventory/viewer.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/ggpolo/umitInventory/viewer.py
r828 r829 408 408 self.daddy = daddy 409 409 self.pages = [ ] 410 411 #if inv_activated: 412 # self.append_inv() 413 410 414 411 self.__layout() 415 416 412 413 self.connect('grab-focus', self._update_page_text) 414 415 def _update_page_text(self, widget): 416 """ 417 When changing from an Inventory tab to another, I noticed some text was 418 missing but it would appear when text-view received 'grab-focus'. 419 I'm emitting this signal so text updates when changing Inventory tabs. 420 """ 421 cur_page = widget.get_current_page() 422 page = widget.get_nth_page(cur_page) 423 viewport = page.get_children()[0] 424 vbox = viewport.get_children()[0] 425 vbox_children = vbox.get_children() 426 427 textview = vbox_children[0] 428 textview.emit('grab-focus') 429 430 417 431 def append_inv(self, title="Info", box=None): 418 432 """ … … 457 471 Remove a page from notebook and from self.pages 458 472 """ 459 print button, page460 461 473 del self.pages[self.pages.index(text)] 462 474 self.remove(page) … … 780 792 box = self._load_inventory_data(title) 781 793 p.append_inv(box=box) 782 783 """784 if not err: # tab wasn't in inventory tab785 if data["host_addr"]:786 self._load_inventory_host_data(title, data["host_addr"])787 788 else:789 pass790 #self._load_inventory_data(title)791 """792 793 794 794 795 … … 931 932 for pd in pdata: 932 933 fpd = self.invdb.get_port_data_for_pdata_from_db(pd[2], pd[3], 933 pd[1]) 934 if len(pdata) > 1: 935 el = '\n\n' 936 else: 937 el = '\n' 938 939 temp += "Port No: %s, Protocol: %s, Port state: %s, \n\ 934 pd[1]) 935 temp += "\nPort No: %s, Protocol: %s, Port state: %s, \n\ 940 936 Service product: %s, Service version: %s, Service extrainfo: %s, \n\ 941 Service name: %s %s" % (pd[0], fpd[0], fpd[1], fpd[2], fpd[3], fpd[4], fpd[7], el)937 Service name: %s\n" % (pd[0], fpd[0], fpd[1], fpd[2], fpd[3], fpd[4], fpd[7]) 942 938 943 939 text.append(temp) # port data … … 945 941 # get extraports data for this host 946 942 epdata = self.invdb.get_extraports_data_for_host_from_db(base_hosts_data[host_count][1]) 947 text.append(" Extraports\n")948 text.append("Count: %d, State: %s " % (epdata[0], epdata[1]))943 text.append("\nExtraports\n") 944 text.append("Count: %d, State: %s\n" % (epdata[0], epdata[1])) 949 945 950 946 # get fingerprint info for host 951 947 fpinfo = self.invdb.get_fingerprint_info_for_host_from_db(base_hosts_data[host_count][1]) 952 948 if fpinfo: 953 text.append("Uptime: %s, Last boot:%s\netc: %s" % (fpinfo[0], 954 fpinfo[1], 955 fpinfo[2:])) 949 text.append("\nUptime: %s, Last boot: %s\n" % (fpinfo[0], 950 fpinfo[1])) 951 text.append("TCP Sequence\n") 952 text.append("Class: %s, Index: %s, Value: %s\n" % (fpinfo[2], 953 fpinfo[3], 954 fpinfo[4])) 955 text.append("TCP TS Sequence\n") 956 text.append("Class: %s, Value: %s\n" % (fpinfo[5], fpinfo[6])) 957 text.append("IP ID Sequence\n") 958 text.append("Class: %s, Value: %s\n" % (fpinfo[7], fpinfo[8])) 956 959 957 960 # get osmatch info for host 958 961 match = self.invdb.get_osmatch_for_host_from_db(base_hosts_data[host_count][1]) 959 962 if match: 960 text.append("Name: %s, Accuracy: %s, Line: %s" % (match[0], 963 text.append("\nOS Match\n") 964 text.append("Name: %s, Accuracy: %s, Line: %s\n" % (match[0], 961 965 match[1], 962 966 match[2])) … … 964 968 # get osclasses for host 965 969 classes = self.invdb.get_osclasses_for_host_from_db(base_hosts_data[host_count][1]) 966 if classes: 967 text.append(classes) 970 if len(classes): 971 text.append("\nOS Classes\n") 972 for osclass in classes: 973 text.append("Accuracy: %s, OS Gen: %s, OS Family: %s, \ 974 OS Vendor: %s, OS Type: %s\n" % (osclass[0], osclass[1], osclass[2], osclass[3], 975 osclass[4])) 968 976 969 print text, text_buffer970 977 self.insert_text(text_buffer, text) 971 978 self.attach_widgets(tview, item[1]) … … 974 981 host_count += 1 975 982 else: 976 text.append(" down")983 text.append("Host down") 977 984 self.insert_text(text_buffer, text) 978 985 self.attach_widgets(tview, item[1]) 979 986 box.pack_start(tview) 980 987 988 box.show_all() 981 989 sw = gtk.ScrolledWindow() 982 990 sw.add_with_viewport(box) 983 991 sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 984 sw.show_all()985 992 986 993 return sw
