Пример #1
0
 /**
  * Changes the name of the module.
  *
  * @param name The new name of the module.
  * @throws IllegalArgumentException Thrown if the name argument is null.
  * @throws CouldntSaveDataException Thrown if the name of the module could not be changed.
  */
 public void setName(final String name) throws CouldntSaveDataException {
   try {
     m_module.getConfiguration().setName(name);
   } catch (
       final com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException e) {
     throw new CouldntSaveDataException(e);
   }
 }
Пример #2
0
 /**
  * Changes the image base of the module.
  *
  * @param address The new image base of the module.
  * @throws IllegalArgumentException Thrown if the address argument is null.
  * @throws CouldntSaveDataException Thrown if the image base of the module could not be changed.
  */
 public void setImagebase(final Address address) throws CouldntSaveDataException {
   try {
     m_module.getConfiguration().setImageBase(new CAddress(address.toLong()));
   } catch (
       final com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException e) {
     throw new CouldntSaveDataException(e);
   }
 }
Пример #3
0
  @Override
  public void setValueAt(final Object value, final int row, final int col) {
    if ((col != NAME_COLUMN) && (col != DESCRIPTION_COLUMN)) {
      throw new IllegalStateException("IE01161: Column can not be edited");
    }

    final INaviModule module = getModules().get(row);

    if (col == NAME_COLUMN) {
      try {
        module.getConfiguration().setName((String) value);
      } catch (final CouldntSaveDataException e) {
        CUtilityFunctions.logException(e);

        final String innerMessage = "E00156: " + "Could not save address space name";
        final String innerDescription =
            CUtilityFunctions.createDescription(
                String.format(
                    "The new name of the address space '%s' could not be saved.",
                    m_addressSpace.getConfiguration().getName()),
                new String[] {"There was a problem with the database connection."},
                new String[] {"The address space keeps its old name."});

        NaviErrorDialog.show(null, innerMessage, innerDescription, e);
      }
    } else if (col == DESCRIPTION_COLUMN) {
      try {
        module.getConfiguration().setDescription((String) value);
      } catch (final CouldntSaveDataException e) {
        CUtilityFunctions.logException(e);

        final String innerMessage = "E00157: " + "Could not save address space description";
        final String innerDescription =
            CUtilityFunctions.createDescription(
                String.format(
                    "The new description of the address space '%s' could not be saved.",
                    m_addressSpace.getConfiguration().getName()),
                new String[] {"There was a problem with the database connection."},
                new String[] {"The address space keeps its old description."});

        NaviErrorDialog.show(null, innerMessage, innerDescription, e);
      }
    }
  }
Пример #4
0
 /**
  * Changes the debugger template of the module.
  *
  * @param template The new debugger template.
  * @throws CouldntSaveDataException Thrown if the new debugger template could not be saved to the
  *     database.
  */
 public void setDebuggerTemplate(final DebuggerTemplate template) throws CouldntSaveDataException {
   try {
     m_module
         .getConfiguration()
         .setDebuggerTemplate(template == null ? null : template.getNative());
   } catch (
       final com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException e) {
     throw new CouldntSaveDataException(e);
   }
 }
Пример #5
0
  @Override
  public Object getValueAt(final int row, final int col) {
    final INaviModule module = getModules().get(row);

    switch (col) {
      case NAME_COLUMN:
        return module.getConfiguration().getName();
      case DESCRIPTION_COLUMN:
        return module.getConfiguration().getDescription();
      case VIEWS_COLUMN:
        return module.isLoaded()
            ? module.getContent().getViewContainer().getViews().size()
            : module.getCustomViewCount() + module.getFunctionCount() + 1;
      case CREATION_DATE_COLUMN:
        return module.getConfiguration().getCreationDate();
      case MODIFICATION_DATE_COLUMN:
        return module.getConfiguration().getModificationDate();
      default:
        throw new IllegalStateException("IE01160: Invalid column");
    }
  }
Пример #6
0
  // / @endcond
  public Module(
      final Database database,
      final INaviModule module,
      final TagManager nodeTagManager,
      final TagManager viewTagManager) {
    m_database = Preconditions.checkNotNull(database, "Error: Database argument can't be null");
    m_module = Preconditions.checkNotNull(module, "Error: Module argument can't be null");
    m_nodeTagManager =
        Preconditions.checkNotNull(
            nodeTagManager, "Error: Node tag manager argument can't be null");
    m_viewTagManager =
        Preconditions.checkNotNull(
            viewTagManager, "Error: View tag manager argument can't be null");

    if (m_module.getConfiguration().getDebugger() != null) {
      m_debugger = new Debugger(m_module.getConfiguration().getDebugger());
    }

    if (module.isLoaded()) {
      convertData();
    }

    module.addListener(m_listener);
  }
Пример #7
0
  /**
   * Generates a name list from the names of the given modules.
   *
   * @param modules The modules that provide the names.
   * @return The generated name list.
   */
  public static String getNameList(final INaviModule[] modules) {
    int count = 0;

    final StringBuilder list = new StringBuilder();

    for (final INaviModule module : modules) {
      list.append("- ");
      list.append(module.getConfiguration().getName());
      list.append('\n');

      count++;

      if ((count == MAX_LIST_LENGTH) && (modules.length != MAX_LIST_LENGTH)) {
        list.append("\n... ");
        list.append(String.format("%d others ...", modules.length - count));

        break;
      }
    }

    return list.toString();
  }
Пример #8
0
 /**
  * Returns the SHA1 hash of the original input file.
  *
  * @return The SHA1 hash of the original input file.
  */
 public String getSHA1() {
   return m_module.getConfiguration().getSha1();
 }
Пример #9
0
 /**
  * Returns the name of the module.
  *
  * @return The name of the module.
  */
 public String getName() {
   return m_module.getConfiguration().getName();
 }
Пример #10
0
 /**
  * Returns the modification date of the module. This is the date when the module was last written
  * to the database.
  *
  * @return The modification date of the module.
  */
 public Date getModificationDate() {
   return m_module.getConfiguration().getModificationDate();
 }
Пример #11
0
 /**
  * Returns the image base of the module. This is the base address of the module as it really
  * occurs in memory after potential relocation operations.
  *
  * @return The image base of the module.
  */
 public Address getImagebase() {
   return new Address(m_module.getConfiguration().getImageBase().toBigInteger());
 }
Пример #12
0
 /**
  * Returns the database ID of the module.
  *
  * @return The database ID of the module.
  */
 public int getId() {
   return m_module.getConfiguration().getId();
 }
Пример #13
0
 /**
  * Returns the description of the module.
  *
  * @return The description of the module.
  */
 public String getDescription() {
   return m_module.getConfiguration().getDescription();
 }
 @Override
 public String toString() {
   return m_module.getConfiguration().getName();
 }