port sniffer, multithreading

Overview

SniffSniff

I am trying to learn Rust programming language. Here is a small project that sniffs the ports of a given host. I want to give some info what is port, tcp and host.

port: a number that is used to identify a specific process to which an incoming network message is to be forwarded to.

tcp: a protocol that is used to establish a connection between two hosts.

host: a computer that is connected to a network.

What is port sniffing anyway?

Port sniffing is a technique that is used to scan the ports of a host. It is used to find out which ports are open and which are closed. It is also used to find out which services are running on a host.

How does it work?

The program sends a TCP SYN packet to the host and waits for a response. If the port is open, the host will send a TCP SYN/ACK packet. If the port is closed, the host will send a TCP RST packet. ....

Diagram:

Things that i have learned so far

  • unwrap: unwrap is used to get the value of a Result. If the Result is an Err, unwrap will panic. it is good if you dont want to handle the error.
  • move: simply move ownership into a closure.
  • match: works like switch case in other languages.
  • drop: dispose of a value.
  • &'static str: a string that lives for the entire duration of the program.
  • io::stdout().flush(): flushes the buffer of the stdout.
  • thread::spawn: spawns a new thread.
  • afunc()?: the ? means that if the result of afunc() is an Err, the whole function will return the Err value.

Usage

cargo run -- -j <threads> <ipaddr>

Example

cargo run -- -j 10000 192.168.1.1
....
Open ports: (4 total)
53
80
52869
443

Build

cargo build

Run

cargo run

License

Licensed under the MIT license. See the LICENSE file for details.

You might also like...
A port of everything to Rust 🦀
A port of everything to Rust 🦀

everything.rs Do you ever feel like washing your hands after a coding session, disgusted at having to use essential Unix utilities with not the tinies

A simple demo to bind a TCP port with k8s exec channel.k8s.io websocket API.

k8s-webterm-connector Tired with web terminals? Let's use it with CLI! This is just a simple demo to bind a TCP port with k8s exec websocket API, whic

🧮 Boolean expression evaluation engine. A Rust port of boolrule.

coolrule My blog post: Porting Boolrule to Rust Boolean expression evaluation engine (a port of boolrule to Rust). // Without context let expr = coolr

Truly universal encoding detector in pure Rust - port of Python version

Charset Normalizer A library that helps you read text from an unknown charset encoding. Motivated by original Python version of charset-normalizer, I'

A port of sug0/go-glitch

Glitch This is a simple port of https://github.com/sug0/go-glitch to rust. What is the deal with the expressions? You can think of the image as a func

Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust.

brusher Experimental engine agnostic 3D CSG library for game development written in Rust. Started as a port of csg.js to Rust. ultimate goal My hope i

A simple port sniffer(scanner) implementation with 🦀

A simple port sniffer(scanner) implementation with 🦀 Install from crates.io crago install ports-sniffer From aur: yay -S ports-sniffer Arguments Argu

Sincere is a micro web framework for Rust(stable) based on hyper and multithreading

The project is no longer maintained! Sincere Sincere is a micro web framework for Rust(stable) based on hyper and multithreading. Style like koa. The

A simple utility for multithreading a/synchronization

