Sponsored Content
Top Forums Shell Programming and Scripting How to add static lines to short file? Post 302356120 by kevinmccallum on Thursday 24th of September 2009 02:23:04 PM
Old 09-24-2009
Thanks for quick reply. But that sed code is giving me this error:

" sed: -e expression #1, char 11: unknown option to `s' "

And actually I already have variables for the two entries that I want to append to each line ('$time' and '$valid'). Does that make it any simpler...?
 

10 More Discussions You Might Find Interesting

1. Solaris

cdrom, short file name

Hello on my cdrom, the length of the file names are 8 characters, not > 8. On a linux with the same cd, there are > 8 characters. What's wrong. Tanks Urs (3 Replies)
Discussion started by: MuellerUrs
3 Replies

2. Solaris

Add Static Routes to new physical address

Hi, I need help to add new route: 10.252.0.138, GW 10.252.0.129 to e1000g1 and 10.252.0.10, GW 10.252.0.1 to e1000g2 tnx (4 Replies)
Discussion started by: mehrdad68
4 Replies

3. Red Hat

permanently add static route

I have a machine with an interface that has two different addresses on CentOS 5 eth0: 10.20.21.77 eth0:1 141.218.1.221 If I issue this command I get the result I'm looking for. /sbin/route add -net 141.218.1.0 netmask 255.255.255.0 gw 10.20.21.77 ip route show dev eth0 141.218.1.0/24... (1 Reply)
Discussion started by: beaker457
1 Replies

4. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

5. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

6. Shell Programming and Scripting

Extract some lines from one file and add those lines to current file

hi, i have two files. file1.sh echo "unix" echo "linux" file2.sh echo "unix linux forums" now the output i need is $./file2.sh unix linux forums (3 Replies)
Discussion started by: snreddy_gopu
3 Replies

7. Shell Programming and Scripting

Short program to select lines from a file based on a second file

Hello, I use UBUNTU 12.04. I want to write a short program using awk to select some lines in a file based on a second file. My first file has this format with about 400,000 lines and 47 fields: SNP1 1 12.1 SNP2 1 13.2 SNP3 1 45.2 SNP4 1 23.4 My second file has this format: SNP2 SNP3... (1 Reply)
Discussion started by: Homa
1 Replies

8. Shell Programming and Scripting

Searching a large file for short tandem repeats

Hello, I am searching large (~25gb) DNA sequence data in fasta short read format: >ReadName ACGTACGTACGT... for short tandem repeats, meaning instances of any 2-6 character based run that are repeated in tandem a number of times given as an input variable. Seems like a reasonably simple... (3 Replies)
Discussion started by: ljk
3 Replies

9. UNIX for Dummies Questions & Answers

Add strings from one file at the end of specific lines in text file

Hello All, this is my first post so I don't know if I am doing this right. I would like to append entries from a series of strings (contained in a text file) consecutively at the end of specifically labeled lines in another file. As an example: - the file that contains the values to be... (3 Replies)
Discussion started by: gus74
3 Replies

10. Shell Programming and Scripting

Add static text in perl

I am trying to add a static value to a field in perl. Basically, what happens is a file is created and "null" results in the fields then after some manipulation a field (AB) is split and the text from that is parsed into the desired fields. All that works great what doesn't is the line in bold... (20 Replies)
Discussion started by: cmccabe
20 Replies
QSFILTER2(1)							qsfilter2 man page						      QSFILTER2(1)

