Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Chleba authored Oct 18, 2024
2 parents c69eaa9 + e877479 commit f76a87b
Show file tree
Hide file tree
Showing 17 changed files with 607 additions and 127 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
debug/
target/

demo.tape

# These are backup files generated by rustfmt
**/*.rs.bk

Expand Down
88 changes: 86 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "netscanner"
version = "0.5.4"
version = "0.6.0"
edition = "2021"
description = "Network Scanner"
license = "MIT"
Expand Down Expand Up @@ -90,7 +90,7 @@ tracing = "0.1.40"
tracing-error = "0.2.0"
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "serde"] }
tui-input = { version = "0.10.1", features = ["serde"] }

tui-scrollview = "0.4.0"

[target.'cfg(target_os = "windows")'.build-dependencies]
anyhow = "1.0.86"
Expand All @@ -100,5 +100,3 @@ clap = { version = "4.5.13", features = ["derive"] }
clap-verbosity-flag = "2.2.1"
clap_complete = "4.5.12"
clap_mangen = "0.2.23"


4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<img src='./demo.gif' width='550px'/>

[![Arch package](https://repology.org/badge/version-for-repo/arch/netscanner.svg)](https://repology.org/project/netscanner/versions)
[![Alpine Linux Edge package](https://repology.org/badge/version-for-repo/alpine_edge/netscanner.svg)](https://repology.org/project/netscanner/versions)
[![nixpkgs stable 24.05 package](https://repology.org/badge/version-for-repo/nix_stable_24_05/netscanner.svg)](https://repology.org/project/netscanner/versions)
[![nixpkgs unstable package](https://repology.org/badge/version-for-repo/nix_unstable/netscanner.svg)](https://repology.org/project/netscanner/versions)
[![Manjaro Stable package](https://repology.org/badge/version-for-repo/manjaro_stable/netscanner.svg)](https://repology.org/project/netscanner/versions)
[![Kali Linux Rolling package](https://repology.org/badge/version-for-repo/kali_rolling/netscanner.svg)](https://repology.org/project/netscanner/versions)

Expand All @@ -29,6 +28,7 @@
- [x] scanning open ports (TCP)
- [x] packet logs filter
- [x] export scanned ips, ports, packets into csv
- [x] traffic counting + DNS records

**TODO:**
- [ ] ipv6 scanning & dumping
Expand Down
Binary file modified demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions demo.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Output demo.gif

Set FontSize 11
Set Width 800
Set Height 600

Type "netscanner"
Enter
Sleep 800ms

Type "s"
Sleep 1s

Type "2"
Sleep 3s
Type "g"
Sleep 1s

Type "3"

Type "s"
Sleep 1s

Down
Type "s"
Sleep 1s

Down
Type "s"
Sleep 1s

Type "4"
Sleep 4

4 changes: 3 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
wifi_chart::WifiChart,
wifi_interface::WifiInterface,
wifi_scan::WifiScan,
// sniff
sniff::Sniffer,
Component,
},
config::Config,
Expand Down Expand Up @@ -52,6 +52,7 @@ impl App {
let discovery = Discovery::default();
let packetdump = PacketDump::default();
let ports = Ports::default();
let sniff = Sniffer::default();
let export = Export::default();
let config = Config::new()?;

Expand All @@ -71,6 +72,7 @@ impl App {
Box::new(discovery),
Box::new(packetdump),
Box::new(ports),
Box::new(sniff),
Box::new(export),
],
should_quit: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/packetdump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ impl PacketDump {
source_port: udp.get_source(),
destination,
destination_port: udp.get_destination(),
length: udp.get_length(),
length: udp.get_length() as usize,
raw_str,
}),
PacketTypeEnum::Udp,
Expand Down
7 changes: 5 additions & 2 deletions src/components/ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use core::str;
use port_desc::{PortDescription, TransportProtocol};
use ratatui::{prelude::*, widgets::*};
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::usize;
use std::{string, time::Duration};
use tokio::{
net::TcpStream,
Expand Down Expand Up @@ -155,6 +154,10 @@ impl Ports {
}

fn scan_ports(&mut self, index: usize) {
if index >= self.ip_ports.len() {
return; // -- index out of bounds
}

self.ip_ports[index].state = PortsScanState::Scanning;

let tx = self.action_tx.clone().unwrap();
Expand Down Expand Up @@ -198,7 +201,7 @@ impl Ports {
for ip in &self.ip_ports {
let mut lines = Vec::new();

let ip_line = Line::from(vec!["IP: ".yellow(), ip.ip.clone().blue()]);
let ip_line = Line::from(vec!["IP: ".yellow(), ip.ip.clone().cyan()]);
lines.push(ip_line);

let mut ports_spans = vec!["PORTS: ".yellow()];
Expand Down
Loading

0 comments on commit f76a87b

Please sign in to comment.