Git Product home page Git Product logo

rust-netcat's Introduction

Netcat in rust

This is a netcat implementation in rust, aiming for similar performance as original openbsd-netcat.

I originally started using mio, which in linux uses the epoll system call, but it had two problems:

  1. Every loop requires several systemcalls beucase every file descriptor needs to be reregistered for every change in the polling events.
  2. Regular files and others (like /dev/null) cannot be registered with epoll.

Problem 1. can be solved by using 4 epoll devices, one with each combination of file descriptor and polling event that is required. I didn't find any solution to problem 2.

So I moved to using the poll system call, using a wrap over the libc function (note that openbsd-netcat also uses poll).

Current status

Performance is similar to openbsd-netcat.

Here's the list of implemented options:

  • -4 Use IPv4
  • -6 Use IPv6
  • -b Allow broadcast
  • -C Send CRLF as line-ending
  • -D Enable the debug socket option
  • -d Detach from stdin
  • -F Pass socket fd
  • -h This help text
  • -I length TCP receive buffer length
  • -i interval Delay interval for lines sent, ports scanned
  • -k Keep inbound sockets open for multiple connects
  • -l Listen mode, for inbound connects
  • -M ttl Outgoing TTL / Hop Limit
  • -m minttl Minimum incoming TTL / Hop Limit
  • -N Shutdown the network socket after EOF on stdin
  • -n Suppress name/port resolutions
  • -O length TCP send buffer length
  • -P proxyuser Username for proxy authentication
  • -p port Specify local port for remote connects
  • -q secs quit after EOF on stdin and delay of secs
  • -r Randomize remote ports
  • -S Enable the TCP MD5 signature option
  • -s source Local source address
  • -T keyword TOS value
  • -t Answer TELNET negotiation
  • -U Use UNIX domain socket
  • -u UDP mode
  • -V rtable Specify alternate routing table
  • -v Verbose
  • -W recvlimit Terminate after receiving a number of packets
  • -w timeout Timeout for connects and final net reads
  • -X proto Proxy protocol: "4", "5" (SOCKS) or "connect"
  • -x addr[:port] Specify proxy address and port
  • -Z DCCP mode
  • -z Zero-I/O mode [used for scanning]

Acknowledgements

rust-netcat's People

Contributors

dhole avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.