root/branch/NetworkInventory/umitCore/BasePaths.py @ 3835

Revision 3835, 5.8 kB (checked in by gpolo, 4 years ago)

Merged revisions 3792,3794,3797-3804 via svnmerge from
http://svn.umitproject.org/svnroot/umit/trunk

........

r3792 | nopper | 2008-11-18 06:48:17 -0200 (Tue, 18 Nov 2008) | 1 line


Merging UmitPlugins into trunk

........

r3794 | nopper | 2008-11-18 19:32:15 -0200 (Tue, 18 Nov 2008) | 1 line


Fixing plugins building

........

r3797 | getxsick | 2008-11-29 15:55:16 -0200 (Sat, 29 Nov 2008) | 1 line


ticket #174: patched proposed by nopper, rewritten and modified by getxsick

........

r3798 | luis | 2008-11-29 16:08:19 -0200 (Sat, 29 Nov 2008) | 6 lines


Integration of RadialNet:

  • higwidgets
  • Added Mapper to Notebook
  • Change version number Credit for commit: me and Daniel Cassiano AUTHOR of RadialNet: Joao Medeiros

........

r3799 | luis | 2008-11-29 16:08:46 -0200 (Sat, 29 Nov 2008) | 1 line


Forget add Mapper Page

........

r3800 | luis | 2008-11-30 11:00:58 -0200 (Sun, 30 Nov 2008) | 1 line


Fixed RadialNet rotate

........

r3801 | nopper | 2008-11-30 12:32:25 -0200 (Sun, 30 Nov 2008) | 1 line


Stupid fix

........

r3802 | getxsick | 2008-11-30 13:17:26 -0200 (Sun, 30 Nov 2008) | 1 line


fixed #179: casting to int with correct condition and rewritten the related code block.

........

r3803 | luis | 2008-11-30 13:31:56 -0200 (Sun, 30 Nov 2008) | 1 line


Fixed box packing issue for each Node

........

r3804 | luis | 2008-11-30 14:17:30 -0200 (Sun, 30 Nov 2008) | 1 line


Fix: update list of profiles inside ProfileManager?

