myrustscan/
tui.rs

1//! Utilities for terminal output during scanning.
2
3/// Terminal User Interface Module for RustScan
4/// Defines macros to use
5#[macro_export]
6macro_rules! warning {
7    ($name:expr) => {
8        println!("{} {}", ansi_term::Colour::Red.bold().paint("[!]"), $name);
9    };
10    ($name:expr, $greppable:expr, $accessible:expr) => {
11        // if not greppable then print, otherwise no else statement so do not print.
12        if !$greppable {
13            if $accessible {
14                // Don't print the ascii art
15                println!("{}", $name);
16            } else {
17                println!("{} {}", ansi_term::Colour::Red.bold().paint("[!]"), $name);
18            }
19        }
20    };
21}
22
23#[macro_export]
24macro_rules! detail {
25    ($name:expr) => {
26        println!("{} {}", ansi_term::Colour::Blue.bold().paint("[~]"), $name);
27    };
28    ($name:expr, $greppable:expr, $accessible:expr) => {
29        // if not greppable then print, otherwise no else statement so do not print.
30        if !$greppable {
31            if $accessible {
32                // Don't print the ascii art
33                println!("{}", $name);
34            } else {
35                println!("{} {}", ansi_term::Colour::Blue.bold().paint("[~]"), $name);
36            }
37        }
38    };
39}
40
41#[macro_export]
42macro_rules! output {
43    ($name:expr) => {
44        println!(
45            "{} {}",
46            RGansi_term::Colour::RGB(0, 255, 9).bold().paint("[>]"),
47            $name
48        );
49    };
50    ($name:expr, $greppable:expr, $accessible:expr) => {
51        // if not greppable then print, otherwise no else statement so do not print.
52        if !$greppable {
53            if $accessible {
54                // Don't print the ascii art
55                println!("{}", $name);
56            } else {
57                println!(
58                    "{} {}",
59                    ansi_term::Colour::RGB(0, 255, 9).bold().paint("[>]"),
60                    $name
61                );
62            }
63        }
64    };
65}
66
67#[macro_export]
68macro_rules! funny_opening {
69    // prints a funny quote / opening
70    () => {
71        use rand::seq::IndexedRandom;
72        let quotes = vec![
73            "Nmap? More like slowmap.🐒",
74            "🌍HACK THE PLANET🌍",
75            "Real hackers hack time βŒ›",
76            "Please contribute more quotes to our GitHub https://github.com/rustscan/rustscan",
77            "😡 https://admin.tryhackme.com",
78            "0day was here β™₯",
79            "I don't always scan ports, but when I do, I prefer RustScan.",
80            "RustScan: Where scanning meets swagging. 😎",
81            "To scan or not to scan? That is the question.",
82            "RustScan: Because guessing isn't hacking.",
83            "Scanning ports like it's my full-time job. Wait, it is.",
84            "Open ports, closed hearts.",
85            "I scanned my computer so many times, it thinks we're dating.",
86            "Port scanning: Making networking exciting since... whenever.",
87            "You miss 100% of the ports you don't scan. - RustScan",
88            "Breaking and entering... into the world of open ports.",
89            "TCP handshake? More like a friendly high-five!",
90            "Scanning ports: The virtual equivalent of knocking on doors.",
91            "RustScan: Making sure 'closed' isn't just a state of mind.",
92            "RustScan: allowing you to send UDP packets into the void 1200x faster than NMAP",
93            "Port scanning: Because every port has a story to tell.",
94            "I scanned ports so fast, even my computer was surprised.",
95            "Scanning ports faster than you can say 'SYN ACK'",
96            "RustScan: Where '404 Not Found' meets '200 OK'.",
97            "RustScan: Exploring the digital landscape, one IP at a time.",
98            "TreadStone was here πŸš€",
99            "With RustScan, I scan ports so fast, even my firewall gets whiplash πŸ’¨",
100            "Scanning ports so fast, even the internet got a speeding ticket!",
101        ];
102        let random_quote = quotes.choose(&mut rand::rng()).unwrap();
103
104        println!("{}\n", random_quote);
105    };
106}