types

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SMSCSVHeaders = []string{
		"ID",
		"THREAD_ID",
		"ADDRESS",
		"ADDRESS_DEVICE_ID",
		"PERSON",
		"DATE_RECEIVED",
		"DATE_SENT",
		"PROTOCOL",
		"READ",
		"STATUS",
		"TYPE",
		"REPLY_PATH_PRESENT",
		"DELIVERY_RECEIPT_COUNT",
		"SUBJECT",
		"BODY",
		"MISMATCHED_IDENTITIES",
		"SERVICE_CENTER",
		"SUBSCRIPTION_ID",
		"EXPIRES_IN",
		"EXPIRE_STARTED",
		"NOTIFIED",
		"READ_RECEIPT_COUNT",
	}

	MMSCSVHeaders = []string{
		"ID",
		"THREAD_ID",
		"DATE_SENT",
		"DATE_RECEIVED",
		"MESSAGE_BOX",
		"READ",
		"m_id",
		"sub",
		"sub_cs",
		"BODY",
		"PART_COUNT",
		"ct_t",
		"CONTENT_LOCATION",
		"ADDRESS",
		"ADDRESS_DEVICE_ID",
		"EXPIRY",
		"m_cls",
		"MESSAGE_TYPE",
		"v",
		"MESSAGE_SIZE",
		"pri",
		"rr",
		"rpt_a",
		"resp_st",
		"STATUS",
		"TRANSACTION_ID",
		"retr_st",
		"retr_txt",
		"retr_txt_cs",
		"read_status",
		"ct_cls",
		"resp_txt",
		"d_tm",
		"DELIVERY_RECEIPT_COUNT",
		"MISMATCHED_IDENTITIES",
		"NETWORK_FAILURE",
		"d_rpt",
		"SUBSCRIPTION_ID",
		"EXPIRES_IN",
		"EXPIRE_STARTED",
		"NOTIFIED",
		"READ_RECEIPT_COUNT",
	}
)

CSV column headers.

View Source
var ProtoCommitHash = "d6610f0"

ProtoCommitHash is the commit hash of the Signal Protobuf spec.

Functions

func StatementToStringArray

func StatementToStringArray(sql *signal.SqlStatement) []string

StatementToStringArray formats a SqlStatement fairly literally as an array. Null parameters are left empty.

Types

type BackupFile

type BackupFile struct {
	File      *bytes.Buffer
	CipherKey []byte
	MacKey    []byte
	Mac       hash.Hash
	IV        []byte
	Counter   uint32
}

BackupFile holds the internal state of decryption of a Signal backup.

func NewBackupFile

func NewBackupFile(path, password string) (*BackupFile, error)

NewBackupFile initialises a backup file for reading using the provided path and password.

func (*BackupFile) DecryptAttachment

func (bf *BackupFile) DecryptAttachment(a *signal.Attachment, out io.Writer) error

DecryptAttachment reads the attachment immediately next in the file's bytes.

func (*BackupFile) Frame

func (bf *BackupFile) Frame() (*signal.BackupFrame, error)

Frame returns the next frame in the file.

func (*BackupFile) Slurp

func (bf *BackupFile) Slurp() ([]*signal.BackupFrame, error)

Slurp consumes the entire BackupFile and returns a list of all frames contained in the file. Note that after calling this function, the underlying file buffer will be empty and the file should be considered dropped. Calling any function on the backup file after calling Slurp will fail.

Note that any attachments in the backup file will not be handled.

type MMS

