Coder Social home page Coder Social logo

Comments (16)

chmorgan avatar chmorgan commented on May 23, 2024 1

SharpPcap doesn't contain any limits to the packet size you can send. That of course doesn't mean that there aren't limits due to wincap or npcap.

Now that npcap is supported by the latest git master would you mind trying npcap (instead of winpcap) and the latest git master to see if it works? If it doesn't then at least we can reach out to the npcap developer to discuss, winpcap is a dead project so we have no path for support there.

from sharppcap.

abdullah2993 avatar abdullah2993 commented on May 23, 2024

@russianbullet MTU?

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

abdullah I've modified the mtu of the ethernet card in windows but no luck , anything to do in sharppcap

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

Dear @chmorgan I've uninstalled winpcap and installed npcap , the result is the same , I get this exception when SendPacket

**> An unhandled exception of type 'SharpPcap.PcapException' occurred in SharpPcap.dll

Additional information: Can't send packet: send error: PacketSendPacket failed**

from sharppcap.

chmorgan avatar chmorgan commented on May 23, 2024

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

Thank you Chris

from sharppcap.

hsluoyz avatar hsluoyz commented on May 23, 2024

The issues page is at Nmap repo here: https://github.com/nmap/nmap/issues

BTW, can you provide an example to reproduce this issue? It only needs to contain the sending packet call with 1600 bytes. And I will test whether it works.

And please provide your DiagReport described in Npcap README. So I can see your adapter info.

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

Hello @hsluoyz
It's a pleasure to be in contact with you, Thx for @chmorgan
Dear @hsluoyz I've made a Demo about this issue, it's written in C#, also I've attached the Report you asked for. DiagReport-20170422-121459.txt
Thank you in advance

using SharpPcap;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DemoSendPacket
{
public partial class frmDemo : Form
{



private SharpPcap.CaptureDeviceList devices;
public frmDemo()
{
InitializeComponent();
}

private static byte[] GetRandomPacket(int size)
{
byte[] packet = new byte[size];
Random rand = new Random();
rand.NextBytes(packet);
return packet;
}

private void frmDemo_Load(object sender, EventArgs e)
{



NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();

devices = CaptureDeviceList.Instance;

foreach (ICaptureDevice dev in devices)
{

NetworkInterface ni = nics.Where((nic) => dev.Name.EndsWith(nic.Id)).FirstOrDefault();

if (ni == null)
continue;

this.cboNics.Items.Add(ni.Name);
}
}

private void btnSend1_Click(object sender, EventArgs e)
{
byte[] packet1 = GetRandomPacket(1514);
ICaptureDevice device = CaptureDeviceList.New()[this.cboNics.SelectedIndex];

device.Open();

device.SendPacket(packet1);

device.Close();
}

private void btnSend2_Click(object sender, EventArgs e)
{
byte[] packet2 = GetRandomPacket(1600);
ICaptureDevice device = CaptureDeviceList.New()[this.cboNics.SelectedIndex];

device.Open();

device.SendPacket(packet2);

device.Close();
}
}
}


from sharppcap.

hsluoyz avatar hsluoyz commented on May 23, 2024

Where is this.cboNics defined? Please upload your whole project as a zip. It's kind of hard for a non C# expert as me to tackle only a piece of code.

And BTW, I found you are running Win8. It's an outdated system and not supported by Microsoft any more. And I don't even have a Win8 VM to reproduce any bugs. (I only have Vista SP1, Win7 SP1, Win8.1, Win10). Please update to at least Win8.1 to avoid potential problems if possible.

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

Hello @hsluoyz , I'm so sorry to be late , I couldn't upload the project here, so I've uploaded it to google drive , this is the link: https://drive.google.com/file/d/0B6TQYhFg8n0mdXhubm5ESDdyYkE/view

from sharppcap.

hsluoyz avatar hsluoyz commented on May 23, 2024

Hi, I reproduced your issue. It seems that Windows hardcoded the maximum of MTU for Ethernet adapters to be 1500. In fact I never googled out an article that said MTU can be larger than 1500. It's a de-facto standard and it seems that Windows implements this way. In fact, you can get a larger MTU for other type adapters. For example, Npcap Loopback Adapter supports a MTU of 65536.

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

Thank you @hsluoyz , It seems that am going to fragment the ip packet , thank you for your efforts guys , regards

from sharppcap.

abdullah2993 avatar abdullah2993 commented on May 23, 2024

@hsluoyz @russianbullet i am quite sure you can change the MTU in windows. Using netsh tool...

from sharppcap.

abdullah2993 avatar abdullah2993 commented on May 23, 2024

You can change the MTU
https://support.zen.co.uk/kb/Knowledgebase/Changing-the-MTU-size-in-Windows-Vista-7-or-8

from sharppcap.

russianbullet avatar russianbullet commented on May 23, 2024

@abdullah2993 I've already changed it , but no luck still the same error

from sharppcap.

chmorgan avatar chmorgan commented on May 23, 2024

Closing this as it is a limitation of the OS and/or npcap. @hsluoyz thanks for your help.

from sharppcap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.