nospaceships/raw-socket-sniffer

You cannot call a method on a null-valued expression.

Closed this issue · 5 comments

Hello,

I am not workstation admin and as soon as I launch the script with the proper arguments, I'm getting flooded by the following error :

Exception calling "BlockCopy" with "5" argument(s): "Offset and length were out of bounds for the array or count is
greater than the number of elements from index to the end of the source collection."
At C:\Users\x\test\raw-socket-sniffer.ps1:103 char:5
+     [Buffer]::BlockCopy([BitConverter]::GetBytes($rc), 0, $buffer, 12 ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentException

You cannot call a method on a null-valued expression.

Any idea what could cause this ?

Hi @flacostec

What version of Windows are you running this on?

Stev

Currently running Windows 10 1703 (15036.1324) and I am not administrator of the workstation (I've edited my answer).

Ah okay, so raw sockets on WIndows require administrator privileges (there's a note on this page).

Can you try using "Run as Administrator"? Just verified and it worked for me.

Steve

Worked fine with admin right. :-)

I have the same issue and running as Administrator with Admin PowerShell doesn't solve it.