moloch-- / RootTheBox

A Game of Hackers (CTF Scoreboard & Game Manager)
http://root-the-box.com/
Apache License 2.0
936 stars 298 forks source link

AttributeError: 'IPAddress' object has no attribute 'is_private' #624

Open MarioVilas opened 1 month ago

MarioVilas commented 1 month ago

I'm new with RootTheBox so I started a local instance to try it out. I created a new box, added an IP address, and now I can't see the box. Here's the traceback:

webapp-1     |     Traceback (most recent call last):
webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1788, in _execute
webapp-1     |         result = method(*self.path_args, **self.path_kwargs)
webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 68, in wrapper
webapp-1     |         return method(self, *args, **kwargs)
webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 99, in wrapper
webapp-1     |         return method(self, *args, **kwargs)
webapp-1     |       File "/opt/rtb/handlers/MissionsHandler.py", line 133, in get
webapp-1     |         self.render(
webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 944, in render
webapp-1     |         html = self.render_string(template_name, **kwargs)
webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1093, in render_string
webapp-1     |         return t.generate(**namespace)
webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/template.py", line 362, in generate
webapp-1     |         return execute()
webapp-1     |       File "missions/box_html.generated.py", line 1014, in _tt_execute
webapp-1     |         _tt_tmp = str(ip.is_private)  # missions/box.html:436 (via main.html:32)
webapp-1     |       File "/opt/rtb/models/IpAddress.py", line 109, in is_private
webapp-1     |         return self._ip_address.is_private()
webapp-1     |     AttributeError: 'IPAddress' object has no attribute 'is_private'
eljeffeg commented 1 week ago

That's weird. We'll have to try and reproduce that, but here is the library. https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address.is_private

dansibleadm commented 40 minutes ago

That's weird. We'll have to try and reproduce that, but here is the library. https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address.is_private

No. That's not correct. In your message you're referenced to included library "ipaddress" in python but in project you're include IPAddress-object from "netaddr" library (is_private doesn't exists). Here is ref: https://netaddr.readthedocs.io/en/latest/api.html#netaddr.IPAddress image

dansibleadm commented 26 minutes ago

I have changed library netaddr to ipaddress and now it's working fine :)