Flowync Quick Example use flowync::Flower; fn main() { let flower = Flower::i32, String::new(1); std::thread::spawn({ let handle =

Gauzilla: a 3D Gaussian Splatting renderer written in Rust for WebAssembly with lock-free multithreading
Gauzilla: a 3D Gaussian Splatting renderer written in Rust for WebAssembly with lock-free multithreading

Gauzilla A 3D Gaussian Splatting (3DGS) renderer written in Rust for platform-agnostic WebAssembly (WASM) with lock-free multithreading. Uses WebGL an

Secure multithreaded packet sniffer
Secure multithreaded packet sniffer

sniffglue sniffglue is a network sniffer written in rust. Network packets are parsed concurrently using a thread pool to utilize all cpu cores. Projec

Sniffer - a tool to quickly inspect csv and flat-file files for basic information
Sniffer - a tool to quickly inspect csv and flat-file files for basic information

sniffer sniffer is a tool to quickly inspect csv and flat-file files for basic information. Need to see how many rows are in a csv file? Want to see t

A cross-platform serial port library in Rust. Provides a blocking I/O interface and port enumeration including USB device information.

Note: This is a fork of the original serialport-rs project on GitLab. Please note there have been some changes to both the supported targets and which

An app which reads data from a serial port and serves it on a TCP port.

serial-to-tcp An app which reads data from a serial port and serves it on a TCP port. How to use Clone this repo and build the app as outlined below (

🤖 The Modern Port Scanner 🤖
🤖 The Modern Port Scanner 🤖

➡️ Discord | Installation Guide | Usage Guide ⬅️ The Modern Port Scanner. Fast, smart, effective. 🐋 Docker (Recommended) 👩‍💻 Kali / Debian 🏗️ Arch

Rust port of pexpect

rexpect Spawn, control, and respond to expected patterns of child applications and processes, enabling the automation of interactions and testing. Com

A Rust port of the password primitives used in Django Project.

Rust DjangoHashers A Rust port of the password primitives used in Django Project. Django's django.contrib.auth.models.User class has a few methods to

Rust port of simdjson

SIMD Json for Rust   Rust port of extremely fast simdjson JSON parser with serde compatibility. readme (for real!) simdjson version Currently tracking

Rust port of gjson,get JSON value by dotpath syntax

A-JSON Read JSON values quickly - Rust JSON Parser change name to AJSON, see issue Inspiration comes from gjson in golang Installation Add it to your

Owner
Furkan Demir
frontend engineer
Furkan Demir
Sniffer - a tool to quickly inspect csv and flat-file files for basic information

sniffer sniffer is a tool to quickly inspect csv and flat-file files for basic information. Need to see how many rows are in a csv file? Want to see t

Daniel B 10 Apr 4, 2023
Rust port of pexpect

rexpect Spawn, control, and respond to expected patterns of child applications and processes, enabling the automation of interactions and testing. Com

Philipp Keller 177 Dec 25, 2022
Dog command for *nix systems, Rust port of dog.

dog-rs Dog command for *nix systems, Rust port of dog. Because there is a cat command, should be a dog command too. It was written completely using VS

Juanjo Salvador 2 Sep 29, 2021
Rust port of InfectedRose.Interface

Rust port of Wincent's InfectedRose.Interface. It is not finished; only adding to the database is possible at the moment, editing and removing is not,

zaop 3 Feb 2, 2022
This is a command line port of the game Wordle in Rust

Wordle.rs Welcome to Wordle.rs! This is a command line port of the game Wordle in Rust. I built this in order to get more familiar with programming in

Brock Herion 5 Apr 8, 2022
A Rust port of the command line program playing with the cutscenes files (USM) from Genshin Impact.

GI-cutscenes : Rust Remix A command line program playing with the cutscene files (USM) from Genshin Impact, reimplemented in Rust. Much like its origi

Lymkwi 5 Nov 6, 2022
Rust port of https://github.com/hunar4321/life_code with some fun features.

Smarticles A Rust port of Brainxyz's Artificial Life simulator with some fun features. A simple program to simulate primitive Artificial Life using si

Chevy Ray Johnston 15 Dec 24, 2022
png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance.

png_defringe_rs png_defringe_rs is a port of Immorpher's PNG Defringe program written in Rust to achieve easier installation and faster performance. U

null 2 Nov 17, 2022
`ggllama` is a Rust port of ggerganov's llama.cpp.

Notice llama-rs beat me to the punch. I'll be contributing to that instead. The original README is preserved below. ggllama ggllama is a Rust port of

Philpax 6 Mar 15, 2023
A command-line tool to easily kill processes running on a specified port.

killport killport is a command-line utility for killing processes listening on specific ports. It's designed to be simple, fast, and effective. The to

Francisco Jiménez Cabrera 6 Mar 29, 2023