MCPcopy Create free account
hub / github.com/MagnetForensics/dumpit-linux / new

Method new

src/main.rs:155–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153
154impl DumpItForLinux {
155 fn new() -> Result<Self> {
156
157 let mem_ranges = Vec::new();
158
159 if !Uid::effective().is_root() {
160 return Err(Error::NixError("You must run this executable with root permissions.".to_string()));
161 }
162
163 let kcore = fs::File::open(format!("{}kcore", PROC_DIR))?;
164 let iomem_ranges = DumpItForLinux::get_memory_ranges()?;
165 let _kallsyms = fs::File::open(format!("{}kallsyms", PROC_DIR))?;
166
167 Ok(DumpItForLinux {
168 iomem_ranges,
169 mem_ranges,
170 // VMCOREINFO
171 vmci_size_va: None,
172 vmci_data_va: None,
173 vmcoreinfo: None,
174 // kcore
175 kcore,
176 out_header: None
177 })
178 }
179
180 // Initialize the data we need prior writing a new memory dump.
181 fn init(&mut self) -> Result<()> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected