title: Using Ruby to fuzz FTP Server
body: <p>Hey, I'm new to Ruby and trying to learn by porting some progs from one language to another.  Right now I'm working on an FTP fuzzer in Ruby that mirrors this perl script:</p>
  
  <pre><code>use Net::FTP;
  $target = "192.168.37.128";
  $buffer = "A\x20";
  $buffer .= "A" x 512;
  $ftp = Net::FTP-&gt;new($target, Debug =&gt; 0, Timeout =&gt; 5)
        or die "Cannot connect to $host: $@ \n";
  $ftp-&gt;login("anonymous",'anonymous@nowhere.com')
        or die "Couldn't log in: $@\n";
  $ftp-&gt;list($buffer);
  $ftp-&gt;quit;
  </code></pre>
  
  <p>This is my Ruby equivalent:</p>
  
  <pre><code>require 'net/ftp'
  buffer = 'A\x20'
  buffer = (buffer + ('A'*512))
  ftp = Net::FTP.open('127.0.0.1','anonymous','anonymous')
  ftp.login
  ftp.list(buffer)
  ftp.quit
  </code></pre>
  
  <p>When I run the program I get the following error:</p>
  
  <pre><code>C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:241:in `readline': end of file reached (EOF
  Error)
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:241:in `getline'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:251:in `getmultiline'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:265:in `getresp'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:281:in `voidresp'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:304:in `block in voidcmd'
          from C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:302:in `voidcmd'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:155:in `send_type_command'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:149:in `binary='
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:168:in `ensure in with_binary'
  
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:168:in `with_binary'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:440:in `block in retrlines'
          from C:/Ruby192/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:439:in `retrlines'
          from C:/Ruby192/lib/ruby/1.9.1/net/ftp.rb:682:in `list'
          from ftpcrash.rb:10:in `&lt;main&gt;'
  </code></pre>
  
  <p>I've traced the issue to the <code>ftp.list(buffer)</code> line, but can't come up with a Ruby solution that will accomplish what <code>$ftp-&gt;list($buffer)</code> does in the perl one.</p>
  
  <p>Suggestions?</p>