Made a new to-do list:
I. Windows set things up
II. Linux: Find how to list all the network card names
III. to-do 2/4: Windows/MacOS: Find code in Wireshark that a) communicates to the ethernet, b) gets the MAC addresses in those operating systems
IV. to-do 3/4: Read POSIX socket API document
I. Windows: set things up to test on it
- Install Windows XP virtual machine on my computer's VM Player (victor gave me its iso)
- Install Ruby http://rubyinstaller.org/
- check "add ruby executables to your PATH"
- check "associate .rb and .rbw files with this ruby installation"
- Install Git http://code.google.com/p/
msysgit/downloads/list - select "rub git from the Windows command prompt"
- select "checkout windows-style, commit unix-style line endings"
- Install wireshark
- Ignore the popup that's about enabling promiscuous mode
- Download my github ethernet project (that is currently is a copy/paste of Victor's ether_shell), I just want to see if the rspec can run.
- No. When I ran rspec ethernet_spec.rb I got:
sh.exe": rspec: command not foundSo I did, like on Linux, gem install rspec, and then rspec worked!
- I tried to replicate pinging Wireshark based on this blog entry, but at the rake install step, I got an error as expected, since I haven't written anything that makes things work on Windows yet!
rake aborted!
undefined method `write' for #<Syck::Emitter:0x11efad0>
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:17:in `end_document'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:17:in `visit_Psych_Nodes_Document'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/visitor.rb:10:in `accept'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `block in visit_Psych_Nodes_Stream'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `each'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/emitter.rb:10:in `visit_Psych_Nodes_Stream'
c:/Ruby192/lib/ruby/1.9.1/psych/visitors/visitor.rb:11:in `accept'
c:/Ruby192/lib/ruby/1.9.1/psych/nodes/node.rb:36:in `to_yaml'
c:/Ruby192/lib/ruby/1.9.1/psych.rb:166:in `dump'
c:/Ruby192/lib/ruby/1.9.1/psych/core_ext.rb:13:in `psych_to_yaml'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `node_export'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `add'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:706:in `encode_with'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:728:in `block (2 levels) in to_yaml'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:727:in `map'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:727:in `block in to_yaml'
c:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `call'
c:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `emit'
c:/Ruby192/lib/ruby/1.9.1/syck.rb:401:in `quick_emit'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:726:in `to_yaml'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:78:in `block (2 levels) in write_package'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:73:in `block (3 levels) in add_gem_contents'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_writer.rb:83:in `new'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:67:in `block (2 levels) in add_gem_contents'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:65:in `wrap'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:65:in `block in add_gem_contents'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_writer.rb:113:in `add_file'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:63:in `add_gem_contents'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package/tar_output.rb:31:in `open'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/package.rb:68:in `open'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:77:in `block in write_package'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:76:in `open'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:76:in `write_package'
c:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/builder.rb:39:in `build'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/commands/build_gem.rb:16:in `run'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler.rb:87:in `build_gem'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/tasks.rb:84:in `block in define'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `call'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:634:in `block in execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:629:in `execute'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:602:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:581:in `invoke'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level'
c:/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run'
c:/Ruby192/bin/rake:31:in `<main>' - I also got the DevKit from http://rubyinstaller.org/downloads, following these directions to set up: https://github.com/oneclick/rubyinstaller/wiki/Development-Kit (I used this to "gem install rcov --platform=ruby", but it was not necessary since the next step covers it.)
- bundle install which results to installing a bunch of gems and saying "Your bundle is complete!"
- rake install
Successfully built RubyGemThis is because I haven't written the Windows parts of the gem yet! :D
...
...
ERROR: Error installing ./pkg/ethernet-0.0.0.gem:
ERROR: Failed to build gem native extension.
c:/Ruby192/bin/ruby.exe extconf.rb
checking for a bunch of stuff ...
- Continued in this blog
- to-do 4/4: read about MSDN
II. Linux: Find how to list all the network card names
I need to look into the system calls behind ifconfig to see how it lists all the network card device names.
- http://linux.die.net/man/2/syscalls has system calls
- I tried strace ifconfig 2> ifctrace.txt
- Google for "sourcecode ifconfig", found a bsd version to-do 1/4: read it to figure out how linux list devices!