Module pychrysalide.analysis.db
Class AdminClient
Class AnalystClient
Class DbCollection
Class DbItem
Class HubClient
Class HubServer
Class certs
Module pychrysalide.analysis.db
Documentation
Python module for Chrysalide.analysis.db
Sub modules
Classes
Class AdminClient
AdminClient provides control of the registered binary contents available from a server.
Such clients must be authenticated and communications are encrypted using TLS.
Instances can be created using the following constructor:
AdminClient()
AdminClient instances emit the following signals:
- 'existing-binaries-updated'
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.HubClient ╰── pychrysalide.analysis.db.AdminClient
Methods
request_existing_binaries(self)
Ask the server for a list of all existing analyzed binaries and returns the status of the request transmission.
A existing-binaries-updated
signal is emitted when the existing_binaries
attribute gets ready for reading.
Attributes
existing_binaries
Provide the list of all exisiting binaries on the server side.
The returned value is a tuple of strings or an empty tuple.
Class AnalystClient
AnalystClient provides and receives binary updates to and from a connected to a server.
Such clients must be authenticated and communications are encrypted using TLS.
Instances can be created using the following constructor:
AnalystClient(hash, class, list, loaded=None)
Where hash
is a SHA256 fingerprint of the studied binary, class
refers to the nature description of the loaded content (as provided from content_class)
, list
is a list of DbCollection
instances ; this kind of list can be retrived with the collections
attribute. The loaded
object is an optional local already loaded content which has to be a LoadedContent
instance or None
.
AnalystClient instances emit the following signals:
- 'snapshots-updated'
Handlers are expected to have only one argument: the client managing the updated snapshots.
- 'snapshot-changed'
Handlers are expected to have only one argument: the client managing the snapshots.
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.HubClient ╰── pychrysalide.analysis.db.AnalystClient
Methods
create_snapshot(self)
Ask the server for creating a new snapshot of the current state and returns the status of the request transmission.
A 'snapshots-updated' signal is emitted once the request has been processed with success.
remove_snapshot(self, id, recursive)
Ask the server for removing a given snapshot using its identifier and returns the status of the request transmission.
If this removal has not to be recursive, all children snapshots get reassigned to the parent snapshot of the target.
A 'snapshots-updated' signal is emitted once the request has been processed with success.
restore_snapshot(self, id)
Ask the server for restoring a given snapshot using its identifier and returns the status of the request transmission.
A 'snapshot-changed' signal is emitted once the request has been processed with success.
save(self)
Ask the server for saving the current state of the analyzed binary and returns the status of the request transmission.
send_content(self, content)
Ask the server for saving the current state of the analyzed binary and returns the status of the request transmission.
set_last_active(self, timestamp)
Define the timestamp of the last active item in the collection and returns the status of the request transmission.
This method should not be used directly. Prefer calling set_last_active()
instead, as some items may be volatile and thus not handled by clients.
set_snapshot_desc(self, id, desc)
Ask the server for defining a new description for a snapshot using its identifier and returns the status of the request transmission.
A 'snapshots-updated' signal is emitted once the request has been processed with success.
set_snapshot_name(self, id, name)
Ask the server for defining a new name of for a snapshot using its identifier and returns the status of the request transmission.
A 'snapshots-updated' signal is emitted once the request has been processed with success.
Attributes
current_snapshot
Identifier of the current snapshot, provided as a string.
The returned value is a cached version of the value stored at server side. Thus, defining a new current snapshot is successful as soon as the request to this server is sent.
snapshots
List of all existing snapshots, provided as a tuple of StructObject
.
Each snapshot is characterised by the following properties :
- parent_id : identifier of the parent snapshot;
- id : identifier of the snapshot;
- created : timestamp of the creation date;
- name : name of the snapshot, or None;
- desc : description of the snapshot, or None.
Constants
LoadingStatusHint
Indication about a loading process state.
0 | = 0 |
1 | = 1 |
2 | = 2 |
3 | = 3 |
4 | = 4 |
Class DbCollection
PyChrysalide collection for DataBase collection
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.DbCollection
Known subclasses:
- pychrysalide.analysis.db.items.BookmarkCollection
- pychrysalide.analysis.db.items.CommentCollection
- pychrysalide.analysis.db.items.SwitcherCollection
Attributes
items
List of all items contained in the collection.
These items can currently be applied or not.
Class DbItem
DbItem handles all kinds of updates applied to the disassebled code.
These items are managed using a client/server model.
See the items
package for a full list of existing items.
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.DbItem
Known subclasses:
- pychrysalide.analysis.db.items.DbBookmark
- pychrysalide.analysis.db.items.DbComment
- pychrysalide.analysis.db.items.DbSwitcher
Methods
add_flag(self, flag)
Add a property to a database item.
This property is one of the values listed in the of DbItemFlags
enumeration.
remove_flag(self, flag)
Remove a property from a database item.
This property is one of the values listed in the of DbItemFlags
enumeration.
Attributes
flags
Properties of the database item, provided as a mask of DbItemFlags
values.
label
String describing the effect of the database item.
timestamp
Timestamp of the item creation.
Constants
DBFeatures
Features provided by database items.
0 | = 0 |
1 | = 1 |
2 | = 2 |
3 | = 3 |
DbItemFlags
Properties of a database item.
1 | = 0x1 |
2 | = 0x2 |
4 | = 0x4 |
8 | = 0x8 |
16 | = 0x10 |
Class HubClient
HubClient provides and receives binary updates to and from a connected to a server.
Such clients must be authenticated and communications are encrypted using TLS.
Instances can be created directly.
HubClient instances emit the following signals:
- 'snapshots-updated'
Handlers are expected to have only one argument: the client managing the updated snapshots.
- 'snapshot-changed'
Handlers are expected to have only one argument: the client managing the snapshots.
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.HubClient
Known subclasses:
Methods
start(self, host=None, port=1337, ipv6=True)
Connect to a server for binary updates.
host and port define the properties of the server, and ipv6 tries to establish IPv6 connections first.
stop(self)
Stop the client.
Class HubServer
HubServer creates a server listening for binary updates from clients.
Such clients are authenticated and communications are encrypted using TLS.
There are two kinds of servers:
- one "local", which aims to server one given local user account;
- one "remote", which may target several different users at the same time.
Instances can be created using the following constructor:
HubServer() HubServer(host='localhost', port='1337', ipv6=True)
Where host and port define the listening properties of the server, and ipv6 tries to establish IPv6 connections first.
Without any parameters, a local server is created.
Hierarchy
builtins.object ╰── gi._gi.GObject ╰── pychrysalide.analysis.db.HubServer
Methods
start(self, backlog=10)
Run a listening server waiting for client connections.
The backlog argument defines the maximum length to which the queue of pending connections may grow.
The returned value is a status of type ServerStartStatus
.
stop(self)
Stop the listening server.
Constants
ServerStartStatus
Status of a server start.
0 | = 0 |
1 | = 1 |
2 | = 2 |
Class certs
PyChrysalide support for DataBase certicates
Hierarchy
builtins.object ╰── pychrysalide.analysis.db.certs
Methods
build_keys_and_ca(dir, label, valid, entries)
Create a certificate authority.
build_keys_and_request(dir, label, entries)
Create a certificate sign request.
sign_cert(csr, cacert, cakey, cert, valid)
Sign a certificate sign request.