Como despejar memória física no Linux?

22

Como alguém criaria um despejo da memória física (RAM) no Linux?

Qual software, se houver, está disponível para esse fim?

Eu li que não se deve gravar em um disco local, mas sim enviar os dados pela rede. Alguém conhece as peculiaridades aqui? A Ethernet funcionaria para este propósito, ou existem comandos que minimizem a quantidade de cache antes de enviar para o disco?

O WinHex no Windows tem essa funcionalidade:

Estou procurando algo semelhante no Linux.

    
por Anonymous 18.07.2010 / 13:12

4 respostas

22

Aqui está uma página do eHow em Como despejar a memória do Linux

Linux provides two virtual devices for this purpose, '/dev/mem' and '/dev/kmem', though many distributions disable them by default for security reasons. '/dev/mem' is linked to the physical system memory, whereas '/dev/kmem' maps to the entire virtual memory space, including any swap. Both devices work as regular files, and can be used with dd or any other file manipulation tool.

Isso leva à página da ForensicsWiki em Ferramentas de imagens de memória com o Linux/Unix section ,

  1. dd On Unix systems, the program dd can be used to capture the contents of physical memory using a device file (e.g. /dev/mem and /dev/kmem). In recent Linux kernels, /dev/kmem is no longer available. In even more recent kernels, /dev/mem has additional restrictions. And in the most recent, /dev/mem is no longer available by default, either. Throughout the 2.6 kernel series the trend has been to reduce direct access to memory via pseudo-device files. See, for example, the message accompanying this patch: http://lwn.net/Articles/267427/. On Red Hat systems (and derived distros such as CentOS), the crash driver can be loaded to create a pseudo-device for memory access ("modprobe crash").
  2. Second Look This commercial memory analysis product has the ability to acquire memory from Linux systems, either locally or from a remote target via DMA or over the network. It comes with pre-compiled Physical Memory Access Driver (PMAD) modules for hundreds of kernels from the most commonly used Linux distributions.
  3. Idetect (Linux)
  4. fmem (Linux)
    fmem is kernel module, that creates device /dev/fmem, similar to /dev/mem but without limitations. This device (physical RAM) can be copied using dd or other tool. Works on 2.6 Linux kernels. Under GNU GPL.
  5. Goldfish
    Goldfish is a Mac OS X live forensic tool for use only by law enforcement. Its main purpose is to provide an easy to use interface to dump the system RAM of a target machine via a Firewire connection. It then automatically extracts the current user login password and any open AOL Instant Messenger conversation fragments that may be available. Law Enforcement may contact goldfish.ae for download information.

Veja também: Análise de memória do Linux .
Há também GDB comumente disponível na maioria dos Linuxes. E é sempre aconselhável evitar escrever sobre memória desconhecida - isso pode levar à corrupção do sistema.

    
por 18.07.2010 / 13:58
4

A Volatilidade parece estar funcionando bem e é compatível com Windows e Linux.

Do site deles:

Volatility supports memory dumps from all major 32- and 64-bit Windows versions and service packs including XP, 2003 Server, Vista, Server 2008, Server 2008 R2, and Seven. Whether your memory dump is in raw format, a Microsoft crash dump, hibernation file, or virtual machine snapshot, Volatility is able to work with it. We also now support Linux memory dumps in raw or LiME format and include 35+ plugins for analyzing 32- and 64-bit Linux kernels from 2.6.11 - 3.5.x and distributions such as Debian, Ubuntu, OpenSuSE, Fedora, CentOS, and Mandrake. We support 38 versions of Mac OSX memory dumps from 10.5 to 10.8.3 Mountain Lion, both 32- and 64-bit. Android phones with ARM processors are also supported.

    
por 21.11.2013 / 23:56
3

O Second Look é uma maneira boa e fácil de despejar memória no Linux: link .

Existe também um módulo de kernel recentemente lançado que você poderia experimentar chamado LiME: link

    
por 01.05.2012 / 21:09
0

Como confirmação, consegui descarregar a memória da VM do CentOS 7.x usando este método:

$ head /dev/mem | hexdump -C
00000000  53 ff 00 f0 53 ff 00 f0  53 ff 00 f0 53 ff 00 f0  |S...S...S...S...|
00000010  53 ff 00 f0 53 ff 00 f0  cc e9 00 f0 53 ff 00 f0  |S...S.......S...|
00000020  a5 fe 00 f0 87 e9 00 f0  53 ff 00 f0 46 e7 00 f0  |........S...F...|
00000030  46 e7 00 f0 46 e7 00 f0  57 ef 00 f0 53 ff 00 f0  |F...F...W...S...|
00000040  22 00 00 c0 4d f8 00 f0  41 f8 00 f0 fe e3 00 f0  |"...M...A.......|
00000050  39 e7 00 f0 59 f8 00 f0  2e e8 00 f0 d4 ef 00 f0  |9...Y...........|
00000060  a4 f0 00 f0 f2 e6 00 f0  6e fe 00 f0 53 ff 00 f0  |........n...S...|
00000070  ed ef 00 f0 53 ff 00 f0  c7 ef 00 f0 ed 57 00 c0  |....S........W..|
00000080  53 ff 00 f0 53 ff 00 f0  53 ff 00 f0 53 ff 00 f0  |S...S...S...S...|
*
00000100  59 ec 00 f0 3d 00 c0 9f  53 ff 00 f0 ed 69 00 c0  |Y...=...S....i..|
00000110  53 ff 00 f0 53 ff 00 f0  53 ff 00 f0 53 ff 00 f0  |S...S...S...S...|
*
00000180  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000afea0  00 00 00 00 00 00 00 00  aa aa aa 00 aa aa aa 00  |................|
000afeb0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
...
...
000b0000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
000c0000  55 aa 40 e9 62 0a 00 00  00 00 00 00 00 00 00 00  |[email protected]...........|
000c0010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 49 42  |..............IB|
000c0020  4d 00 9c 80 fc 0f 75 06  e8 4f 01 e9 bc 00 80 fc  |M.....u..O......|

Dado este 55aah ocorrer na faixa de c0000h-effffh, é provável que o cabeçalho de expansão do PNP:

Referência: Especificação de inicialização do BIOS

3.3 Devices with PnP Expansion Headers

All IPL devices with option ROMs must contain a valid option ROM header that resides between system memory addresses C0000h and EFFFFh on a 2k boundary and begins with 55AAh. A Device’s booting can only be controlled if it has a PnP Expansion Header. The Expansion Header, whose address resides within the standard option ROM header at offset +1Ah, contains important information used to configure the device. It also contains pointers to code in the device’s option ROM (BCV or BEV) that the BIOS will call to boot from the device. See Appendix A for the structure of the PnP Expansion Header. There are two ways an IPL device with a PnP Expansion Header can be booted. It must contain a BCV or a BEV.

Referências

por 10.08.2018 / 02:19