type MMS struct {
	XMLName      xml.Name  `xml:"mms"`
	Parts        []MMSPart `xml:"parts,attr"`
	TextOnly     *uint64   `xml:"text_only,attr"`     // optional
	Sub          *string   `xml:"sub,attr"`           // optional
	RetrSt       string    `xml:"retr_st,attr"`       // required
	Date         uint64    `xml:"date,attr"`          // required
	CtCls        string    `xml:"ct_cls,attr"`        // required
	SubCs        string    `xml:"sub_cs,attr"`        // required
	Read         uint64    `xml:"read,attr"`          // required
	CtL          string    `xml:"ct_l,attr"`          // required
	TrID         string    `xml:"tr_id,attr"`         // required
	St           string    `xml:"st,attr"`            // required
	MsgBox       uint64    `xml:"msg_box,attr"`       // required
	Address      uint64    `xml:"address,attr"`       // required
	MCls         string    `xml:"m_cls,attr"`         // required
	DTm          string    `xml:"d_tm,attr"`          // required
	ReadStatus   string    `xml:"read_status,attr"`   // required
	CtT          string    `xml:"ct_t,attr"`          // required
	RetrTxtCs    string    `xml:"retr_txt_cs,attr"`   // required
	DRpt         uint64    `xml:"d_rpt,attr"`         // required
	MId          string    `xml:"m_id,attr"`          // required
	DateSent     uint64    `xml:"date_sent,attr"`     // required
	Seen         uint64    `xml:"seen,attr"`          // required
	MType        uint64    `xml:"m_type,attr"`        // required
	V            uint64    `xml:"v,attr"`             // required
	Exp          string    `xml:"exp,attr"`           // required
	Pri          uint64    `xml:"pri,attr"`           // required
	Rr           uint64    `xml:"rr,attr"`            // required
	RespTxt      string    `xml:"resp_txt,attr"`      // required
	RptA         string    `xml:"rpt_a,attr"`         // required
	Locked       uint64    `xml:"locked,attr"`        // required
	RetrTxt      string    `xml:"retr_txt,attr"`      // required
	RespSt       string    `xml:"resp_st,attr"`       // required
	MSize        string    `xml:"m_size,attr"`        // required
	ReadableDate *string   `xml:"readable_date,attr"` // optional
	ContactName  *string   `xml:"contact_name,attr"`  // optional
}

MMS represents a Multimedia Messaging Service record.

func NewMMSFromStatement added in v0.1.3

func NewMMSFromStatement(stmt *signal.SqlStatement) (*MMS, error)

type MMSPart

type MMSPart struct {
	XMLName xml.Name `xml:"part"`
	Seq     uint64   `xml:"seq,attr"`   // required
	Ct      uint64   `xml:"ct,attr"`    // required
	Name    string   `xml:"name,attr"`  // required
	ChSet   string   `xml:"chset,attr"` // required
	Cd      string   `xml:"cd,attr"`    // required
	Fn      string   `xml:"fn,attr"`    // required
	CID     string   `xml:"cid,attr"`   // required
	Cl      string   `xml:"cl,attr"`    // required
	CttS    string   `xml:"ctt_s,attr"` // required
	CttT    string   `xml:"ctt_t,attr"` // required
	Text    string   `xml:"text,attr"`  // required
	Data    *string  `xml:"data,attr"`  // optional
}

MMSPart holds a data blob for an MMS.

type MultiWriter

type MultiWriter struct {
	io.Writer
	// contains filtered or unexported fields
}

MultiWriter is a convenience wrapper around an io.Writer to allow multiple consecutive (safe) writes.

func NewMultiWriter

func NewMultiWriter(w io.Writer) *MultiWriter

NewMultiWriter returns a new instance of a multi writer.

func (*MultiWriter) Error

func (w *MultiWriter) Error() error

Error returns the final error message of the writer.

func (*MultiWriter) W

func (w *MultiWriter) W(p []byte)

W writes a slice of bytes to the underlying writer, or silently fails if there was a previous error.

type SMS

type SMS struct {
	XMLName       xml.Name `xml:"sms"`
	Protocol      *uint64  `xml:"protocol,attr"`       // optional
	Address       string   `xml:"address,attr"`        // required
	Date          string   `xml:"date,attr"`           // required
	Type          SMSType  `xml:"type,attr"`           // required
	Subject       *string  `xml:"subject,attr"`        // optional
	Body          string   `xml:"body,attr"`           // required
	TOA           *string  `xml:"toa,attr"`            // optional
	SCTOA         *string  `xml:"sc_toa,attr"`         // optional
	ServiceCenter *string  `xml:"service_center,attr"` // optional
	Read          uint64   `xml:"read,attr"`           // required
	Status        int64    `xml:"status,attr"`         // required
	Locked        *uint64  `xml:"locked,attr"`         // optional
	DateSent      *uint64  `xml:"date_sent,attr"`      // optional
	ReadableDate  *string  `xml:"readable_date,attr"`  // optional
	ContactName   *uint64  `xml:"contact_name,attr"`   // optional
}

SMS represents a Short Message Service record.

func NewSMSFromStatement added in v0.1.3

func NewSMSFromStatement(stmt *signal.SqlStatement) (*SMS, error)

NewSMSFromStatement constructs an XML SMS struct from a SQL statement.

type SMSType

type SMSType uint64

SMSType is an SMS type as defined by the XML backup spec.

const (
	SMSInvalid  SMSType = iota // 0
	SMSReceived                // 1
	SMSSent                    // 2
	SMSDraft                   // 3
	SMSOutbox                  // 4
	SMSFailed                  // 5
	SMSQueued                  // 6
)