........

Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Copyright (C) 2005-2006 Insecure.Com LLC.
5# Copyright (C) 2007-2008 Adriano Monteiro Marques
6#
7# Author: Adriano Monteiro Marques <adriano@umitproject.org>
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23import os
24import os.path
25import sys
26
27
28######################
29# Platform recognition
30PLATFORM = sys.platform
31HOME = os.path.expanduser("~")
32#HOME = os.environ.get('HOME', '')
33CURRENT_DIR = os.getcwd()
34
35# Look for files relative to the script path to allow running within the build
36# directory.
37main_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
38if hasattr(sys, "frozen"):
39    main_dir = os.path.dirname(sys.executable)
40
41CONFIG_DIR = os.path.join(main_dir, "share", "umit", "config")
42LOCALE_DIR = os.path.join(main_dir, "share", "locale")
43MISC_DIR = os.path.join(main_dir, "share", "umit", "misc")
44ICONS_DIR = os.path.join(main_dir, "share", "icons", "umit")
45PIXMAPS_DIR = os.path.join(main_dir, "share", "pixmaps", "umit")
46PLUGINS_DIR = os.path.join(main_dir, "share", "umit", "plugins")
47DOCS_DIR = os.path.join(main_dir, "share", "doc", "umit")
48
49base_paths = dict(config_file = 'umit.conf',
50                  config_dir = '.umit',
51                  user_dir = os.path.join(HOME, '.umit'),
52                  scan_profile = 'scan_profile.usp',
53                  profile_editor = 'profile_editor.xml',
54                  recent_scans = 'recent_scans.txt',
55                  target_list = 'target_list.txt',
56                  wizard = 'wizard.xml',
57                  options = 'options.xml',
58                  umit_opf = 'umit.opf',
59                  umit_opt = 'umit.opt',
60                  scripts_dir = os.path.join('share', 'scripts'),
61                  pixmaps_dir = PIXMAPS_DIR,
62                  plugins_dir = PLUGINS_DIR,
63                  i18n_dir = LOCALE_DIR,
64                  i18n_message_file = 'umit.mo',
65                  scan_results_extension = 'usr',  # comes from umit scan result
66                  scan_profile_extension = 'usp',  # comes from umit scan profile
67                  user_home = HOME,
68                  basic_search_sequence = [HOME, CURRENT_DIR],
69                  config_search_sequence = [HOME, CURRENT_DIR],
70                  pixmaps_search_sequence = [os.path.join(CURRENT_DIR, PIXMAPS_DIR),
71                                             HOME],
72                  i18n_search_sequence = [os.path.join(CURRENT_DIR, LOCALE_DIR), HOME],
73                  umitdb = "umit.db",
74
75                  # new generation database
76                  umitdb_ng = "umitng.db",
77
78                  # timeline configuration
79                  tl_conf = "timeline-settings.conf",
80                  tl_colors_std = "tl_colors_evt_std.conf",
81                 
82                  # scheduler
83                  sched_schemas = "scheduler-schemas.conf",
84                  sched_profiles = "scheduler-profiles.conf",
85                  sched_log = "scheduler.log",
86
87                  # smtp
88                  smtp_schemas = "smtp-schemas.conf",
89
90                  services = "nmap-services",
91                  services_dump = "services.dmp",
92                  os_db = "nmap-os-db",
93                  os_dump = "os_db.dmp",
94                  os_fingerprints = "nmap-os-fingerprints",
95                  umit_version = "umit_version",
96                  os_classification = "os_classification.dmp")
97
98
99if PLATFORM == 'linux2' or PLATFORM == 'linux1':
100    base_paths.update(dict(user_home = HOME,
101                           basic_search_sequence = [os.path.join(HOME, base_paths['config_dir']),
102                                                    '/opt/umit', HOME, CURRENT_DIR],
103                           config_search_sequence = [os.path.join(HOME, base_paths['config_dir']),
104                                                     CURRENT_DIR, '/etc'],
105                           pixmaps_search_sequence = [os.path.join(CURRENT_DIR, PIXMAPS_DIR),
106                                                      '/usr/share/pixmaps/umit',
107                                                      '/opt/umit', HOME],
108                           i18n_search_sequence = [os.path.join(CURRENT_DIR, LOCALE_DIR),
109                                                   '/usr/share/locale',
110                                                   HOME, CURRENT_DIR]))
111elif PLATFORM == 'win32':
112    PROGRAM_FILES = os.environ.get("PROGRAMFILES", "\\")
113    UMIT_DIR = os.path.join(PROGRAM_FILES, "Umit")
114    PIXMAPS_DIR = os.path.join(UMIT_DIR, PIXMAPS_DIR)
115   
116    base_paths.update(dict(\
117        basic_search_sequence = [UMIT_DIR, PROGRAM_FILES, HOME, CURRENT_DIR],
118        config_search_sequence = [UMIT_DIR, PROGRAM_FILES, HOME, CURRENT_DIR],
119        pixmaps_search_sequence = [PIXMAPS_DIR, PROGRAM_FILES,
120                                   os.path.join(CURRENT_DIR, PIXMAPS_DIR),
121                                   HOME],
122        i18n_search_sequence = [UMIT_DIR, PROGRAM_FILES,
123                                os.path.join(CURRENT_DIR, LOCALE_DIR), HOME],))
124
125elif PLATFORM == 'darwin':
126    base_paths.update(dict(user_home = HOME,
127                           basic_search_sequence = [os.path.join(HOME, 'Applications'),
128                                                    '/Local', '/Network',
129                                                    '/System/Library', HOME]))
130
Note: See TracBrowser for help on using the browser.