Difference between revisions of "SNORT: packet logger mode"

From OnnoWiki
Jump to navigation Jump to search
Line 8: Line 8:
 
Ketika Snort berjalan dalam mode ini, ia mengumpulkan setiap paket yang dilihatnya dan menempatkannya dalam hirarki direktori berdasarkan alamat IP dari salah satu host di datagram
 
Ketika Snort berjalan dalam mode ini, ia mengumpulkan setiap paket yang dilihatnya dan menempatkannya dalam hirarki direktori berdasarkan alamat IP dari salah satu host di datagram
  
If you just specify a plain -l switch, you may notice that Snort sometimes uses the address of the remote computer as the directory in which it places packets and sometimes it uses the local host address. In order to log relative to the home network, you need to tell Snort which network is the home network:
+
Jika anda hanya menggunakan switch -l saja, akan melihat snort kadang kala menggunakan alamat remote komputer sebagai directory di mana ia menempatkan paket dan kadang-kadang menggunakan alamat host lokal. Agar menyimpan log relatif ke jaringan lokal, anda perlu memberitahukan snort mana yang home network / jaringan lokal:
  
    ./snort -dev -l ./log -h 192.168.1.0/24
+
snort -dev -l /var/log/snort -h 192.168.0.0/24
  
 
This rule tells Snort that you want to print out the data link and TCP/IP headers as well as application data into the directory ./log, and you want to log the packets relative to the 192.168.1.0 class C network. All incoming packets will be recorded into subdirectories of the log directory, with the directory names being based on the address of the remote (non-192.168.1) host.
 
This rule tells Snort that you want to print out the data link and TCP/IP headers as well as application data into the directory ./log, and you want to log the packets relative to the 192.168.1.0 class C network. All incoming packets will be recorded into subdirectories of the log directory, with the directory names being based on the address of the remote (non-192.168.1) host.

Revision as of 02:50, 16 March 2017

SUmber: http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node5.html

Jika kita ingin merekam paket ke disk, kita perlu memberitahukan directory untuk menyimpan paket, maka snort akan langsugn switch ke packet logger mode,

snort -dev -l ./log
snort -dev -l /var/log/snort

Ketika Snort berjalan dalam mode ini, ia mengumpulkan setiap paket yang dilihatnya dan menempatkannya dalam hirarki direktori berdasarkan alamat IP dari salah satu host di datagram

Jika anda hanya menggunakan switch -l saja, akan melihat snort kadang kala menggunakan alamat remote komputer sebagai directory di mana ia menempatkan paket dan kadang-kadang menggunakan alamat host lokal. Agar menyimpan log relatif ke jaringan lokal, anda perlu memberitahukan snort mana yang home network / jaringan lokal:

snort -dev -l /var/log/snort -h 192.168.0.0/24

This rule tells Snort that you want to print out the data link and TCP/IP headers as well as application data into the directory ./log, and you want to log the packets relative to the 192.168.1.0 class C network. All incoming packets will be recorded into subdirectories of the log directory, with the directory names being based on the address of the remote (non-192.168.1) host.

Note:

Note that if both the source and destination hosts are on the home network, they are logged to a directory with a name based on the higher of the two port numbers or, in the case of a tie, the source address.

If you're on a high speed network or you want to log the packets into a more compact form for later analysis, you should consider logging in binary mode. Binary mode logs the packets in tcpdump format to a single binary file in the logging directory:

   ./snort -l ./log -b

Note the command line changes here. We don't need to specify a home network any longer because binary mode logs everything into a single file, which eliminates the need to tell it how to format the output directory structure. Additionally, you don't need to run in verbose mode or specify the -d or -e switches because in binary mode the entire packet is logged, not just sections of it. All you really need to do to place Snort into logger mode is to specify a logging directory at the command line using the -l switch--the -b binary logging switch merely provides a modifier that tells Snort to log the packets in something other than the default output format of plain ASCII text.

Once the packets have been logged to the binary file, you can read the packets back out of the file with any sniffer that supports the tcpdump binary format (such as tcpdump or Ethereal). Snort can also read the packets back by using the -r switch, which puts it into playback mode. Packets from any tcpdump formatted file can be processed through Snort in any of its run modes. For example, if you wanted to run a binary log file through Snort in sniffer mode to dump the packets to the screen, you can try something like this:

   ./snort -dv -r packet.log

You can manipulate the data in the file in a number of ways through Snort's packet logging and intrusion detection modes, as well as with the BPF interface that's available from the command line. For example, if you only wanted to see the ICMP packets from the log file, simply specify a BPF filter at the command line and Snort will only see the ICMP packets in the file:

   ./snort -dvr packet.log icmp

For more info on how to use the BPF interface, read the Snort and tcpdump man pages.


Pranala Menarik