Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7511621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:36:20+00:00 2026-05-29T23:36:20+00:00

I have developed a script to calculate how many times some one has tried

  • 0

I have developed a script to calculate how many times some one has tried to login using a root account. I am using the resources from a separate document which contains all the login attempts.

 myfile = open ('/home/Parker4001/Desktop/loginAttempts','r')

 counter_root = 0

for line in myfile.readline():

     list_of_line1 = line.split(' ')

     if 'Failed password for root' in line:

            counter_root = counter_root +1

     print 'Attempt to login with root = ' , counter_root

This is the code i have so far which gives me the following output

  Attempt to login with root =  0
  Attempt to login with root =  0
  Attempt to login with root =  0
  Attempt to login with root =  0
  Attempt to login with root =  0
  Attempt to login with root =  0

The problem i am having is that i want a grand total rather than multiple lines + the counter_root doesn’t seem to be adding up the attempts to log in any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:36:22+00:00Added an answer on May 29, 2026 at 11:36 pm
    • Move the print statement back one level of indentation.
    • Also change

      for line in myfile.readline():
      

      to

      for line in myfile:
      

      since myfile.readline() gives you just the first line of the file,
      and iterates over the bytes in the line. In contrast, for
      line in myfile
      iterates over the lines of the file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I -with some stackoverflow users help- have developed this tooltip script using Jquery and
I have a PHP-script originally developed on Ubuntu, which now has to run on
I have developed a dragable div with an image inside using jquery. The script
I have developed a script for checking that user has selected a valid month
I have developed an application that has a list of items in one frame;
I have some code written in PHP, but I have also developed a script
I have developed application in Netbeans IDE 6.9 Using javafx Script based Application. i
I have developed a script that receives json data from a php script using
I have developed a Powershell script that needs to be run automatically daily. This
I have a script developed by previous employee and I need to identify all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.