-
Notifications
You must be signed in to change notification settings - Fork 22
/
types.go
70 lines (60 loc) · 1.34 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package sploit
import (
"fmt"
)
// FileFormat represents the type of file under analysis
type FileFormat uint16
// Architecture represents processor architecture
type Architecture uint16
// Endian is a integer type that represents the byte order of a binary
type Endian int
const (
// PEFile represents Microsoft PE file format
PEFile = iota
// ELFFile represents Unix ELF file format
ELFFile
// UnknownFile indicates that the file format is unsupported
UnknownFile
)
const (
// ArchX8664 indicates Intel x86-64 ISA
ArchX8664 = iota
// ArchI386 - Intel x86
ArchI386
// ArchARM - ARM (32-bit)
ArchARM
// ArchAARCH64 - ARM (64-bit)
ArchAARCH64
// ArchPPC - PowerPC
ArchPPC
// ArchMIPS - MIPS
ArchMIPS
// ArchIA64 - Intel Itanium
ArchIA64
)
// Processor is a struct that represents a binary's machine type
type Processor struct {
Architecture Architecture
Endian Endian
}
const (
// LittleEndian - little endian byte order
LittleEndian Endian = iota
// BigEndian - big endian byte order
BigEndian Endian = iota
)
func (e Endian) String() string {
switch e {
case LittleEndian:
return "little"
case BigEndian:
return "big"
default:
return fmt.Sprintf("%d", int(e))
}
}
// Mitigations is used to store information on exploit mitigations detected while loading the binary
type Mitigations struct {
Canary bool
NX bool
}