SMS types

type SMSes

type SMSes struct {
	XMLName xml.Name `xml:"smses"`
	Count   int      `xml:"count,attr"`
	MMS     []MMS    `xml:"mms"`
	SMS     []SMS    `xml:"sms"`
}

SMSes holds a set of MMS or SMS records.

type SQLMMS

type SQLMMS struct {
	ID                   uint64
	ThreadID             *uint64
	DateSent             *uint64
	DateReceived         *uint64
	MessageBox           *uint64
	Read                 uint64 // default 0
	MID                  *string
	Sub                  *string
	SubCs                *uint64
	Body                 *string
	PartCount            *uint64
	CtT                  *string
	ContentLocation      *string
	Address              *string
	AddressDeviceID      *uint64
	Expiry               *uint64
	MCls                 *string
	MessageType          *uint64
	V                    *uint64
	MessageSize          *uint64
	Pri                  *uint64
	Rr                   *uint64
	RptA                 *uint64
	RespSt               *uint64
	Status               *uint64
	TransactionID        *string
	RetrSt               *uint64
	RetrTxt              *string
	RetrTxtCs            *uint64
	ReadStatus           *uint64
	CtCls                *uint64
	RespTxt              *string
	DTm                  *uint64
	DeliveryReceiptCount uint64  // default 0
	MismatchedIdentities *string // default null
	NetworkFailure       *string // default null
	DRpt                 *uint64
	SubscriptionID       uint64 // default -1
	ExpiresIn            uint64 // default 0
	ExpireStarted        uint64 // default 0
	Notified             uint64 // default 0
	ReadReceiptCount     uint64 // default 0
}

func ParametersToMMS added in v0.1.3

func ParametersToMMS(ps []*signal.SqlStatement_SqlParameter) *SQLMMS

ParametersToMMS converts a set of SQL parameters to a single MMS.

func StatementToMMS added in v0.1.3

func StatementToMMS(sql *signal.SqlStatement) *SQLMMS

StatementToMMS converts a of SQL statement to a single MMS.

type SQLPart added in v0.1.3

type SQLPart struct {
	RowID              uint64 // primary
	MmsID              *uint64
	Seq                uint64 // default 0
	ContentType        *string
	Name               *string
	Chset              *uint64
	ContentDisposition *string
	Fn                 *string
	Cid                *string
	ContentLocation    *string
	CttS               *uint64
	CttT               *string

	TransferState        *uint64
	Data                 *string
	Size                 *uint64
	FileName             *string
	Thumbnail            *string
	ThumbnailAspectRatio *float64
	UniqueID             uint64 // not null
	Digest               []byte
	FastPreflightID      *string
	VoiceNote            uint64 // default 0
	DataRandom           []byte
	ThumbnailRandom      []byte
	Quote                uint64 // default 0
	Width                uint64 // default 0
	Height               uint64 // default 0
	// contains filtered or unexported fields
}

func ParametersToPart added in v0.1.3

func ParametersToPart(ps []*signal.SqlStatement_SqlParameter) *SQLPart

ParametersToPart converts a set of SQL parameters to a single part.

func StatementToPart added in v0.1.3

func StatementToPart(sql *signal.SqlStatement) *SQLPart

StatementToPart converts a of SQL statement to a single part.

type SQLSMS

type SQLSMS struct {
	ID                   uint64
	ThreadID             *uint64
	Address              *string
	AddressDeviceID      uint64 // default 1
	Person               *uint64
	DateReceived         *uint64
	DateSent             *uint64
	Protocol             uint64 // effectively default 0
	Read                 uint64 // default 0
	Status               uint64 // default -1
	Type                 *uint64
	ReplyPathPresent     *uint64
	DeliveryReceiptCount uint64 // default 0
	Subject              *string
	Body                 *string
	MismatchedIdentities *string // default null
	ServiceCenter        *string
	SubscriptionID       uint64 // default -1
	ExpiresIn            uint64 // default 0
	ExpireStarted        uint64 // default 0
	Notified             uint64 // default 0
	ReadReceiptCount     uint64 // default 0
}

func ParametersToSMS

func ParametersToSMS(ps []*signal.SqlStatement_SqlParameter) *SQLSMS

ParametersToSMS converts a set of SQL parameters to a single SMS.

func StatementToSMS

func StatementToSMS(sql *signal.SqlStatement) *SQLSMS

StatementToSMS converts a of SQL statement to a single SMS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL