{"id":470,"date":"2008-07-03T11:46:49","date_gmt":"2008-07-03T19:46:49","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/2008\/07\/03\/powershell-ip-packet-sniffer-script\/"},"modified":"2008-07-03T11:46:49","modified_gmt":"2008-07-03T19:46:49","slug":"powershell-ip-packet-sniffer-script","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2008\/07\/03\/powershell-ip-packet-sniffer-script\/","title":{"rendered":"Powershell: IP Packet Sniffer Script"},"content":{"rendered":"<p>I came across a wicked PowerShell script (<a href=\"http:\/\/blog.robbiefoust.com\/2007\/11\/powershell-ip-packet-sniffer-script.html\">Trends in Technology: Powershell: IP Packet Sniffer Script<\/a> ) that is essentially a PowerShell packet sniffer.&nbsp; How cool is that!&nbsp; It certainly won&#8217;t replace full blown sniffers like WireShark but I love having a PowerShell window open watching packets.&nbsp; Yea, I need to get out more.<\/p>\n<p>After you start the script, press Ctrl-C to break. Which is probably why this:<\/p>\n<p><font face=\"Consolas\" color=\"#0000ff\" size=\"2\">PS C:\\&gt; $sniff=c:\\scripts\\posh\\get-packet.ps1 -local 172.16.10.102<\/font><\/p>\n<p>fails. However, this works:<\/p>\n<p><font face=\"Consolas\" color=\"#0000ff\" size=\"2\">PS C:\\&gt; c:\\scripts\\posh\\get-packet.ps1 -local 172.16.10.102 | out-file c:\\test\\sniff.txt<\/font><\/p>\n<p>When I press Ctrl-C I can open the file. This will also work:<\/p>\n<p><font face=\"Consolas\" color=\"#0000ff\" size=\"2\">PS C:\\&gt; c:\\scripts\\posh\\get-packet.ps1 -local 172.16.10.102 | export-clixml c:\\test\\sniff.xml<\/font><\/p>\n<p>Even better because now I can work with objects and so sorting, filtering or other stuff. Although, the import is not perfect and may need some tweaking. I&#8217;m glad Robbie figured out all the hard networking pieces.&nbsp; Give it a shot and let me know what you think.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I came across a wicked PowerShell script (Trends in Technology: Powershell: IP Packet Sniffer Script ) that is essentially a PowerShell packet sniffer.  How cool is that!  It certainly won&#8217;t replace full blown sniffers like WireShark but I love having a PowerShell window open watching packets.  Yea, I need to get out more.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[25],"tags":[221,220,28,57,219],"class_list":["post-470","post","type-post","status-publish","format-standard","hentry","category-windows-powershell","tag-network","tag-packet","tag-powershell","tag-scripting","tag-trace"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=470"}],"version-history":[{"count":0,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/470\/revisions"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}