Index: /branch/ubuntu/debian/control
===================================================================
--- /branch/ubuntu/debian/control (revision 2963)
+++ /branch/ubuntu/debian/control (revision 2963)
@@ -0,0 +1,11 @@
+Source: umit
+Section: net
+Priority: optional
+Maintainer: Luis <luis@umitproject.org>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: umit
+Architecture: all
+Depends: nmap, python, python (>= 2.5) | python-pysqlite2, python-central (>= 0.6.1), python-gobject, python-gtk2
+Description: Umit is a graphical scanner
Index: /branch/ubuntu/debian/dirs
===================================================================
--- /branch/ubuntu/debian/dirs (revision 2963)
+++ /branch/ubuntu/debian/dirs (revision 2963)
@@ -0,0 +1,7 @@
+usr/bin
+usr/share/umit
+usr/share/icons
+usr/share/pixmaps
+usr/lib/python2.5/site-packages
+usr/lib/python-support/site-packages
+usr/share/applications
Index: /branch/ubuntu/debian/files
===================================================================
--- /branch/ubuntu/debian/files (revision 2963)
+++ /branch/ubuntu/debian/files (revision 2963)
@@ -0,0 +1,1 @@
+umit_0.9.5-1_all.deb net optional
Index: /branch/ubuntu/debian/compat
===================================================================
--- /branch/ubuntu/debian/compat (revision 2963)
+++ /branch/ubuntu/debian/compat (revision 2963)
@@ -0,0 +1,1 @@
+5
Index: /branch/ubuntu/debian/changelog
===================================================================
--- /branch/ubuntu/debian/changelog (revision 2963)
+++ /branch/ubuntu/debian/changelog (revision 2963)
@@ -0,0 +1,6 @@
+umit (0.9.5-1) unstable; urgency=low
+
+  * Initial release (Closes: #nnnn)  <nnnn is the bug number of your ITP>
+
+ -- Luis <luis@umitproject.org>  Mon, 12 May 2008 21:08:14 +0100
+
Index: /branch/ubuntu/debian/copyright
===================================================================
--- /branch/ubuntu/debian/copyright (revision 2963)
+++ /branch/ubuntu/debian/copyright (revision 2963)
@@ -0,0 +1,40 @@
+This package was debianized by Luis <luis@umitproject.org> on
+Mon, 12 May 2008 21:08:14 +0100.
+
+It was downloaded from <url://example.com>
+
+Upstream Author(s): 
+
+    <put author's name and email here>
+    <likewise for another author>
+
+Copyright: 
+
+    <Copyright (C) YYYY Name OfAuthor>
+    <likewise for another author>
+
+License:
+
+    This package is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+ 
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2008, Luis <luis@umitproject.org> and
+is licensed under the GPL, see above.
+
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
Index: /branch/ubuntu/debian/docs
===================================================================
--- /branch/ubuntu/debian/docs (revision 2963)
+++ /branch/ubuntu/debian/docs (revision 2963)
@@ -0,0 +1,1 @@
+README
Index: /branch/ubuntu/debian/umit.postinst.debhelper
===================================================================
--- /branch/ubuntu/debian/umit.postinst.debhelper (revision 2963)
+++ /branch/ubuntu/debian/umit.postinst.debhelper (revision 2963)
@@ -0,0 +1,17 @@
+# Automatically added by dh_python
+PYTHON=python2.5
+if which $PYTHON >/dev/null 2>&1 && [ -e /usr/lib/$PYTHON/compileall.py ]; then
+	DIRLIST=" /usr/lib/python2.5/site-packages"
+	for i in $DIRLIST ; do
+		$PYTHON /usr/lib/$PYTHON/compileall.py -q $i
+	done
+fi
+# End automatically added section
+# Automatically added by dh_pycentral
+if which pycentral >/dev/null 2>&1; then
+	pycentral pkginstall umit
+	if grep -qs '^umit$' /var/lib/pycentral/delayed-pkgs; then
+		sed -i '/^umit$/d' /var/lib/pycentral/delayed-pkgs
+	fi
+fi
+# End automatically added section
Index: /branch/ubuntu/debian/umit.substvars
===================================================================
--- /branch/ubuntu/debian/umit.substvars (revision 2963)
+++ /branch/ubuntu/debian/umit.substvars (revision 2963)
@@ -0,0 +1,2 @@
+python:Versions=2.5
+python:Depends=python (>= 2.5), python-central (>= 0.6.5), python (<< 2.6)
Index: /branch/ubuntu/debian/rules
===================================================================
--- /branch/ubuntu/debian/rules (revision 2963)
+++ /branch/ubuntu/debian/rules (revision 2963)
@@ -0,0 +1,113 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+PYDEF=$(shell pyversions -d)
+PYVERS=$(shell pyversions -d)
+
+
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	touch configure-stamp
+
+
+build:build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+	set -e; \
+	for python in $(PYVERS); do \
+		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
+		$$python setup.py build; \
+	done
+	touch build-stamp
+
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+	dh_clean 
+
+	for python in $(PYVERS); do \
+		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
+		$$python setup.py clean; \
+	done
+
+
+install:build
+	dh_testdir
+	dh_clean -k
+	dh_installdirs
+
+	mkdir -p $(CURDIR)/debian/umit
+	set -e; \
+	for python in $(PYVERS); do \
+		python=$$(echo $$python | sed "s/$(PYDEF)/python/"); \
+		$$python setup.py install --prefix=/usr --root=debian/umit; \
+	done
+
+
+
+	#mkdir -p $(CURDIR)/debian/umit/usr/lib/python2.5/site-packages/
+	cp umit $(CURDIR)/debian/umit/usr/bin/umit
+	#tmp=`python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"`
+	#path_tmp="$(CURDIR)/debian/umit$(tmp)/"
+	#cp -r higwidgets $path_tmp
+	#cp -r umitGUI $path_tmp
+	#cp -r umitCore $path_tmp
+	#cp -r share/umit $(CURDIR)/debian/umit/usr/share/
+	#cp share/icons/* $(CURDIR)/debian/umit/usr/share/icons
+	#cp share/pixmaps/* $(CURDIR)/debian/umit/usr/share/pixmaps
+	#python $(CURDIR)/setup.py install --prefix=/usr 
+	
+	cp umit.desktop	$(CURDIR)/debian/umit/usr/share/applications/
+	cp umit-root.desktop	$(CURDIR)/debian/umit/usr/share/applications/
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs CHANGELOG
+	dh_installdocs
+	dh_installexamples
+#	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+	dh_python
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+	dh_pycentral
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
Index: /branch/ubuntu/debian/umit.prerm.debhelper
===================================================================
--- /branch/ubuntu/debian/umit.prerm.debhelper (revision 2963)
+++ /branch/ubuntu/debian/umit.prerm.debhelper (revision 2963)
@@ -0,0 +1,43 @@
+# Automatically added by dh_python
+dpkg -L umit |
+	awk '$0~/\.py$/ {print $0"c\n" $0"o"}' |
+	xargs rm -f >&2
+# End automatically added section
+# Automatically added by dh_pycentral
+case "$1" in remove|upgrade)
+if which python >/dev/null 2>&1 && which pycentral >/dev/null 2>&1; then
+	pycentral pkgremove umit
+else
+	flist=$(tempfile)
+	slist=$(tempfile)
+	dpkg -L umit | tee $flist | \
+	while read n; do
+	  case "$n" in
+	    /usr/share/pyshared/*)
+	      n2=${n#/usr/share/pyshared/*}
+	      case "$n" in
+		*.py) echo "p $n";;
+		*) [ -d "$n" ] && echo "d $n2" || echo "f $n2"
+	      esac
+	      ;;
+	    *) continue
+	  esac
+	done > $slist
+	if [ -s $slist ]; then
+	    for d in /usr/lib/python[0-9].[0-9]/????-packages; do
+		case "$d" in */python2.1/*|*/python2.2/*) continue; esac
+		while read t n; do
+		    case "$t" in
+			p) rm -f $d/$n $d/${n}[co];;
+			d) rmdir $d/$n 2>/dev/null || true;;
+			*) rm -f $d/$n
+		    esac
+		done < $slist
+	    done
+	fi
+        awk '/\/usr\/share\/pyshared/ {next} /\.py$/ {print $0"c\n" $0"o"}' $flist \
+	    | xargs -r rm -f >&2
+	rm -f $flist $slist
+fi
+esac
+# End automatically added section
Index: /branch/ubuntu/debian/README.Debian
===================================================================
--- /branch/ubuntu/debian/README.Debian (revision 2963)
+++ /branch/ubuntu/debian/README.Debian (revision 2963)
@@ -0,0 +1,6 @@
+umit for Debian
+---------------
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- Luis <luis@umitproject.org>  Mon, 12 May 2008 21:08:14 +0100
Index: /branch/ubuntu/Paths.py
===================================================================
--- /branch/ubuntu/Paths.py (revision 2963)
+++ /branch/ubuntu/Paths.py (revision 2963)
@@ -0,0 +1,331 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2005 Insecure.Com LLC.
+#
+# Author: Adriano Monteiro Marques <py.adriano@gmail.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from os import R_OK, W_OK, access, mkdir, getcwd, environ, getcwd
+from os.path import exists, join, split, abspath, dirname
+from tempfile import mktemp
+from types import StringTypes
+
+import os.path
+import sys
+
+from umitCore.UmitLogging import log
+from umitCore.UmitConfigParser import UmitConfigParser
+from umitCore.BasePaths import base_paths, HOME
+from umitCore.TempConf import create_temp_conf_dir
+from umitCore.I18N import _
+from umitCore.Version import VERSION
+
+# Look for files relative to the script path to allow running within the build
+# directory.
+main_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
+if hasattr(sys, "frozen"):
+    main_dir = dirname(sys.executable)
+
+CONFIG_DIR = "/usr/share/umit/config"
+LOCALE_DIR = "/usr/share/umit/locale"
+MISC_DIR = "/usr/share/umit/misc"
+ICONS_DIR = "/usr/share/icons"
+PIXMAPS_DIR = "/usr/share/pixmaps"
+DOCS_DIR = "/usr/share/umit/docs"
+
+
+#######
+# Paths
+class Paths(object):
+    """Paths
+    """
+    config_parser = UmitConfigParser()
+    paths_section = "paths"
+
+    hardcoded = ["locale_dir",
+                 "pixmaps_dir",
+                 "icons_dir",
+                 "misc_dir",
+                 "docs_dir"]
+
+    config_files_list = ["config_file",
+                         "profile_editor",
+                         "wizard",
+                         "scan_profile",
+                         "options",
+                         "umit_version"]
+
+    empty_config_files_list = ["target_list",
+                               "recent_scans",
+                               "umitdb"]
+
+    share_files_list = ["umit_opt",
+                        "umit_opf"]
+
+    misc_files_list = ["services_dump",
+                       "os_dump",
+                       "os_classification"]
+
+    other_settings = ["nmap_command_path"]
+
+    config_file_set = False
+    
+    def set_umit_conf(self, base_dir):
+        main_config_dir = ""
+        main_config_file = ""
+        if exists(CONFIG_DIR) and \
+            exists(join(CONFIG_DIR, base_paths['config_file'])):
+            main_config_dir = CONFIG_DIR
+
+        elif exists(join(base_dir, CONFIG_DIR)) and\
+            exists(join(base_dir,
+                        CONFIG_DIR,
+                        base_paths['config_file'])):
+            main_config_dir = join(base_dir, CONFIG_DIR)
+
+        elif exists(join(split(base_dir)[0], CONFIG_DIR)) and \
+            exists(join(split(base_dir)[0],
+                        CONFIG_DIR,
+                        base_paths['config_file'])):
+            main_config_dir = join(split(base_dir)[0], CONFIG_DIR)
+
+        else:
+            main_config_dir = create_temp_conf_dir(VERSION)
+
+        # Main config file, based on the main_config_dir got above
+        main_config_file = join(main_config_dir, base_paths['config_file'])
+
+        # This is the expected place in which umit.conf should be placed
+        supposed_file = join(base_paths['user_dir'], base_paths['config_file'])
+        config_dir = ""
+        config_file = ""
+
+        if exists(supposed_file)\
+               and check_access(supposed_file, R_OK and W_OK):
+            config_dir = base_paths['user_dir']
+            config_file = supposed_file
+            log.debug(">>> Using config files in user home \
+directory: %s" % config_file)
+
+        elif not exists(supposed_file)\
+             and not check_access(base_paths['user_dir'],
+                                  R_OK and W_OK):
+            try:
+                result = create_user_dir(join(main_config_dir,
+                                              base_paths['config_file']),
+                                         HOME)
+                if type(result) == type({}):
+                    config_dir = result['config_dir']
+                    config_file = result['config_file']
+                    log.debug(">>> Using recently created config files in \
+user home: %s" % config_file)
+                else:
+                    raise Exception()
+            except:
+                log.debug(">>> Failed to create user home")
+
+        if config_dir and config_file:
+            # Checking if the version of the configuration files are the same
+            # as this Umit's version
+            if not self.check_version(config_dir):
+                log.debug(">>> The config files versions are different!")
+                log.debug(">>> Running update scripts...")
+                self.update_config_dir(config_dir)
+
+        else:
+            log.debug(">>> There is no way to create nor use home connfigs.")
+            log.debug(">>> Trying to use main configuration files...")
+
+            config_dir = main_config_dir
+            config_file = main_config_file
+
+        # Parsing the umit main config file
+        self.config_parser.read(config_file)
+
+        # Should make the following only after reading the umit.conf file
+        self.config_dir = config_dir
+        self.config_file = config_file
+        self.config_file_set = True
+        self.locale_dir = LOCALE_DIR
+        self.pixmaps_dir = PIXMAPS_DIR
+        self.icons_dir = ICONS_DIR
+        self.misc_dir = MISC_DIR
+        self.docs_dir = DOCS_DIR
+
+        log.debug(">>> Config file: %s" % config_file)
+
+    def update_config_dir(self, config_dir):
+        # Do any updates of configuration files. Not yet implemented.
+        pass
+
+    def check_version(self, config_dir):
+        version_file = join(config_dir, base_paths['umit_version'])
+
+        if exists(version_file):
+            ver = open(version_file).readline().strip()
+
+            log.debug(">>> This Umit Version: %s" % VERSION)
+            log.debug(">>> Version of the files in %s: %s" % (config_dir, ver))
+
+            if VERSION == ver:
+                return True
+        return False
+
+    def root_dir(self):
+        """Retrieves root dir on current filesystem"""
+        curr_dir = getcwd()
+        while True:
+            splited = split(curr_dir)[0]
+            if curr_dir == splited:
+                break
+            curr_dir = splited
+
+        log.debug(">>> Root dir: %s" % curr_dir)
+        return curr_dir
+
+    def __getattr__(self, name):
+        if self.config_file_set:
+            if name in self.other_settings:
+                return self.config_parser.get(self.paths_section, name)
+
+            elif name in self.hardcoded:
+                return self.__dict__[name]
+
+            elif name in self.config_files_list:
+                return return_if_exists(join(self.__dict__['config_dir'],
+                                             base_paths[name]))
+
+            elif name in self.empty_config_files_list:
+                return return_if_exists(join(self.__dict__['config_dir'],
+                                             base_paths[name]),
+                                        True)
+
+            elif name in self.share_files_list:
+                return return_if_exists(join(self.__dict__['pixmaps_dir'],
+                                             base_paths[name]))
+
+            elif name in self.misc_files_list:
+                return return_if_exists(join(self.__dict__["misc_dir"],
+                                                     base_paths[name]))
+
+            try:
+                return self.__dict__[name]
+            except:
+                raise NameError(name)
+        else:
+            raise Exception("Must set config file location first")
+
+    def __setattr__(self, name, value):
+        if name in self.other_settings:
+            self.config_parser.set(self.paths_section, name, value)
+        else:
+            self.__dict__[name] = value
+
+####################################
+# Functions for directories creation
+
+def create_user_dir(config_file, user_home):
+    log.debug(">>> Create user dir at given home: %s" % user_home)
+    log.debug(">>> Using %s as source" % config_file)
+
+    main_umit_conf = UmitConfigParser()
+    main_umit_conf.read(config_file)
+    paths_section = "paths"
+
+    user_dir = join(user_home, base_paths['config_dir'])
+
+    if exists(user_home)\
+           and access(user_home, R_OK and W_OK)\
+           and not exists(user_dir):
+        mkdir(user_dir)
+        log.debug(">>> Umit user dir successfully created! %s" % user_dir)
+    else:
+        log.warning(">>> No permissions to create user dir!")
+        return False
+
+    main_dir = split(config_file)[0]
+    copy_config_file("options.xml", main_dir, user_dir)
+    copy_config_file("profile_editor.xml", main_dir, user_dir)
+    copy_config_file("scan_profile.usp", main_dir, user_dir)
+    copy_config_file("umit_version", main_dir, user_dir)
+    copy_config_file("wizard.xml", main_dir, user_dir)
+
+    return dict(user_dir = user_dir,
+                config_dir = user_dir,
+                config_file = copy_config_file("umit.conf",
+                                               split(config_file)[0],
+                                               user_dir))
+
+def copy_config_file(filename, dir_origin, dir_destiny):
+    log.debug(">>> copy_config_file %s to %s" % (filename, dir_destiny))
+
+    origin = join(dir_origin, filename)
+    destiny = join(dir_destiny, filename)
+
+    if not exists(destiny):
+        # Quick copy
+        origin_file = open(origin, 'r')
+        destiny_file = open(destiny, 'w')
+        destiny_file.write(origin_file.read())
+        origin_file.close()
+        destiny_file.close()
+    return destiny
+
+def check_access(path, permission):
+    if type(path) in StringTypes:
+        return exists(path) and access(path, permission)
+    return False
+
+def return_if_exists(path, create=False):
+    path = abspath(path)
+    if exists(path):
+        return path
+    elif create:
+        f = open(path, "w")
+        f.close()
+        return path
+    raise Exception("File '%s' does not exist or could not be found!" % path)
+
+############
+# Singleton!
+Path = Paths()
+
+if __name__ == '__main__':
+    Path.set_umit_conf(split(sys.argv[0])[0])
+
+    print ">>> SAVED DIRECTORIES:"
+    print ">>> LOCALE DIR:", Path.locale_dir
+    print ">>> PIXMAPS DIR:", Path.pixmaps_dir
+    print ">>> CONFIG DIR:", Path.config_dir
+    print
+    print ">>> FILES:"
+    print ">>> CONFIG FILE:", Path.config_file
+    print ">>> TARGET_LIST:", Path.target_list
+    print ">>> PROFILE_EDITOR:", Path.profile_editor
+    print ">>> WIZARD:", Path.wizard
+    print ">>> SCAN_PROFILE:", Path.scan_profile
+    print ">>> RECENT_SCANS:", Path.recent_scans
+    print ">>> OPTIONS:", Path.options
+    print
+    print ">>> UMIT_OPT:", Path.umit_opt
+    print ">>> UMIT_OPF:", Path.umit_opf
+    print ">>> UMITDB:", Path.umitdb
+    print ">>> SERVICES DUMP:", Path.services_dump
+    print ">>> OS DB DUMP:", Path.os_dump
+    print ">>> UMIT VERSION:", Path.umit_version
+    print ">>> OS CLASSIFICATION DUMP:", Path.os_classification
+    print ">>> NMAP COMMAND PATH:", Path.nmap_command_path
Index: /branch/ubuntu/umit.desktop
===================================================================
--- /branch/ubuntu/umit.desktop (revision 2963)
+++ /branch/ubuntu/umit.desktop (revision 2963)
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Umit
+GenericName=Umit
+Comment=Umit Scanner
+Icon=/usr/share/icons/umit_16.ico
+Exec=umit
+Terminal=false
+Type=Application
+Categories=Network
Index: /branch/ubuntu/umit-root.desktop
===================================================================
--- /branch/ubuntu/umit-root.desktop (revision 2963)
+++ /branch/ubuntu/umit-root.desktop (revision 2963)
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Umit (as root)
+GenericName=Umit (as root)
+Comment=Umit Scanner
+Icon=/usr/share/icons/umit_16.ico
+Exec=gksudo umit
+Terminal=false
+Type=Application
+Categories=Network
