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
#[derive(Clone, Debug)]
pub struct Gadget {
bytes: Vec<u8>,
instructions: Vec<String>,
offset: u64,
}
impl Gadget {
pub fn new(
offset: u64,
instructions: Vec<String>,
bytes: Vec<u8>
) -> Gadget {
Gadget {
bytes: bytes,
instructions: instructions,
offset: offset,
}
}
pub fn bytes(&self) -> &[u8] {
&self.bytes
}
pub fn instructions(&self) -> &[String] {
&self.instructions
}
pub fn len(&self) -> usize {
self.bytes.len()
}
pub fn offset(&self) -> u64 {
self.offset
}
pub fn set_bytes(&mut self, bytes: Vec<u8>) {
self.bytes = bytes;
}
pub fn set_instructions(&mut self, instructions: Vec<String>) {
self.instructions = instructions;
}
pub fn set_offset(&mut self, offset: u64) {
self.offset = offset;
}
}