MIT License

项目介绍

Futsch1/asn1editor 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 19 个 Star、4 次 Fork。

仓库全名
Futsch1/asn1editor
开源许可证
MIT License
Star 数
19
Fork 数
4
未关闭 Issue
4

README 摘要

asn1editor Python based ASN.1 editor This project contains a generic editor to view and edit ASN.1 encoded data. It can load and save data encoded in various ASN.1 formats. It uses asn1tools to parse ASN.1 specifications and read and write encoded data. The controller part of the editor is written independently of the used GUI framework. A view implementation with wxPython is provided. Usage To start the wxPython…

完整内容见 GitHub 原始 README 或本页 。

常见问题

asn1editor 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 19 个 Star。

asn1editor 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 asn1editor 的源码?

可以直接克隆仓库:git clone https://github.com/Futsch1/asn1editor.git;安装与运行步骤见仓库 README。

asn1editor 最近还在维护吗?

仓库最近一次更新为 2023年8月22日,当前有 4 个未关闭 Issue;Star 数为 19,可作为社区活跃度的参考。

关于

Python based editor for ASN.1 encoded data

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
46
价值分
14
活跃状态
活跃

README

Build Coverage Status Maintainability Documentation Status

asn1editor

Python based ASN.1 editor

This project contains a generic editor to view and edit ASN.1 encoded data. It can load and save data encoded in various ASN.1 formats. It uses asn1tools to parse ASN.1 specifications and read and write encoded data.

The controller part of the editor is written independently of the used GUI framework. A view implementation with wxPython is provided.

Screenshot

Usage

To start the wxPython based editor, install asn1editor via pip:

pip install asn1editor

Then you can run asn1editor from the shell

asn1editor [-h] [-type TYPE] [-data DATA] [asn1spec]

The ASN.1 specification to be loaded can be passed as an (optional) argument. The type inside the ASN.1 specification can be selected using the syntax < Module name >.< Type name >. Finally, a data file can be passed as well that contains data encoded in the ASN.1 specification.

Features

Supported types

The editor supports a large variety of ASN.1 data types:

  • INTEGER
  • REAL
  • ENUMERATED
  • BOOLEAN
  • OCTET STRING, VisibleString, UTF8String, GeneralString, IA5String, OBJECT IDENTIFIER
  • BIT STRING
  • SEQUENCE, SET
  • SEQUENCE OF, SET OF
  • CHOICE
  • DATE, TIME-OF-DAY, DATE-TIME, GeneralizedTime, UTCTime

Supported encodings

The following encodings are supported for reading and writing data:

  • JER
  • OER
  • XER
  • DER
  • BER
  • PER
  • UPER

GUI features

  • Load and save encoded data
  • View the data in a tree view or as groups

Screenshot

  • See limits of numeric values and texts as tooltips
  • Edit octet strings as ASCII or hex
  • List of recently opened specifications for quick access

IMPORTS

IMPORT references are automatically resolved if the ASN1 files containing the imported types reside in the same directory and have the extension “.asn”.

Extending asn1editor

If you want to extend asn1editor with custom functionality, you can pass a plugin object to the WxPythonMainWindow object. The plugin object needs to inherit from asn1editor.Plugin.

Example:

import wx
from asn1editor import WxPythonMainWindow, Plugin

class MyPlugin(Plugin):
    # Implementation of abstract functions goes here
    pass

app = wx.App()

frame = WxPythonMainWindow([MyPlugin()])

frame.Show()

app.MainLoop()

Plugin interface

In order to use custom data formats or to work with the data, plugins can be used. These plugins need to inherit from the Plugin.Plugin class and can use the PluginInterface.PluginInterface class to interact with the main application. A list of plugins can be passed to the constructor of the main editor class and is then automatically embedded in the application.

An example application is if a custom header is added to an ASN.1 encoded data. Then the plugin can decode the header, choose the appropriate ASN.1 specification, load it, decode the data and display it.

Type augmenter

The editor can be customized to modify the display of certain fields. This customization is provided via a class that implements the TypeAugmenter interface. The editor will query additional information for every field via this interface. Currently, a field can be augmented by providing a help text and a style IntEnum. The help text will be shown in the tooltip of each field and the style flag modifies the way how a field is displayed. A field can be hidden or be declared as read-only.

The editor comes with a default implementation of this augmenter that uses a .style file to customize the way fields are displayed in asn1editor.

If an ASN.1 file is opened, asn1editor looks for an equally named file with a .style extension in the same directory. If it is found, it is loaded and used to refine the layout of the specification. A style file is in JSON format and contains the name of the ASN.1 field as a key, and the layout specifier as value. The specifiers are named “read_only” and “hidden”.

Example:

{
"firstField": "read_only",
"secondField": "hidden"
}

Tests

Apart from unit tests in the source folder, there is a project on testquality.com that contains a number of manual tests to qualify an asn1editor release here. You can log in using the credentials [email protected]/readonly to view the test cases and test results.

评论

暂无评论