怎么用代码调用IDM 资源嗅探 功能 (不是下载 创建下载任务我会 问题是获取资源地址 调用IDM的话就不用花时间每个网站自己解析)
如果可以实现 需要一个 完整的调用示例 我这边测试成功即采纳
最好使用C#调用 其他语言不熟 测试示例困难 采纳概率低 (但如果测试成功了也会采纳)
10/24 目前用的其他解决办法,用python获取的浏览器日志拿到的下载地址,没有用到各位的方法。
虽然问题算是解决了,但我仍然想要一个代码调用IDM资源嗅探的方法,这个问题我会尽量一直开着,有人有成功调用和的案例,我会去尝试 如果成功了就给分
C#利用SharpPcap实现网络包捕获嗅探
/// <summary>
/// 开始捕捉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnstart_click(object sender, eventargs e)
{
if (this.combdevice.selectedindex > -1)
{
startcapture(this.combdevice.selectedindex);
this.btnstart.enabled = false;
this.btnstop.enabled = true;
}
else {
messagebox.show(this,"请选择一个设备","提示",messageboxbuttons.ok);
}
}
/// <summary>
/// 停止捕捉
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnstop_click(object sender, eventargs e)
{
shutdown();
this.btnstop.enabled = false;
this.btnstart.enabled = true;
}
private void startcapture(int itemindex)
{
packetcount = 0;
device = capturedevicelist.instance[itemindex];
packetstrings = new queue<packetwrapper>();
bs = new bindingsource();
dgvdata.datasource = bs;
laststatisticsoutput = datetime.now;
// start the background thread
backgroundthreadstop = false;
backgroundthread = new thread(backgroundthread);
backgroundthread.start();
// setup background capture
device.onpacketarrival += new packetarrivaleventhandler(device_onpacketarrival);
device.oncapturestopped += new capturestoppedeventhandler(device_oncapturestopped);
device.open();
// tcpdump filter to capture only tcp/ip packets
string filter = "ip and tcp";
device.filter = filter;
// force an initial statistics update
capturestatistics = device.statistics;
updatecapturestatistics();
// start the background capture
device.startcapture();
btnstop.enabled = true;
}
/// <summary>
/// 设备接收事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void device_onpacketarrival(object sender, captureeventargs e)
{
// print out periodic statistics about this device
var now = datetime.now;
var interval = now - laststatisticsoutput;
if (interval > new timespan(0, 0, 2))
{
console.writeline("device_onpacketarrival: " + e.device.statistics);
capturestatistics = e.device.statistics;
statisticsuineedsupdate = true;
laststatisticsoutput = now;
}
lock (queuelock)
{
packetqueue.add(e.packet);
}
}
/// <summary>
/// 设备停止事件
/// </summary>
/// <param name="sender"></param>
/// <param name="status"></param>
private void device_oncapturestopped(object sender, capturestoppedeventstatus status)
{
if (status != capturestoppedeventstatus.completedwithouterror)
{
messagebox.show("error stopping capture", "error", messageboxbuttons.ok, messageboxicon.error);
}
}
private void updatecapturestatistics()
{
tlblstatistic.text = string.format("接收包: {0}, 丢弃包: {1}, 接口丢弃包: {2}", capturestatistics.receivedpackets,capturestatistics.droppedpackets, capturestatistics.interfacedroppedpackets);
}
【这是一种思路,期望对你有所帮助,欢迎留言】
按理论来说,应该是可以实现的吧,可以把IDM看做是一个COM库,你只值需要知道嗅探的函数是什么就可以了
博主参考下面链接
https://b23.tv/Vv6s70y
https://pipe.b3log.org/blogs/WayneShao/articles/2018/03/07/1540801203188