Reputation: 8525
I have a middleware.py
file that records IP address on my website.
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[-1].strip()
else:
ip = request.META.get('REMOTE_ADDR')
try:
ip_address = IPAddress.objects.get(ip_address=ip,userprofile=up)
# Here we can have MultipleObjectsReturned error
# that's the issue Django emails me about
except IPAddress.DoesNotExist:
ip_address = IPAddress(ip_address=ip,userprofile=up)
Because of something that goes wrong MultipleObjectsReturned
, Django emails me about bug reports. But I see in all the emails many requests come from different URLs, and oddly at the same time 12:20 PM
Here are some URLs:
my_domain/elastik
my_domain/digium
my_domain/Avaya
my_domain/Zyxel
my_domain/cisco.cfg
my_domain/SIPGateway
...
As normal, these URLs don't exist on my website, they suppose to generate 404 error page, but my doubt is why at the same time? why these weird URLs?
Do I need to worry about ? or Does it exist a way to avoid that kind of behavior.
I host on DigitalOcean
Upvotes: 0
Views: 860
Reputation: 8525
Thank you @Selcuk I keep in mind what you said about scheduled job from other IP owner.
A possible solution from @Selcuk: I probably have a recycled IP address on DigitalOcean, and the previous owner had set up a scheduled job that does something at 12:20 PM every day that connects to that IP. Create a snapshot and move service to a new droplet
I spot out what was wrong. like @GrahamDumpleton said: Looks more like a bot scanning your site to see if you might be running a package which has a known vulnerability. That's right it was a bot scanning, thanks to user_agent
package that can be installed with pip
>>> request.user_agent.is_bot
>>> True
I have a table named UserAgent that record everything about each request
UserAgent.objects.get_or_create(
is_mobile = request.user_agent.is_mobile,
is_tablet = request.user_agent.is_tablet,
is_touch_capable = request.user_agent.is_touch_capable,
is_pc = request.user_agent.is_pc,
is_bot = request.user_agent.is_bot,
id_address = ip_address,
is_active = True,
'''
)
It's not something to worry about in that case
Upvotes: 2