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

  • SEARCH
  • Home
  • 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 9008611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:58:54+00:00 2026-06-16T01:58:54+00:00

I wrote a python(3.2) script to ban ips on certain events from the event

  • 0

I wrote a python(3.2) script to ban ips on certain events from the event logs on a Windows 2008 server and I was trying to test if it would ban ips from sql brute forcing attempts properly. Unfortunately so far it’s not getting to that part of the code because the event ID it is looking for never appears (although it should as it’s in the log file).

def run_script_application_log():
    eventIds = [18456] #look for these events to process for possible ip bans 18456 = failed login
    server = 'localhost' # name of the target computer to get event logs from
    logtype = 'Application' # 'Application' or 'Security' etc...
    hand = win32evtlog.OpenEventLog(server,logtype)
    ipsToBan = look_for_ips_to_ban(hand,flags,eventIds)

def look_for_ips_to_ban(hand, flag, eventIds):
    ...some code....
    events=1
    while events:
        events=win32evtlog.ReadEventLog(hand,flag,0)
        for event in events:
            the_time=event.TimeGenerated.Format()
            seconds=date2sec(the_time)
            #if seconds < begin_sec - time_in_seconds: break
            if event.EventID in eventIds:

I inserted a simple print statement to see what was going on with the event.EventID and the numbers it was obtaining were odd to say the least. The event log goes up to 33090 but the vast majority of IDs being returned are similar to these:
1073750020
1073754112
-1073741823
-2147481364

I have 0 idea what’s going on. It works fine with the security log, but application log seems to be a no go.

I went through some data and it all seems to report correctly except for the eventID.

For instance this record from the log is all correct except it shows the event ID as 1073742726 instead of 18456.

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="MSSQLSERVER" /> 
<EventID Qualifiers="49152">18456</EventID> 
<Level>0</Level> 
<Task>4</Task> 
<Keywords>0x90000000000000</Keywords> 
<TimeCreated SystemTime="2012-12-08T18:01:32.000000000Z" /> 
<EventRecordID>4532</EventRecordID> 
<Channel>Application</Channel> 
<Computer>windowsmachine</Computer> 
<Security /> 
</System>
<EventData>
<Data>username</Data> 
<Data>Reason: Password did not match that for the login provided.</Data> 
<Data>[CLIENT: <local machine>]</Data
<Binary>184800000E0000000A000000570049004E004D00430041005000460058000000070000006D00610073007400650072000000</Binary> 
</EventData>
</Event>
  • 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-06-16T01:58:55+00:00Added an answer on June 16, 2026 at 1:58 am

    if you check it binary the function works fine, it just added 1 bit (or more, didn’t really check it) that you don’t need.
    try to put the answer through “AND” like this:

    answer=event.EventID & 0x1FFFFFFF

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

Sidebar

Related Questions

I wrote a Python script that I need to have installed on Windows Server
I'm just beginning to learn python. I wrote an example script to test OOP
I wrote a python script that depends on a certain NFS share to be
I wrote a python script to monitor a log file on a CentOS server
I wrote a simple python script using the SocketServer, it works well on Windows,
I wrote a python script to process some data from CSV files. The script
I am writing python script to login to ssh server using paramiko. I wrote
I wrote a Python script that does some task to generate, and then keep
I wrote a Python GUI script with Tkinter, and now I want to convert
I wrote the following script, which generates a SyntaxError : #!/usr/bin/python print Enter the

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.