LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-25-2006, 02:59 PM   #1
emulater
LQ Newbie
 
Registered: Nov 2006
Posts: 1

Rep: Reputation: 0
Question PHP or perl script for lastb


I want to post top 10 or 20 Ip addresses that have failed at loginging into ssh on my webpage. Sort of like a "today's top 10 losers". The script will need to show anyone who has tried to login and failed greater then 10 times. I know the script will take a while to run therefore take a long time for the page to load, so it has to be fast. I dont need to load the whole lastb file only todays attempts..possible?
 
Old 11-26-2006, 04:43 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Moved: This thread is more suitable in the Programming forum and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 11-28-2006, 12:18 AM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Sure it's possible. How do you process logins? Just stick the login attempt into a mysql database and every time they try increment a counter in the db. To construct your list, sort the db by number of attempts within a specific date.
 
Old 11-28-2006, 04:08 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
I don't know the format of your file, something like

Code:
grep $(date +o format) login_file | grep failed | 
      cut -f(required fields) | 
      sort | uniq -c | sort -n | head -10
would do it
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for a Perl/php script to change IP/NM/GW/DNS1/DNS2 ... ccadic Linux - Networking 2 05-18-2011 03:06 PM
CMS Perl/CGI/PHP script ANU Programming 2 10-25-2006 10:11 AM
LXer: Title: PHP/MySQL Classifieds Script AddAsset1.php Script Insertion LXer Syndicated Linux News 0 07-02-2006 06:21 PM
call perl cgi script from php j-ray Programming 2 01-14-2005 08:23 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration