Recent changes
Slingshot user guide
tag Guide, user
NFCLamp user guide
tag Guide, user
Homepage
MPL115A2
Compiler Error 42
From the mbed microcontroller Cookbook.  

NetTool

NetTool

Purpose

The purpose of the NetTool project is to demonstrate the use of raw structures and memory maps to achieve raw ethernet, ip, arp, icmp, tcp, and udp input and output. The demonstration tool can ping, identify, and perform a TCP port scan of a host connected via ethernet.

Program

» Import this programNetTool

This is a low-level network debugging utility that utilizes raw packet i/o to construct and deconstruct tcp, udp, ipv4, arp, and icmp packets over ethernet.

Memory Maps

NetTool provides C++ structure memory maps for numerous on-wire formats, including Ethernet, IP, TCP, UDP, ICMP, and ARP. In order for them to work nicely in the host environment, accompanying functions are provided to fix the endianness of the memory so that the stuructures can be created and used easily.

IP

» Import this programNetTool

No documentation found.

The demo program interprets IP version 4 (IPv4) packets and processes them based on their protocol. If they are TCP, UDP, or ICMP, they are processed further.

TCP

» Import this programNetTool

No documentation found.

TCP packets are processed and a TCP port scan can be performed by adding a line with "portscan" to the command text file.

UDP

» Import this programNetTool

No documentation found.

UDP packets are processed by the dmeo program, but not used.

ICMP

» Import this programNetTool

No documentation found.

The demo program can (by adding "ping" on a line by itself to the command file) send a ping every 30 seconds to the host computer.

ARP

» Import this programNetTool

No documentation found.

The demo program interprets ARP requests and announces in order to determine an IP address for itself and to instruct the host how to communicate with the device. When the host announces an IP address, the next IP address is chosen and used as the device IP.

Demo Program

Hardware

The only peripheral used by the demo program is an ethernet jack. One can be obtained from SparkFun. The Cool Components Workshop Board also has the necessary parts on it. The configuration, logging, and status reports are all available through the MBED flash drive when attached to any computer via USB.

PC Setup

The demo program does not emulate DHCP, so the interface that is connected to the MBED via ethernet should be configured with a static IP address. Consult your operating system documentation for how to do this.

Configuration

The demonstration program reads a file off of the MBED flash drive called "ntcmd.txt" which has the following general format:

Code

# comment
command

The known commands are:

  1. ping
  2. portscan
  3. identify

Commands

Code

ping

The ping command sends a ping to the attached host every 30 seconds and writes the status of its replies to the file "ping.txt" for each ping (the file is overwritten every time).

Code

portscan

The port scan command sends a TCP connection request to every legal port on the attached host system and writes the results of the port scan to the file "portscan.txt".

Code

identify

The identify command writes the host IP address and MAC address to the file "identity.txt".

Log

All major actions and status reports by the tool are written to "nettool.log".




calendar Page history
Last modified 12 Oct 2010, by   user Kyle Lemons   tag No tags | 2 comments  

2 comments on NetTool:

21 Dec 2010

Just trying the netool. It ejects the mbed every time I run the identify command (and gives me a you did not safely unmount drive warning). Using mbed with a Starboard orange development board and a Macbook Pro.

30 Dec 2010

I think this behaviour is normal. If the MBED writes to the flash area then the PC(or mac) also using this area is disconnected. Please check the handbook (LocalFileSystem part) http://mbed.org/handbook/LocalFileSystem

If the microcontroller program opens a file on the local drive, it will be marked as “removed” on the Host computer. This means the PC will often display a message such as "insert a disk into drive" if you try to access it at this time; this is normal, and stops both the mbed and the PC trying to access the disk at the same time.

Please login to post comments.