• Filtering Text with grep
  • L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




    Download 7,3 Mb.
    Pdf ko'rish
    bet43/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   39   40   41   42   43   44   45   46   ...   125
    Bog'liq
    linuxbasicsforhackers

    tail -20 /etc/snort/snort.conf
    #include $SO_RULE_PATH/chat.rules
    #include $SO_RULE_PATH/dos.rules
    #include $SO_RULE_PATH/exploit.rules
    --
    snip
    --
    #Event thresholding or suppression commands. See theshold.conf
    Listing 2-3: Displaying the last 20 lines of 
    snort.conf
     in the terminal window
    Now we can view nearly all the 
    include
    lines of the rules files on one 
    screen.


    22
    Chapter 2
    Numbering the Lines
    Sometimes—especially with very long files—we may want the file to display 
    line numbers. Since snort.conf has more than 600 lines, line numbers would 
    be useful here. This makes it easier to reference changes and come back to 
    the same place within the file.
    To display a file with line numbers, we use the 
    nl
    (number lines) com-
    mand. Simply enter the command shown in Listing 2-4.
    kali >
    nl /etc/snort/snort.conf
    612 #################################################################
    613 #dynamic library rules
    614 #include $SO_RULE_PATH/bad-traffic.rules
    615 #include $SO_RULE_PATH/chat.rules
    --
    snip
    --
    630 #include $SO_RULE_PATH/web-iis.rules
    631 #include $SO_RULE_PATH/web-misc.rules
    632 #Event thresholding or suppression commands. See threshold.conf
    633 include threshold.conf
    Listing 2-4: Displaying line numbers in terminal output
    Each line now has a number, making referencing much easier. Note that 
    this command skips the numbering for the blank lines.
    Filtering Text with grep
    The command 
    grep
    is probably the most widely used text manipulation com-
    mand. It lets you filter the content of a file for display. If, for instance, you 
    want to see all lines that include the word output in your snort.conf file, you 
    could use 
    cat
    and ask it to display only those lines (see Listing 2-5).
    kali >

    Download 7,3 Mb.
    1   ...   39   40   41   42   43   44   45   46   ...   125




    Download 7,3 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

    Download 7,3 Mb.
    Pdf ko'rish