Пример #1
0
    def on_switch(self, widget, data, more):
        if more == 2:
            # Check if the disassembly library is present
            # Check only for Linux platform
            if platform.system() == 'Linux':
                path = core.get_profile_file_path('data' + os.sep)
                has_distorm = core.check_distorm_lib(path)
                if not has_distorm:
                    md = Gtk.MessageDialog(
                        parent=None,
                        flags=Gtk.DialogFlags.MODAL,
                        type=Gtk.MessageType.ERROR,
                        buttons=Gtk.ButtonsType.CLOSE,
                        message_format=
                        'distorm64 library not found.\nDownload it at the preferences dialog, on the "Update" tab.'
                    )
                    md.run()
                    md.destroy()

            if self.config.HAS_SOURCEVIEW:
                self.toolbar.hide()
                self.bokken_tb.show()
                self.statusbar.hide()
                self.bokken_statusbar.show_all()
            self.bottom_nb.hide()
        elif more == 1:
            if self.config.HAS_SOURCEVIEW:
                self.toolbar.show()
                self.bokken_tb.hide()
                self.statusbar.show()
                self.bokken_statusbar.hide()
            self.bottom_nb.hide()
        elif more == 3:
            if self.config.HAS_SOURCEVIEW:
                self.toolbar.show()
                self.bokken_tb.hide()
                self.statusbar.show()
                self.bokken_statusbar.hide()
            if self.exploits_nb.get_current_page() == 1:
                self.bottom_nb.show()
        else:
            if self.config.HAS_SOURCEVIEW:
                self.toolbar.show()
                self.bokken_tb.hide()
                self.statusbar.show()
                self.bokken_statusbar.hide()
            if self.bottom_nb.is_visible:
                self.bottom_nb.show()
            else:
                self.bottom_nb.hide()
Пример #2
0
 def geoIp(self, widget):
     geodb_path = get_profile_file_path('data' + os.sep + 'GeoLiteCity.dat')
     print(geodb_path)
     if os.path.exists(geodb_path):
         if config.HAS_GEOIP:
             import lib.ui.geoip as geoip
             geoip.Gui(self.uicore)
     else:
         md = Gtk.MessageDialog(
             None, Gtk.DialogFlags.DESTROY_WITH_PARENT,
             Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE,
             "GeoIP Database not found!\n\nDownload it at the preferences dialog\nunder the Update tab"
         )
         md.run()
         md.destroy()
Пример #3
0
    def download_distorm(self, widget):

        self.dis_bt.set_sensitive(False)
        import platform
        path = get_profile_file_path('data' + os.sep)

        if platform.system() != 'Linux':
            md = Gtk.MessageDialog(parent=None, flags=Gtk.DialogFlags.MODAL, type=Gtk.MessageType.ERROR, buttons=Gtk.ButtonsType.CLOSE, message_format='Download distorm library installer for Windows at this site:\nhttp://breakingcode.wordpress.com/2009/08/31/using-distorm-with-python-2-6-and-python-3-x-revisited/')
            md.run()
            md.destroy()
            return False
        elif platform.machine() == 'x86_64':
            page = "http://inguma.eu/attachments/download/68/libdistorm64-64.so"
        else:
            page = "http://inguma.eu/attachments/download/69/libdistorm64-32.so"
        self.gom.echo( "Downloading " + page, False )
        urllib.request.urlretrieve(page, path + "libdistorm64.so")
        self.gom.echo( "Operation Complete", False )
        self.dis_bt.set_sensitive(True)
Пример #4
0
    def download_geodb(self):
        self.GEOIP_DIR='data/'
        self.INGUMA_DIR = os.getcwd()

        page = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
        self.gom.echo( "Downloading " + page, False )
        geoip_db_path = get_profile_file_path('data/');
        urllib.request.urlretrieve(page, geoip_db_path + "GeoLiteCity.dat.gz")

        # Extract DB and remove original file
        self.gom.echo( "Extracting files...", False )
        gz = gzip.open(geoip_db_path + "GeoLiteCity.dat.gz")
        db = gz.read()
        gz.close()
        os.remove(geoip_db_path + "GeoLiteCity.dat.gz")
        geodb = open(geoip_db_path + 'GeoLiteCity.dat', 'w')
        geodb.write(db)
        geodb.close()
        self.gom.echo( "Operation Complete", False )
Пример #5
0
    def download_db(self):
        """ Download the Maxmind DB. """
        geoip_db_path = get_profile_file_path('data/GeoLiteCity.dat')

        page = "http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz"
        self.gom.echo("Downloading " + page, False)
        urllib.urlretrieve(page, geoip_db_path + '.gz')

        # Extract DB and remove original file
        self.gom.echo("Extracting files...", False)
        gz = gzip.open(geoip_db_path + '.gz')
        db = gz.read()
        gz.close()
        os.remove(geoip_db_path + '.gz')
        geodb = open(geoip_db_path, 'w')
        geodb.write(db)
        geodb.close()
        self.gom.echo("Operation complete", False)

        return True
Пример #6
0
    def run(self):
        try:
            import GeoIP
        except:
            self.gom.echo("No GeoIp library found, please install it")
            return False

        if self.target == "download":
            self.download_db()
            return False
        elif self.target == "all":
            self.targets = self.user_data['hosts']
        else:
            self.targets = [self.target]

        if self.check_db() == False:
            self.gom.echo('GeoIP database not found, install it setting target = \"download\" and running geoip again')
            return False
        else:
            geoip_db_path = get_profile_file_path('data/GeoLiteCity.dat')
            self.gi = GeoIP.open(geoip_db_path, GeoIP.GEOIP_STANDARD)

            return True
Пример #7
0
#       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., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
""" Library containing functions related to KB autosave feature. """

import os
from gi.repository import Gtk
from lib.core import get_profile_file_path

_autosave_kb_path = get_profile_file_path('autosaved.kb')


def ask_dialog():
    """ Prompt the use with a GTK dialog for loading the KB. """
    msg = ("Autosaved KB found. Load it?")
    dlg = Gtk.MessageDialog(None, Gtk.DialogFlags.MODAL,
                            Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO,
                            msg)
    dlg.set_default_response(Gtk.ResponseType.YES)
    opt = dlg.run()
    dlg.destroy()

    if opt == Gtk.ResponseType.YES:
        return True
    else: