Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- import pyshark
- import threading
- # Configure logging
- logging.basicConfig(filename='session_debug.log', level=logging.DEBUG,
- format='%(asctime)s %(levelname)s %(message)s')
- # Setup WebDriver for Facebook call session
- def start_session_debugger(fb_call_url):
- try:
- logging.info("Starting session debugger for URL: %s", fb_call_url)
- # Set up WebDriver (Chrome in this case)
- options = webdriver.ChromeOptions()
- options.add_argument('--no-sandbox')
- options.add_argument('--disable-dev-shm-usage')
- options.add_argument('--headless') # Run in headless mode
- driver = webdriver.Chrome(options=options)
- driver.get(fb_call_url)
- logging.info("Opened Facebook group call page.")
- # Assuming that you'd want to log some page elements or session data
- try:
- peer_id = driver.find_element(By.XPATH, "//input[@name='peer_id']").get_attribute('value')
- logging.info(f"Peer ID: {peer_id}")
- except Exception as e:
- logging.error(f"Failed to retrieve peer_id: {str(e)}")
- # Other session parameters can be captured here similarly
- except Exception as e:
- logging.error(f"Error in session debugger: {str(e)}")
- finally:
- driver.quit()
- # Network Packet Capture using Pyshark
- def capture_network_packets(interface='eth0'):
- logging.info("Starting network capture on interface: %s", interface)
- capture = pyshark.LiveCapture(interface=interface)
- try:
- for packet in capture.sniff_continuously(packet_count=100):
- if 'IP' in packet:
- logging.debug(f"Packet: {packet['IP'].src} -> {packet['IP'].dst}")
- except Exception as e:
- logging.error(f"Error capturing packets: {str(e)}")
- # Run both the session debugger and network capture in parallel
- if __name__ == "__main__":
- fb_call_url = 'https://www.facebook.com/groupcall/ROOM:7847047172021551/?call_id=928793448&has_video=true'
- # Start session debugger in a separate thread
- session_thread = threading.Thread(target=start_session_debugger, args=(fb_call_url,))
- session_thread.start()
- # Start network packet capture in the main thread
- capture_network_packets(interface='eth0')
- session_thread.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement