@@ -31,7 +31,7 @@ from PyQt5.QtWidgets import (QAbstractItemView, QApplication, QCheckBox,
3131 QWidget )
3232from requests .adapters import HTTPAdapter
3333from requests .packages .urllib3 .util .retry import Retry
34- logging .basicConfig (level = logging .ERROR )
34+ logging .basicConfig (level = logging .DEBUG )
3535
3636@contextmanager
3737def no_proxy_environment ():
@@ -2078,82 +2078,81 @@ class MacAttack(QMainWindow):
20782078 except (TypeError , json .decoder .JSONDecodeError ) as e :
20792079 self .update_error_text_signal .emit (f"Data parsing error for channels data: { str (e )} " )
20802080 count = 0
2081- if count < 1 :
2082- count = "Unknown"
2083- logging .info ("Mac found" )
2084- if self .autoloadmac_checkbox .isChecked ():
2085- self .hostname_input .setText (self .base_url )
2086- self .mac_input .setText (mac )
2087- if self .output_file is None :
2088- output_filename = self .OutputMastermind ()
2089- self .output_file = open (output_filename , "a" )
2090- if self .moreoutput_checkbox .isChecked ():
2091- # Helper function to resolve IP addresses
2092- def resolve_ip_address (hostname , default_message ):
2093- try :
2094- return socket .gethostbyname (hostname )
2095- except socket .gaierror :
2096- logging .info (f"Unable to resolve the IP address for { hostname } ." )
2097- return default_message
2098- # Resolve middleware IP address
2099- parsed_middleware = urlparse (self .base_url )
2100- middleware_hostname = parsed_middleware .hostname
2101- middleware_ip_address = resolve_ip_address (middleware_hostname , "No Portal?" )
2102- logging .info (f"The IP address for { middleware_hostname } is { middleware_ip_address } " )
2103- # Resolve backend IP address
2104- backend_ip_address = resolve_ip_address (hostname , "No Backend" )
2105- logging .info (f"The IP address for { hostname } is { backend_ip_address } " )
2106- # Determine if middleware and backend are the same
2107- is_same_host = middleware_hostname == hostname
2108- host_comparison = "Same middleware and backend" if is_same_host else "Different middleware and backend"
2109- logging .info (host_comparison )
2110- # Construct the result message
2111- def generate_result_message (include_user , include_backend ):
2112- # Get the current date and time in the desired format
2113- current_time = datetime .now ().strftime ("%B %d, %Y, %I:%M %p" )
2114- base_message = (
2081+ if count > 0 :
2082+ logging .info ("Mac found" )
2083+ if self .autoloadmac_checkbox .isChecked ():
2084+ self .hostname_input .setText (self .base_url )
2085+ self .mac_input .setText (mac )
2086+ if self .output_file is None :
2087+ output_filename = self .OutputMastermind ()
2088+ self .output_file = open (output_filename , "a" )
2089+ if self .moreoutput_checkbox .isChecked ():
2090+ # Helper function to resolve IP addresses
2091+ def resolve_ip_address (hostname , default_message ):
2092+ try :
2093+ return socket .gethostbyname (hostname )
2094+ except socket .gaierror :
2095+ logging .info (f"Unable to resolve the IP address for { hostname } ." )
2096+ return default_message
2097+ # Resolve middleware IP address
2098+ parsed_middleware = urlparse (self .base_url )
2099+ middleware_hostname = parsed_middleware .hostname
2100+ middleware_ip_address = resolve_ip_address (middleware_hostname , "No Portal?" )
2101+ logging .info (f"The IP address for { middleware_hostname } is { middleware_ip_address } " )
2102+ # Resolve backend IP address
2103+ backend_ip_address = resolve_ip_address (hostname , "No Backend" )
2104+ logging .info (f"The IP address for { hostname } is { backend_ip_address } " )
2105+ # Determine if middleware and backend are the same
2106+ is_same_host = middleware_hostname == hostname
2107+ host_comparison = "Same middleware and backend" if is_same_host else "Different middleware and backend"
2108+ logging .info (host_comparison )
2109+ # Construct the result message
2110+ def generate_result_message (include_user , include_backend ):
2111+ # Get the current date and time in the desired format
2112+ current_time = datetime .now ().strftime ("%B %d, %Y, %I:%M %p" )
2113+ base_message = (
2114+ f"{ 'Portal:' :<10} { self .iptv_link } \n "
2115+ f"{ 'PortalIP:' :<10} { middleware_ip_address } \n "
2116+ f"{ 'MAC Addr:' :<10} { mac } \n "
2117+ f"{ 'DeviceID:' :<10} { device_id } \n "
2118+ f"{ 'SecondID:' :<10} { device_id2 } \n "
2119+ f"{ 'Serial #:' :<10} { sn } \n "
2120+ f"{ 'Found on:' :<10} { current_time } \n "
2121+ f"{ 'Exp date:' :<10} { expiry } \n "
2122+ f"{ 'Channels:' :<10} { count } \n "
2123+ )
2124+ backend_message = (
2125+ f"{ 'Backend: ' :<10} { domain_and_port } \n "
2126+ f"{ 'IP Addr: ' :<10} { backend_ip_address } \n "
2127+ ) if include_backend else ""
2128+ user_message = (
2129+ f"{ 'Username:' :<10} { username } \n "
2130+ f"{ 'Password:' :<10} { password } \n "
2131+ ) if include_user else ""
2132+ return base_message + backend_message + user_message
2133+ # Emit the appropriate message based on backend and username status
2134+ result_message = generate_result_message (userfound , not is_same_host )
2135+ self .update_output_text_signal .emit (result_message ) # No extra newline here
2136+ else :
2137+ # Simple output message when additional details are not required
2138+ result_message = (
21152139 f"{ 'Portal:' :<10} { self .iptv_link } \n "
2116- f"{ 'PortalIP:' :<10} { middleware_ip_address } \n "
2117- f"{ 'MAC Addr:' :<10} { mac } \n "
2118- f"{ 'DeviceID:' :<10} { device_id } \n "
2119- f"{ 'SecondID:' :<10} { device_id2 } \n "
2120- f"{ 'Serial #:' :<10} { sn } \n "
2121- f"{ 'Found on:' :<10} { current_time } \n "
2140+ f"{ 'MAC addr:' :<10} { mac } \n "
21222141 f"{ 'Exp date:' :<10} { expiry } \n "
21232142 f"{ 'Channels:' :<10} { count } \n "
21242143 )
2125- backend_message = (
2126- f"{ 'Backend: ' :<10} { domain_and_port } \n "
2127- f"{ 'IP Addr: ' :<10} { backend_ip_address } \n "
2128- ) if include_backend else ""
2129- user_message = (
2130- f"{ 'Username:' :<10} { username } \n "
2131- f"{ 'Password:' :<10} { password } \n "
2132- ) if include_user else ""
2133- return base_message + backend_message + user_message
2134- # Emit the appropriate message based on backend and username status
2135- result_message = generate_result_message (userfound , not is_same_host )
2136- self .update_output_text_signal .emit (result_message ) # No extra newline here
2144+ self .update_output_text_signal .emit (result_message ) # No extra newline here
2145+ # Write to file with a single blank line after each output
2146+ self .output_file .write (result_message + '\n ' )
2147+ self .output_file .flush () # Ensures data is written immediately
2148+ if self .successsound_checkbox .isChecked ():
2149+ sound_thread = threading .Thread (target = self .play_success_sound )
2150+ sound_thread .start () # Start the background thread
2151+ if self .autostop_checkbox .isChecked ():
2152+ logging .debug ("autostop_checkbox is checked, stopping..." )
2153+ self .stop_button .click ()
21372154 else :
2138- # Simple output message when additional details are not required
2139- result_message = (
2140- f"{ 'Portal:' :<10} { self .iptv_link } \n "
2141- f"{ 'MAC addr:' :<10} { mac } \n "
2142- f"{ 'Exp date:' :<10} { expiry } \n "
2143- f"{ 'Channels:' :<10} { count } \n "
2144- )
2145- self .update_output_text_signal .emit (result_message ) # No extra newline here
2146- # Write to file with a single blank line after each output
2147- self .output_file .write (result_message + '\n ' )
2148- self .output_file .flush () # Ensures data is written immediately
2149- if self .successsound_checkbox .isChecked ():
2150- sound_thread = threading .Thread (target = self .play_success_sound )
2151- sound_thread .start () # Start the background thread
2152- if self .autostop_checkbox .isChecked ():
2153- logging .debug ("autostop_checkbox is checked, stopping..." )
2154- self .stop_button .click ()
2155- #else:
2156- # result_message = f"MAC: {mac} connects, but has 0 channels. Bummer."
2155+ result_message = f"MAC: { mac } connects, but has 0 channels. Bummer."
21572156
21582157
21592158
0 commit comments