Giter Club home page Giter Club logo

Comments (5)

jpbelangerupgrade avatar jpbelangerupgrade commented on September 17, 2024 1

the problem comes from the total_diff_min = ((now_timestamp - prev_updated_at).total_seconds())/60 lines. the prev_update_at does not have any timezone associated to it. I had to add the UTC timezone to it for it to work.

from aws-waf-security-automations.

dix-icomys avatar dix-icomys commented on September 17, 2024

Thanks, @jpbelangerupgrade

from aws-waf-security-automations.

michi88 avatar michi88 commented on September 17, 2024

it can be fixed with:

from dateutil import tz

# somewhere around line 185
# fix for https://github.com/awslabs/aws-waf-security-automations/issues/18
prev_updated_at = prev_updated_at.replace(tzinfo=tz.tzutc())
# end fix

from aws-waf-security-automations.

nokiomanz avatar nokiomanz commented on September 17, 2024

Hi all,

I was using the solution from before the last "stack" update on the 29 jully 2017. And it was working great.
When the updated stack got updated I updated it. I realised this morning that it was not working properly with the same reason provided by @thechrisproject here : #25. Not that big of a deal because those ip making too much request get's blocked again. It was just not working as expected by following the amount of time I wanted to block.

I added after line 184
prev_updated_at = prev_updated_at.replace(tzinfo=response['LastModified'].tzinfo)

Before :
prev_updated_at = datetime.datetime.strptime(v['updated_at'], "%Y-%m-%d %H:%M:%S")
total_diff_min = ((now_timestamp - prev_updated_at).total_seconds())/60

After :
prev_updated_at = datetime.datetime.strptime(v['updated_at'], "%Y-%m-%d %H:%M:%S")
prev_updated_at = prev_updated_at.replace(tzinfo=response['LastModified'].tzinfo)
total_diff_min = ((now_timestamp - prev_updated_at).total_seconds())/60

It now work as expected.

from aws-waf-security-automations.

hvital avatar hvital commented on September 17, 2024

Hi,

Thanks for the comment and recommendation about how to fix it.

The current version is supposed to use the same timezone. Here.

from aws-waf-security-automations.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.