Do you want to repel users or ip- addresses? What if any of those users logs in from a different node?
Hello,
I solved this issue. I wanted to block a list of users. At first, the script kicks their original ip. When they changed their ip, cron will detect this and ban them once again.
I defined and limited each user's login date and hour and minute. database.txt (##year_month_day_hour_minute)
If he is not allowed to login anymore, the script sends his username to filtered.txt file and then mentioned above scenario starts.
filter_accts.pl
When you run below code:
Output will be filtered.txt:
to remove ## signs, i created filtered2.txt:
Looks up sophie.bextor's ip in syslog file:
to remove unneccessary lines:
Then to be able to extract list of ip addresses:
The last step is add prefix ( iptables -A INPUT -s ) to the beginning of each line and add -j DROP to the end of each line with below script.
replace.sh
when you open fail2ban_ip file, it will show something like this:
then, chmod 755 & ./fail2ban_ip under terminal
I will get those codes together into a script and set cronjob now .
As the problem has been sorted out by means of your valuable support, I would like to thank you all.
I have been trying to use the find command to grab the latest file in a directory and move it to another area. I can't seem to get only that file, I end up getting everything for the day.
Any ideas?
Thank you (1 Reply)
Dear All,
I have a file in which there are 54 fields, i want to grab the all the lines and send to a new file where filed18 has lenght greater than 14. How can i do it without if condition and faster way:
currently i am reading file line by line and comparing the length
read fileLine... (9 Replies)
Hi,
I need a way to grab the total combines since inception, total pages read from webalizer on my centos server or any other location (as long as since inception) and display the result live on my website
So with each visit it would be increasing, or perhaps live (ajax) not sure
But can... (0 Replies)
Hey guys, I need a command that grabs only this part of the .txt file (that is attached), and outputs it to another .txt file with only these contents below. Thanks in advanced brothers:
Disk: Local Disk (C:), NTFS
Disk Defragmentation Summary
Disk Size 230.85 GB
Free Space Size... (4 Replies)
I am a newbie and what I have is a captured file of content. I want to be able to grab 2 pieces of data, multiple times and print them to the screen.
DataFile
owner: locke
user: fun
data size: 60
location: Anaheim
owner: david
user: work
data size: 80
location: Orange
my script... (2 Replies)
Hello All
I have a file with this type of records:
=LDR 01157nas a22003011a 4500
=001 vtls000000013
=003 VRT
=005 20111020150800.0
=008 100128c19699999sp\a|||||\||||0\\\||spa|
=037 \\$a1327$i090$j090$k03
=039 ... (14 Replies)
Hello,
What I would like to do is a shell script which will read a database file, then it will compare the current date/hour/minute in each line existing in the database file.
Today is 20140305 (year_month_day) & assume that the time is 15:11 at the moment.
under /var/log/
database.txt
... (5 Replies)
Sorry for the weird title but i have the following problem.
We have several files which have between 10000 and about 500000 lines in them. From these files we want to remove lines which contain a pattern which is located in another file (around 20000 lines, all EAN codes). We also want to get... (28 Replies)