dotpcap / sharppcap

Official repository - Fully managed, cross platform (Windows, Mac, Linux) .NET library for capturing packets
1.33k stars 268 forks source link

SharpPcap.PcapException: 'Failed to open Error Code: 3)' #509

Open haunwoo opened 7 months ago

haunwoo commented 7 months ago

using Newtonsoft.Json.Linq; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Chromium; using PacketDotNet; using SharpPcap; using SharpPcap.WinDivert; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Net; using System.Net.WebSockets; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms;

private WinDivertDevice device;

private void Form1_Load_1(object sender, EventArgs e)
{
  this.ws = new EvoWs(this);
  this.Height = 100;
  this.service = ChromeDriverService.CreateDefaultService();
  ((DriverService) this.service).HideCommandPromptWindow = true;
  ((DriverService) this.service).DriverServicePath = "./";
  ((DriverService) this.service).DriverServiceExecutableName = "chromedriver.exe";
  this.options = new ChromeOptions();
  ((ChromiumOptions) this.options).AddArguments(new string[12]
  {
    "--disable-notifications",
    "--disable-popup-blocking",
    "--disable-blink-features=AutomationControlled",
    "--disable-infobars",
    "--disable-gpu",
    "--start-maximized",
    "--disable-web-security",
    "--ignore-certificate-errors",
    "--allow-running-insecure-content",
    "--proxy-auto-detect",
    "--disable-quic",
    "--mute-audio"
  });

        this.device = new WinDivertDevice();
        this.device.Filter = "tcp.SrcPort == 443 || tcp.DstPort == 443";

        CaptureDeviceExtensions.Open((IPcapDevice)this.device, (DeviceModes)0, 1); 
        this.device.OnPacketArrival += new PacketArrivalEventHandler(this.Device_OnPacketArrival);
        this.device.StartCapture();

    }

2024-03-04 22 51 29

An unknown exception is being thrown Can anyone predict this exception? If so, please let me know Thanks