blocking script help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting blocking script help
# 1  
Old 06-01-2010
blocking script help

Code:
sed -n '/robots.txt/!{s/\([0-9]\{1,\}\.[0-9]*\.[0-9]*\.[0-9]*\).*\/\(.*\.txt\).*/\1 \2/p;}'  myaapache.log

Above command will search all txt except robots.txt from apache logs and show like

Code:
94.136.63.119 idsuper.txt
174.121.67.233 fx29id1.txt


I want to block that ip address automatically, i need script that will check all *.txts from apache log but ignore robots.txt whenever such hit come that will pick ip address from log and block ip address like

Code:
iptables -I INPUT -s ip-address -j DROP

script will run after every two minute and check only update apache log not complete apache log file.

Apache have a date format like this -> 01/Jun/2010:21:27:13 +0200

please suggest pointers.

Last edited by Scott; 06-01-2010 at 06:28 PM.. Reason: Code tags
# 2  
Old 06-02-2010
Ever heard of fail2ban ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Which are blocking and non-blocking api's in sockets in C ?

among the below socket programming api's, please let me know which are blocking and non-blocking. socket accept bind listen write read close (2 Replies)
Discussion started by: VSSajjan
2 Replies

2. IP Networking

ping blocking

Hi I am starting to practice nmap for my own education. Now I created two host in virtual box. Bot are scientific linux, one in installed as web server and the other as developing station. I tried to run nmap on so I did nmap on their IP address, I got an answer that ip is down or that... (8 Replies)
Discussion started by: programAngel
8 Replies

3. Shell Programming and Scripting

Script for Removing Lines from File / Blocking internet connection

Hey all. I am trying to write some scripts and need some assistance. One: I already have a script that appends lines to a file. I need a script that will remove those lines from that file, and have no idea how to go about doing this. Just need the command (if any) that can remove lines. ... (2 Replies)
Discussion started by: Dysruption
2 Replies

4. Programming

non blocking connect

OS : solaris 10 X86 I created stream socket, tries to connect to port 7 on the remote machine. After doing the non blocking connect call I did select with time out value is 3 secs. I am always getting timed out though I am writing prior to select. code: x=fcntl(S,F_GETFL,0);... (1 Reply)
Discussion started by: satish@123
1 Replies

5. UNIX for Advanced & Expert Users

ps blocking

Hi Folks I have been debugging a script that is called every thirty seconds. Basically it is doing a ps, well two actually, one to file (read by the getline below) and the other into a pipe. The one into the pipe is: - V_SYSVPS=/usr/sysv/bin/ps $V_SYSVPS -p$PIDLIST -o$PSARGS... (0 Replies)
Discussion started by: steadyonabix
0 Replies

6. Shell Programming and Scripting

Non-blocking pipe

Hello, Would this be an acceptable way of creating a non-blocking pipe. Basically I want to create kind of a server client arch. This code would be in the server, and I don't want to have to wait for clients to read before moving on to the next client. One problem I can see is if... (4 Replies)
Discussion started by: cdlaforc
4 Replies

7. Shell Programming and Scripting

Reading from blocking fifo pipe in shell script

Hi!! I have a problem reading from a fifo pipe in shell script. The idea is simple, I have a C program with two pipe files: An input pipe I use to send commands in shell script to the C program (echo "command" > input.pipe) An output pipe that I read the result of the command also in... (4 Replies)
Discussion started by: victorin
4 Replies

8. IP Networking

blocking DHCP

I've got a legit DHCP server on my network. I've got a 3550 as my VTP server providing 4 vlans to 4 2950 switches. If somebody were to plug into one of those vlans with a DHCP server configured then it would throw off my whole network. How could i block the DHCP server that could plug into the... (2 Replies)
Discussion started by: byblyk
2 Replies

9. IP Networking

School Blocking

I'm in highschool. They blocked my favorite site. How do I disable websense without getting caught on that particular webpage? Is it even possible? *twitch* I would also like to get as much UNIX for beginners information, so if someone might point me in the right direction so I don't have to read... (1 Reply)
Discussion started by: Satine
1 Replies

10. UNIX for Dummies Questions & Answers

blocking domains

Dear All , Kindly note I have sun solaries 7 . I want to block a domain who keep sending emails to my domain and users . thanks (1 Reply)
Discussion started by: tamemi
1 Replies
Login or Register to Ask a Question