nospaceships / node-raw-socket

Raw sockets for Node.js.
207 stars 69 forks source link

TCP protocol throwing an exception #71

Closed Zakistt closed 3 years ago

Zakistt commented 3 years ago

Long story short ... whenever I use var socket = raw.createSocket({protocol: raw.Protocol.TCP}) node throws an Error: An invalid argument was supplied. exception I used UDP , ICMP , ICMPv6 and all worked just fine , I don't really know what's the problem ... if anybody can help it would be appreciated

P.S: on the target end all i got was bunch of RDP, SSDP packets , if it means anything ...

stephenwvickers commented 3 years ago

Mm, I don't know why this doesn't work for you, it works for me:

[stephen@dev-centos8 ping]$ cat tcp.js

var raw = require("raw-socket")

var socket = raw.createSocket({protocol: raw.Protocol.TCP})

[stephen@dev-centos8 ping]$ sudo node tcp.js
^C
[stephen@dev-centos8 ping]$

That was on Linux.

Perhaps your platform does not support TCP based raw sockets.

Zakistt commented 3 years ago

I'm using windows 10 and it turned out that windows has some restrictions on TCP raw-sockets ... If i could make a suggestion, that next version would be based on so that it'll be compatible with all platforms that would be great

Thanks for replying and thanks for this fantastic module , wish you all the best

On Wed, 30 Dec 2020, 21:47 Stephen Vickers, notifications@github.com wrote:

Mm, I don't know why this doesn't work for you, it works for me:

[stephen@dev-centos8 ping]$ cat tcp.js

var raw = require("raw-socket")

var socket = raw.createSocket({protocol: raw.Protocol.TCP})

[stephen@dev-centos8 ping]$ sudo node tcp.js ^C [stephen@dev-centos8 ping]$



That was on Linux.

Perhaps your platform does not support TCP based raw sockets.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/nospaceships/node-raw-socket/issues/71#issuecomment-752753531>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKHVXOG5QHLDW6TJXLCRNE3SXOGXTANCNFSM4VMOIYTA>
.
stephenwvickers commented 3 years ago

@Zakistt There is already a PCAP node module I think, maybe you could try that, as in the ability to use PCAP might already be available for you.

Zakistt commented 3 years ago

Yes, i'm aware of that but the pcap module un node is used for capturing data , the pcap.h i talked about is used in c++ to enable bypassing windows restrictions on raw-sockets

On Wed, 30 Dec 2020, 22:23 Stephen Vickers, notifications@github.com wrote:

@Zakistt https://github.com/Zakistt There is already a PCAP node module I think, maybe you could try that, as in the ability to use PCAP might already be available for you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nospaceships/node-raw-socket/issues/71#issuecomment-752762715, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKHVXOG4ORFLD6JBPPYIQPDSXOK4VANCNFSM4VMOIYTA .

stephenwvickers commented 3 years ago

Do you have a link to this?

I will take a look and see if what would be inolved.

Zakistt commented 3 years ago

here's the library website https://www.winpcap.org/ which is supported by windows 7 /8 ... but not 10 , for windows 10 refer to http://www.win10pcap.org/ i don't know much about c++ but this https://www.winpcap.org/docs/docs_40_2/html/group__wpcap__tut8.html might be a good guide

On Wed, 30 Dec 2020 at 22:35, Stephen Vickers notifications@github.com wrote:

Do you have a link to this?

I will take a look and see if what would be inolved.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nospaceships/node-raw-socket/issues/71#issuecomment-752765578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKHVXOAY4LMOTAQM7XT55HTSXOMILANCNFSM4VMOIYTA .