Tag: capture

Python

Obtain devices list with Python and pcapy

Install pcapy sudo apt-get install python-pcapysudo apt-get install python-pcapy Code import pcapy   devs = pcapy.findalldevs();   for dev in devs: print devimport pcapy devs = pcapy.findalldevs(); for dev in devs: print dev Run sudo python mysniffer.pysudo python mysniffer.py Output eth0 usbmon1 usbmon2 usbmon3 usbmon4 usbmon5 any loeth0 usbmon1 usbmon2 usbmon3 usbmon4 usbmon5 any lo …

C#

Obtain devices list with SharpPcap

SharpPcap is a cross-platform packet capture framework for the .NET environment, based on the famous pcap / WinPcap libraries. It provides an API for capturing, injecting, analyzing and building packets using any .NET language such as C# and VB.NET.   CaptureDeviceList cdevices = CaptureDeviceList.Instance; if (cdevices.Count >= 1) { foreach (ICaptureDevice dev in cdevices) { …

Wireshark

Decrypting WEP packets while capturing 802.11 in Wireshark

1. Start wireshark, of course! 2. Select Edit the menu 3. Choose Preferences.. 4. Expand Protocols 5. Find IEEE 802.11 6. Check Enable decryption 7. Press the button below to add your keys. If you are using an older version of wireshark, just enter your keys bellow in the text boxes, don’t try to find …

Sniffing, Wireshark

Capturing snmp traffic with wireshark

1. Open wireshark with root privilleges. sudo wiresharksudo wireshark 2. Select Capture->Interfaces from the menu. 3. A window will open. Click Options on your desired interface, for ex. eth0. 4. Type udp port 161 or udp port 162 (default ports). 5. Click Start. If you are capturing the whole traffic, type snmp in filter field.

Sniffing, Tools, Wireshark

Wireshark capture filters examples

Capture only traffic to or from IP address host xxx.xxx.xxx.xxxhost xxx.xxx.xxx.xxx Capture traffic to or from a range of IP addresses net xxx.xxx.0.0/24net xxx.xxx.0.0/24 Capture traffic to or from a range of IP addresses net xxx.xxx.0.0/24net xxx.xxx.0.0/24 Capture traffic from a range of IP addresses src net 192.168.0.0/24src net 192.168.0.0/24 Capture traffic to a range …

Cross-Platform, Java

Capture screen shot in Java

It’s really easy to capture screen shots using java code. Let’s see how: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package screenshot;   import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO;   public class Screenshot { public static void main(String[] args) …

Sniffing, Wireshark

Capturing HTTP traffic using Wireshark

1. First of all download and install Wireshark from here. 2. Run Wireshark as administrator or root. 3. Select from the menu Capture > Interfaces. 4. Choose your interface and click options. 5. In the capture filter textbox type: tcp port http. 6. Select a file to save the traffic by clicking the browse button. …