Python Forum
hardest week yet: some guidence please
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
hardest week yet: some guidence please
#18
I am on step 4 now.
I think I am doing pretty good but I have a couple issues. I am uncertain if it is actually removing dupes but keeping count of number of times a user name attempts to log in.

My other issue is my print string is wrong and I cant figure out how to make the first {} my count and second {} the user name. I am certain it is in my format

intruder_log = {}

with open("auth.log.1") as auth_log:

    for line in auth_log:
        if "Failed password" in line:
            start = line.find("invalid user")
            end = line.find(" from")
            name = line[start + 13:end]
        
            if name in intruder_log:
                intruder_log[name] += 1
            else:
                intruder_log[name] = 1

            for key in intruder_log:
                print("Attackers tried {} times to log in as {}".format, key["name"])
Reply


Messages In This Thread
RE: hardest week yet: some guidence please - by raymond2688 - Aug-18-2019, 06:12 PM
slice help - by raymond2688 - Aug-17-2019, 12:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Calculating the number of day of the week RbaPhoenix 3 2,600 Mar-27-2020, 09:23 PM
Last Post: Larz60+
  week 1 python help - string formatting ? raymond2688 20 8,147 Jul-09-2019, 08:10 PM
Last Post: snippsat
  Trying to get the week number from a string of numbers fad3r 2 3,301 Apr-15-2018, 06:52 PM
Last Post: ljmetzger

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020