NAME
qsfilter2 - Utility to generate mod_qos request line rules out from existing access/audit log data. SYNOPSIS
qsfilter2 -i <path> [-c <path>] [-d <num>] [-h] [-b <num>] [-p|-s|-m|-o] [-l <len>] [-n] [-e] [-u 'uni'] [-k <prefix>] [-t] [-f <path>] [-v 0|1|2] DESCRIPTION
mod_qos implements a request filter which validates each request line. The module supports both, negative and positive security model. The QS_Deny* directives are used to specify request line patterns which are not allowed to access the server (negative security model / black- list). These rules are used to restrict access to certain resources which should not be available to users or to protect the server from malicious patterns. The QS_Permit* rules implement a positive security model (whitelist). These directives are used to define allowed request line patterns. Request which do not match any of thses patterns are not allowed to access the server. qsfilter2 is an audit log analyzer used to generate filter rules (perl compatible regular expressions) which may be used by mod_qos to deny access for suspect requests (QS_PermitUri rules). It parses existing audit log files in order to generate request patterns covering all allowed requests. OPTIONS
-i <path> Input file containing request URIs. The URIs for this file have to be extracted from the servers access logs. Each line of the input file contains a request URI consiting of a path and and query. Example: /aaa/index.do /aaa/edit?image=1.jpg /aaa/image/1.jpg /aaa/view?page=1 /aaa/edit?document=1 These access log data must include current request URIs but also request lines from previous rule generation steps. It must also include request lines which cover manually generated rules. -c <path> mod_qos configuration file defining QS_DenyRequestLine and QS_PermitUri directives. qsfilter2 generates rules from access log data automatically. Manually generated rules (QS_PermitUri) may be provided from this file. Note: each manual rule must be represented by a request URI in the input data (-i) in order to make sure not to be deleted by the rule optimisation algorithm. QS_Deny* rules from this file are used to filter request lines which should not be used for whitelist rule generation. Example: # manually defined whitelist rule: QS_PermitUri +view deny "^[/a-zA-Z0-9]+/view?(page=[0-9]+)?$" # filter unwanted request line patterns: QS_DenyRequestLine +printable deny ".*[x00-x19].*" -d <num> Depth (sub locations) of the path string which is defined as a literal string. Default is 1. -h Always use a string representing the handler name in the path even the url does not have a query. See also -d option. -b <num> Replaces url pattern by the regular expression when detecting a base64/hex encoded string. Detecting sensibility is defined by a numeric value. You should use values higher than 5 (default) or 0 to disable this function. -p Repesents query by pcre only (no literal strings). -s Uses one single pcre for the whole query string. -m Uses one pcre for multipe query values (recommended mode). -o Does not care the order of query parameters. -l <len> Outsizes the query length by the defined length ({0,size+len}), default is 10. -n Disables redundant rules elimination. -e Exit on error. -u 'uni' Enables additional decoding methods. Use the same settings as you have used for the QS_Decoding directive. -p Repesents query by pcre only (no literal strings). Determines the worst case performance for the generated whitelist by applying each rule for each request line (output is real time filter duration per request line in milliseconds). -k <prefix> Prefix used to generate rule identifiers (QSF by default). -t Calculates the maximal latency per request (worst case) using the generated rules. -f <path> Filters the input by the provided path (prefix) only processing matching lines. -v <level> Verbose mode. (0=silent, 1=rule source, 2=detailed). Default is 1. Don't use rules you haven't checked the request data used to gen- erate it! Level 1 is highly recommended (as long as you don't have created the log data using your own web crawler). OUTPUT
The output of qsfilter2 is written to stdout. The output contains the generated QS_PermitUri directives but also information about the source which has been used to generate these rules. It is very important to check the validity of each request line which has been used to calculate the QS_PermitUri rules. Each request line which has been used to generate a new rule is shown in the output prefixed by "ADD line <line number>:". These request lines should be stored and reused at any later rule generation (add them to the URI input file). The subse- quent line shows the generated rule. At the end of data processing a list of all generated QS_PermitUri rules is shown. These directives may be used withn the configuration file used by mod_qos. EXAMPLE
./qsfilter2 -i loc.txt -c httpd.conf -m -e ... # ADD line 1: /aaa/index.do # 003 ^(/[a-zA-Z0-9-_]+)+[/]?.?[a-zA-Z]{0,4}$ # ADD line 3: /aaa/view?page=1 # --- ^[/a-zA-Z0-9]+/view?(page=[0-9]+)?$ # ADD line 4: /aaa/edit?document=1 # 004 ^[/a-zA-Z]+/edit?((document)(=[0-9]*)*[&]?)*$ # ADD line 5: /aaa/edit?image=1.jpg # 005 ^[/a-zA-Z]+/edit?((image)(=[0-9.a-zA-Z]*)*[&]?)*$ ... QS_PermitUri +QSF001 deny "^[/a-zA-Z]+/edit?((document|image)(=[0-9.a-zA-Z]*)*[&]?)*$" QS_PermitUri +QSF002 deny "^[/a-zA-Z0-9]+/view?(page=[0-9]+)?$" QS_PermitUri +QSF003 deny "^(/[a-zA-Z0-9-_]+)+[/]?.?[a-zA-Z]{0,4}$" SEE ALSO
qsexec(1), qsgeo(1), qsgrep(1), qslog(1), qslogger(1), qspng(1), qsrotate(1), qssign(1), qstail(1) AUTHOR
Pascal Buchbinder, http://opensource.adnovum.ch/mod_qos/ mod_qos utilities 10.8 June 2012 QSFILTER2(1)
All times are GMT -4. The time now is 01:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy