Skip to content

Commit 19bfddd

Browse files
committed
fulfilled 2 requests
1 parent 912ac7f commit 19bfddd

File tree

1 file changed

+61
-27
lines changed

1 file changed

+61
-27
lines changed

MacAttack.pyw

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TODO:
22
# Clean up code, remove redundancy
3-
VERSION = "4.7.2"
3+
VERSION = "4.7.3"
44
import semver
55
import urllib.parse
66
import webbrowser
@@ -1040,6 +1040,7 @@ class VideoPlayerWorker(QThread):
10401040

10411041
class MacAttack(QMainWindow):
10421042
update_mac_label_signal = pyqtSignal(str)
1043+
update_hits_label_signal = pyqtSignal(str)
10431044
update_output_text_signal = pyqtSignal(str)
10441045
update_error_text_signal = pyqtSignal(str)
10451046
macattack_update_proxy_textbox_signal = pyqtSignal(str)
@@ -1200,6 +1201,7 @@ class MacAttack(QMainWindow):
12001201

12011202
# Connect the signals to for the Bigmacattack func
12021203
self.update_mac_label_signal.connect(self.update_mac_label)
1204+
self.update_hits_label_signal.connect(self.update_hits_label)
12031205
self.update_output_text_signal.connect(self.update_output_text)
12041206
self.update_error_text_signal.connect(self.update_error_text)
12051207
self.tabs.currentChanged.connect(self.on_tab_change)
@@ -1223,19 +1225,22 @@ class MacAttack(QMainWindow):
12231225
def build_mac_videoPlayer_gui(self, parent):
12241226
# Mac VideoPlayer Tab
12251227
central_widget = QWidget(self)
1226-
parent.setLayout(QVBoxLayout()) # Set layout for the parent widget
1228+
parent.setLayout(QVBoxLayout())
12271229
parent.layout().setContentsMargins(0, 0, 0, 0)
12281230
parent.layout().setSpacing(0)
12291231
parent.layout().addWidget(central_widget)
1232+
12301233
# Main layout
12311234
main_layout = QHBoxLayout(central_widget)
12321235
main_layout.setContentsMargins(0, 0, 0, 0)
12331236
main_layout.setSpacing(10)
1237+
12341238
# LEFT SECTION
12351239
self.left_layout = QVBoxLayout()
12361240
self.left_layout.setContentsMargins(0, 0, 0, 0)
12371241
self.left_layout.setSpacing(10)
12381242
self.left_layout.addSpacing(15)
1243+
12391244
self.hostname_layout = QHBoxLayout()
12401245
self.hostname_layout.setContentsMargins(0, 0, 0, 0)
12411246
self.hostname_layout.setSpacing(0)
@@ -1244,6 +1249,7 @@ class MacAttack(QMainWindow):
12441249
self.hostname_input = QLineEdit()
12451250
self.hostname_layout.addWidget(self.hostname_input)
12461251
self.left_layout.addLayout(self.hostname_layout)
1252+
12471253
self.mac_layout = QHBoxLayout()
12481254
self.mac_layout.setContentsMargins(0, 0, 0, 0)
12491255
self.mac_layout.setSpacing(0)
@@ -1252,12 +1258,13 @@ class MacAttack(QMainWindow):
12521258
self.mac_input = QLineEdit()
12531259
self.mac_layout.addWidget(self.mac_input)
12541260
self.left_layout.addLayout(self.mac_layout)
1261+
12551262
self.playlist_layout = QHBoxLayout()
12561263
self.playlist_layout.setContentsMargins(0, 0, 0, 0)
12571264
self.playlist_layout.setSpacing(0)
12581265
self.spacer = QSpacerItem(30, 0, QSizePolicy.Fixed, QSizePolicy.Minimum)
12591266
self.playlist_layout.addItem(self.spacer)
1260-
# Proxy input
1267+
12611268
self.proxy_layout = QHBoxLayout()
12621269
self.proxy_layout.setContentsMargins(0, 0, 0, 0)
12631270
self.proxy_layout.setSpacing(0)
@@ -1267,15 +1274,16 @@ class MacAttack(QMainWindow):
12671274
self.proxy_input.setPlaceholderText("Optional")
12681275
self.proxy_layout.addWidget(self.proxy_input)
12691276
self.left_layout.addLayout(self.proxy_layout)
1277+
12701278
self.get_playlist_button = QPushButton("Get Playlist")
12711279
self.playlist_layout.addWidget(self.get_playlist_button)
12721280
self.get_playlist_button.clicked.connect(self.get_playlist)
12731281
self.left_layout.addLayout(self.playlist_layout)
12741282
self.proxy_input.textChanged.connect(self.update_proxy)
1275-
# Playlist Tabs
1283+
12761284
self.tab_widget = QTabWidget()
12771285
self.left_layout.addWidget(self.tab_widget)
1278-
# Dictionary to hold tab data
1286+
12791287
self.tab_data = {}
12801288
for tab_name in ["Live", "Movies", "Series"]:
12811289
tab = QWidget()
@@ -1286,14 +1294,10 @@ class MacAttack(QMainWindow):
12861294

12871295
playlist_model = QStandardItemModel(playlist_view)
12881296
playlist_view.setModel(playlist_model)
1289-
1290-
# Connect double-click signal
12911297
playlist_view.doubleClicked.connect(self.on_playlist_selection_changed)
12921298

1293-
# Add the Tabs
12941299
self.tab_widget.addTab(tab, tab_name)
12951300

1296-
# Store tab data
12971301
self.tab_data[tab_name] = {
12981302
"tab_widget": tab,
12991303
"playlist_view": playlist_view,
@@ -1305,55 +1309,68 @@ class MacAttack(QMainWindow):
13051309
"current_series_info": [],
13061310
"current_view": "categories",
13071311
}
1308-
# Progress bar
1312+
13091313
self.progress_layout = QHBoxLayout()
13101314
self.progress_layout.setContentsMargins(0, 0, 0, 0)
13111315
self.progress_layout.setSpacing(0)
13121316
self.progress_bar = QProgressBar()
13131317
self.progress_bar.setValue(0)
13141318
self.progress_layout.addWidget(self.progress_bar)
13151319
self.left_layout.addLayout(self.progress_layout)
1316-
# Error Label
1320+
13171321
self.error_label = QLabel("ERROR: Error message label")
1318-
self.error_label.setStyleSheet(
1319-
"color: red; font-size: 10pt; margin-bottom: 15px;"
1320-
)
1322+
self.error_label.setStyleSheet("color: red; font-size: 10pt; margin-bottom: 15px;")
13211323
self.left_layout.addWidget(self.error_label, alignment=Qt.AlignRight)
1322-
self.error_label.setVisible(False) # Initially hide the label
1324+
self.error_label.setVisible(False)
1325+
13231326
self.left_widget = QWidget()
13241327
self.left_widget.setLayout(self.left_layout)
13251328
self.left_widget.setFixedWidth(240)
13261329
main_layout.addWidget(self.left_widget)
1330+
13271331
# RIGHT SECTION: Video area
13281332
right_layout = QVBoxLayout()
13291333
right_layout.setContentsMargins(0, 0, 0, 0)
13301334
right_layout.setSpacing(0)
1331-
# Video frame
1335+
13321336
self.video_frame = QWidget(self)
13331337
self.video_frame.setStyleSheet("background-color: black;")
13341338
right_layout.addWidget(self.video_frame)
1335-
# right layout to main layout
1339+
1340+
# Video URL and Copy Button
1341+
link_layout = QHBoxLayout()
1342+
link_layout.addStretch() #Align it to the right
1343+
self.video_url_label = QLabel("No Video Loaded.")
1344+
self.video_url_label.setStyleSheet("color: gray; font-size: 10pt; margin-top: 5px; margin-right: 5px;")
1345+
link_layout.addWidget(self.video_url_label)
1346+
1347+
self.copy_button = QPushButton("Copy")
1348+
self.copy_button.setFixedWidth(60)
1349+
self.copy_button.setFixedHeight(25)
1350+
self.copy_button.setStyleSheet("padding: 0px; margin-top: 5px;")
1351+
self.copy_button.clicked.connect(lambda: QApplication.clipboard().setText(self.video_url_label.text()))
1352+
link_layout.addWidget(self.copy_button)
1353+
right_layout.addLayout(link_layout)
13361354
main_layout.addLayout(right_layout)
1337-
# Configure the video player for the video frame
1355+
13381356
if sys.platform.startswith("linux"):
13391357
self.videoPlayer.set_xwindow(self.video_frame.winId())
13401358
elif sys.platform == "win32":
13411359
self.videoPlayer.set_hwnd(self.video_frame.winId())
13421360
elif sys.platform == "darwin":
13431361
self.videoPlayer.set_nsobject(int(self.video_frame.winId()))
1344-
# Load intro video
1362+
13451363
if getattr(sys, "frozen", False):
13461364
base_path = sys._MEIPASS
13471365
else:
13481366
base_path = os.path.abspath(".")
13491367
video_path = os.path.join(base_path, "include", "intro.mp4")
13501368
self.videoPlayer.set_media(self.instance.media_new(video_path))
13511369
logging.info(video_path)
1352-
self.startplay = 1 # play the video when switched to the video tab
1353-
# Disable mouse and key input for video
1370+
self.startplay = 1
13541371
self.videoPlayer.video_set_mouse_input(False)
13551372
self.videoPlayer.video_set_key_input(False)
1356-
# Progress Animation
1373+
13571374
self.progress_animation = QPropertyAnimation(self.progress_bar, b"value")
13581375
self.progress_animation.setDuration(1000)
13591376
self.progress_animation.setEasingCurve(QEasingCurve.Linear)
@@ -2432,6 +2449,9 @@ class MacAttack(QMainWindow):
24322449
self.concurrent_tests.setRange(1, 100) # Default range
24332450
# self.proxy_concurrent_tests.setRange(1, 100)
24342451

2452+
def update_hits_label(self, text):
2453+
"""Update the MAC address label in the main thread."""
2454+
self.hits_label.setText(text)
24352455
def update_mac_label(self, text):
24362456
"""Update the MAC address label in the main thread."""
24372457
self.brute_mac_label.setText(text)
@@ -2527,12 +2547,12 @@ class MacAttack(QMainWindow):
25272547
# Dropdown and MAC label layout
25282548
dropdown_label_layout = QHBoxLayout()
25292549
dropdown_label_layout.setContentsMargins(0, 0, 0, 0)
2530-
dropdown_label_layout.setSpacing(10)
2550+
dropdown_label_layout.setSpacing(0)
25312551

25322552
# Spacer to the left of IPTV type label
25332553
# left_spacer = QSpacerItem(10, 0, QSizePolicy.Fixed, QSizePolicy.Minimum)
25342554
dropdown_label_layout.addItem(left_spacer)
2535-
dropdown_label_layout.addSpacing(20) # Adds space
2555+
dropdown_label_layout.addSpacing(0) # Adds space
25362556

25372557
# IPTV type input
25382558
self.iptv_type_label = QLabel("Type:")
@@ -2573,12 +2593,17 @@ class MacAttack(QMainWindow):
25732593
dropdown_label_layout.addWidget(self.prefix_dropdown)
25742594
self.prefix_dropdown.currentIndexChanged.connect(self.update_customprefix)
25752595

2576-
2577-
2596+
# Hits label
2597+
dropdown_label_layout.addSpacing(20) # Adds space
2598+
self.hits_label = QLabel("Hits: 0")
2599+
dropdown_label_layout.addWidget(self.hits_label, alignment=Qt.AlignCenter)
2600+
dropdown_label_layout.addSpacing(20) # Adds space
2601+
25782602
# Center spacer for label alignment
25792603
center_spacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
25802604
dropdown_label_layout.addItem(center_spacer)
25812605

2606+
25822607
# MAC address label
25832608
self.brute_mac_label = QLabel("")
25842609
dropdown_label_layout.addWidget(self.brute_mac_label, alignment=Qt.AlignCenter)
@@ -3311,7 +3336,7 @@ class MacAttack(QMainWindow):
33113336
self.recentlyfound = [] # Erase recently found list
33123337
iptv_url = self.iptv_link
33133338
base_url = self.base_url
3314-
3339+
self.hits = 0
33153340
alt_speed_enabled = self.proxy_altspeed_checkbox.isChecked()
33163341

33173342

@@ -3397,10 +3422,14 @@ class MacAttack(QMainWindow):
33973422

33983423
if not proxies:
33993424
self.update_mac_label_signal.emit(f"Testing MAC: {mac}")
3425+
self.update_hits_label_signal.emit(f"Hits: {self.hits} ")
34003426
if proxies:
34013427
self.update_mac_label_signal.emit(
34023428
f"Testing MAC: {mac:<19} Using PROXY: {selected_proxy:<23}"
34033429
)
3430+
self.update_hits_label_signal.emit(
3431+
f"Hits: {self.hits}"
3432+
)
34043433
try:
34053434

34063435
with no_proxy_environment(): # Bypass the enviroment proxy set in the video player tab
@@ -4159,6 +4188,10 @@ class MacAttack(QMainWindow):
41594188

41604189

41614190
if not mac in self.recentlyfound:
4191+
if not hasattr(self, "hits"):
4192+
self.hits = 1
4193+
else:
4194+
self.hits += 1
41624195
self.add_recently_found(
41634196
mac
41644197
)
@@ -5530,6 +5563,7 @@ class MacAttack(QMainWindow):
55305563
)
55315564

55325565
def launch_media_player(self, stream_url):
5566+
self.video_url_label.setText(stream_url) #Put the video url in the label
55335567
self.restart_vlc_instance()
55345568
self.update_proxy() # reset the vlc window with the proxy and referer
55355569
self.error_label.setVisible(False)

0 commit comments

Comments
 (0)