我設法捕捉通過網絡販賣的文件的內容,但我無法捕捉到file name
。Sharppcap - 如何獲取traffiqued文件名?
class Program
{
static void Main(string[] args)
{
// Retrieve the device list
CaptureDeviceList devices = CaptureDeviceList.Instance;
// Print out the available network devices
foreach (ICaptureDevice dev in devices)
{
// Extract a device from the list
ICaptureDevice device = dev;
// Register our handler function to the
// 'packet arrival' event
device.OnPacketArrival += device_OnPacketArrival;
// Open the device for capturing
const int readTimeoutMilliseconds = 1000;
device.Open(DeviceMode.Promiscuous, readTimeoutMilliseconds);
// Start the capturing process
device.StartCapture();
}
Console.ReadKey();
foreach (var dev in CaptureDeviceList.Instance)
{
dev.StopCapture();
dev.Close();
}
}
private static void device_OnPacketArrival(object sender, CaptureEventArgs e)
{
var data = Encoding.ASCII.GetString(e.Packet.Data);
//HERE! When it exists, I need get the file name that was trafficked (eg. FileName.docx).
}
}
如何在攔截文件訪問協議(NFS | SMB | AFP)時使用Sharpcap獲取文件名?
謝謝回覆!我編輯了我的問題,請再看一遍。我會非常感激。 –