Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from GyulyVGC:main #17

Merged
merged 6 commits into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
A big shout-out to all the contributors of Sniffnet ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="10%"><a href="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/Crirock"><img src="https://avatars.githubusercontent.com/u/101053125?v=4?s=60" width="60px;" alt="Cristiano"/><br /><sub><b>Cristiano</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=Crirock" title="Code">💻</a> <a href="#ideas-Crirock" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="10%"><a href="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/acolombier"><img src="https://avatars.githubusercontent.com/u/7086688?v=4?s=60" width="60px;" alt="Antoine Colombier"/><br /><sub><b>Antoine Colombier</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=acolombier" title="Tests">⚠️</a> <a href="#translation-acolombier" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/colin99d"><img src="https://avatars.githubusercontent.com/u/72827203?v=4?s=60" width="60px;" alt="Colin Delahunty"/><br /><sub><b>Colin Delahunty</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=colin99d" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="10%"><a href="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/AmadeusGraves"><img src="https://avatars.githubusercontent.com/u/18572939?v=4?s=60" width="60px;" alt="AmadeusGraves"/><br /><sub><b>AmadeusGraves</b></sub></a><br /><a href="#translation-AmadeusGraves" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/Charpy"><img src="https://avatars.githubusercontent.com/u/4827568?v=4?s=60" width="60px;" alt="Charpy"/><br /><sub><b>Charpy</b></sub></a><br /><a href="#translation-Charpy" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/Kiruyuto"><img src="https://avatars.githubusercontent.com/u/80201134?v=4?s=60" width="60px;" alt="Hubert"/><br /><sub><b>Hubert</b></sub></a><br /><a href="#translation-Kiruyuto" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/luca3s"><img src="https://avatars.githubusercontent.com/u/41015240?v=4?s=60" width="60px;" alt="luca3s"/><br /><sub><b>luca3s</b></sub></a><br /><a href="#translation-luca3s" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/cxw620"><img src="https://avatars.githubusercontent.com/u/70561268?v=4?s=60" width="60px;" alt="陈寒彤"/><br /><sub><b>陈寒彤</b></sub></a><br /><a href="#translation-cxw620" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="http:https://catchts.com"><img src="https://avatars.githubusercontent.com/u/16646733?v=4?s=60" width="60px;" alt="yossarian"/><br /><sub><b>yossarian</b></sub></a><br /><a href="#translation-captain-yossarian" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/ervinpopescu"><img src="https://avatars.githubusercontent.com/u/84532402?v=4?s=60" width="60px;" alt="ervinpopescu"/><br /><sub><b>ervinpopescu</b></sub></a><br /><a href="#translation-ervinpopescu" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pcap = "1.0.0"
etherparse = "0.13.0"
chrono = { version = "0.4.24", default_features = false, features = ["clock"] }
thousands = "0.2.0"
indexmap = "1.9.2"
indexmap = "1.9.3"
plotters = { version = "0.3.4", default_features = false, features = ["area_series"] }
iced = { version = "0.8.0", features = ["tokio", "image"] }
iced_native = "0.9.1"
Expand Down
31 changes: 1 addition & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,36 +297,7 @@ Sniffnet is also open to design contributions: <br>

- A special mention goes to [Tiansheng Li](https://github.com/0x0177b11f) for being [my first sponsor](https://github.com/sponsors/GyulyVGC) ever!

- A big shout-out to [all the contributors](https://github.com/GyulyVGC/sniffnet/graphs/contributors) of Sniffnet ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<div align="center">

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="10%"><a href="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/Crirock"><img src="https://avatars.githubusercontent.com/u/101053125?v=4?s=60" width="60px;" alt="Cristiano"/><br /><sub><b>Cristiano</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=Crirock" title="Code">💻</a> <a href="#ideas-Crirock" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="10%"><a href="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/acolombier"><img src="https://avatars.githubusercontent.com/u/7086688?v=4?s=60" width="60px;" alt="Antoine Colombier"/><br /><sub><b>Antoine Colombier</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=acolombier" title="Tests">⚠️</a> <a href="#translation-acolombier" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/colin99d"><img src="https://avatars.githubusercontent.com/u/72827203?v=4?s=60" width="60px;" alt="Colin Delahunty"/><br /><sub><b>Colin Delahunty</b></sub></a><br /><a href="https://github.com/GyulyVGC/sniffnet/commits?author=colin99d" title="Tests">⚠️</a></td>
<td align="center" valign="top" width="10%"><a href="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/AmadeusGraves"><img src="https://avatars.githubusercontent.com/u/18572939?v=4?s=60" width="60px;" alt="AmadeusGraves"/><br /><sub><b>AmadeusGraves</b></sub></a><br /><a href="#translation-AmadeusGraves" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/Charpy"><img src="https://avatars.githubusercontent.com/u/4827568?v=4?s=60" width="60px;" alt="Charpy"/><br /><sub><b>Charpy</b></sub></a><br /><a href="#translation-Charpy" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/Kiruyuto"><img src="https://avatars.githubusercontent.com/u/80201134?v=4?s=60" width="60px;" alt="Hubert"/><br /><sub><b>Hubert</b></sub></a><br /><a href="#translation-Kiruyuto" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/luca3s"><img src="https://avatars.githubusercontent.com/u/41015240?v=4?s=60" width="60px;" alt="luca3s"/><br /><sub><b>luca3s</b></sub></a><br /><a href="#translation-luca3s" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/cxw620"><img src="https://avatars.githubusercontent.com/u/70561268?v=4?s=60" width="60px;" alt="陈寒彤"/><br /><sub><b>陈寒彤</b></sub></a><br /><a href="#translation-cxw620" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="http:https://catchts.com"><img src="https://avatars.githubusercontent.com/u/16646733?v=4?s=60" width="60px;" alt="yossarian"/><br /><sub><b>yossarian</b></sub></a><br /><a href="#translation-captain-yossarian" title="Translation">🌍</a></td>
<td align="center" valign="top" width="10%"><a href="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/ervinpopescu"><img src="https://avatars.githubusercontent.com/u/84532402?v=4?s=60" width="60px;" alt="ervinpopescu"/><br /><sub><b>ervinpopescu</b></sub></a><br /><a href="#translation-ervinpopescu" title="Translation">🌍</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

</div>
- A big shout-out to [all the contributors](https://github.com/GyulyVGC/sniffnet/blob/main/CONTRIBUTORS.md) of Sniffnet!

- The graphical user interface has been realized with [iced](https://github.com/iced-rs/iced), a cross-platform GUI library for Rust focused on simplicity and type-safety

Expand Down
1 change: 1 addition & 0 deletions resources/fonts/full/subset_characters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ z
ї
Expand Down
Binary file modified resources/fonts/subset/sarasa-mono-sc-bold.subset.ttf
Binary file not shown.
Binary file modified resources/fonts/subset/sarasa-mono-sc-regular.subset.ttf
Binary file not shown.
29 changes: 17 additions & 12 deletions src/gui/components/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,36 @@ use crate::enums::message::Message;
use crate::enums::style_type::StyleType;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::get_formatted_strings::APP_VERSION;
use crate::utility::style_constants::{
get_font, get_font_headers, FONT_SIZE_FOOTER, HEIGHT_FOOTER, ICONS,
};
use crate::utility::style_constants::{get_font, get_font_headers, FONT_SIZE_FOOTER, ICONS};
use iced::alignment::{Horizontal, Vertical};
use iced::widget::{button, Container, Row, Text, Tooltip};
use iced::Length::FillPortion;
use iced::{Alignment, Length};
use iced_native::widget::horizontal_space;
use iced_native::widget::tooltip::Position;

pub fn footer(style: StyleType) -> Container<'static, Message> {
let font = get_font(style);
let font_footer = get_font_headers(style);

let footer_row = Row::new()
.width(Length::Fill)
.padding([0, 20])
.align_items(Alignment::Center)
.push(
Text::new(format!("Sniffnet v{APP_VERSION} - by Giuliano Bellini "))
Text::new(format!("Version {APP_VERSION} "))
.size(FONT_SIZE_FOOTER)
.font(font_footer),
)
.push(horizontal_space(Length::FillPortion(1)))
.push(get_button_github(style))
.push(Text::new(" ").font(font));
.push(horizontal_space(Length::FillPortion(1)))
.push(
Text::new("Made with ❤ by Giuliano Bellini")
.size(FONT_SIZE_FOOTER)
.font(font_footer),
);

Container::new(footer_row)
.height(FillPortion(HEIGHT_FOOTER))
.height(Length::Fixed(45.0))
.width(Length::Fill)
.align_y(Vertical::Center)
.align_x(Horizontal::Center)
Expand All @@ -42,16 +47,16 @@ pub fn get_button_github(style: StyleType) -> Tooltip<'static, Message> {
let content = button(
Text::new('H'.to_string())
.font(ICONS)
.size(24)
.size(28)
.horizontal_alignment(Horizontal::Center)
.vertical_alignment(Vertical::Center),
)
.height(Length::Fixed(35.0))
.width(Length::Fixed(35.0))
.height(Length::Fixed(40.0))
.width(Length::Fixed(40.0))
.style(StyleTuple(style, ElementType::Standard).into())
.on_press(Message::OpenGithub);

Tooltip::new(content, "GitHub", Position::Right)
Tooltip::new(content, "GitHub", Position::Top)
.font(get_font(style))
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(style, ElementType::Tooltip),
Expand Down
6 changes: 3 additions & 3 deletions src/gui/components/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::enums::element_type::ElementType;
use crate::enums::message::Message;
use crate::enums::settings_page::SettingsPage;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::style_constants::{get_font, HEIGHT_HEADER, ICONS};
use crate::utility::style_constants::{get_font, ICONS};
use crate::utility::translations::{quit_analysis_translation, settings_translation};
use crate::{Language, StyleType};
use iced::alignment::{Horizontal, Vertical};
Expand All @@ -22,7 +22,7 @@ pub fn header(
let logo = Text::new('A'.to_string())
.font(ICONS)
.horizontal_alignment(Horizontal::Center)
.size(95);
.size(100);

Container::new(
Row::new()
Expand Down Expand Up @@ -57,7 +57,7 @@ pub fn header(
)
.push(horizontal_space(Length::Fixed(15.0))),
)
.height(FillPortion(HEIGHT_HEADER))
.height(Length::Fixed(95.0))
.align_y(Vertical::Center)
.width(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
Expand Down
15 changes: 7 additions & 8 deletions src/gui/pages/initial_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use crate::enums::message::Message;
use crate::gui::components::radio::{ip_version_radios, transport_protocol_radios};
use crate::structs::sniffer::Sniffer;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::style_constants::{
get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, HEIGHT_BODY, ICONS,
};
use crate::utility::style_constants::{get_font, FONT_SIZE_SUBTITLE, FONT_SIZE_TITLE, ICONS};
use crate::utility::translations::{
address_translation, addresses_translation, all_translation, application_protocol_translation,
choose_adapters_translation, select_filters_translation, start_translation,
Expand Down Expand Up @@ -103,11 +101,12 @@ pub fn initial_page(sniffer: &Sniffer) -> Container<Message> {
.push(filters),
);

Container::new(body)
.height(FillPortion(HEIGHT_BODY))
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Container::new(body).height(Length::Fill).style(
<StyleTuple as Into<iced::theme::Container>>::into(StyleTuple(
sniffer.style,
ElementType::Standard,
)),
)
}

pub fn button_start(style: StyleType, language: Language) -> Tooltip<'static, Message> {
Expand Down
6 changes: 3 additions & 3 deletions src/gui/pages/notifications_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::gui::components::tab::get_pages_tabs;
use crate::structs::style_tuple::StyleTuple;
use crate::utility::countries::get_flag_from_country_code;
use crate::utility::get_formatted_strings::get_formatted_bytes_string;
use crate::utility::style_constants::{get_font, FONT_SIZE_FOOTER, HEIGHT_BODY, ICONS};
use crate::utility::style_constants::{get_font, FONT_SIZE_FOOTER, ICONS};
use crate::utility::translations::{
application_protocol_translation, bytes_exceeded_translation, bytes_exceeded_value_translation,
clear_all_translation, favorite_transmitted_translation, incoming_translation,
Expand Down Expand Up @@ -40,7 +40,7 @@ pub fn notifications_page(sniffer: &Sniffer) -> Container<Message> {

let mut tab_and_body = Column::new()
.align_items(Alignment::Center)
.height(FillPortion(HEIGHT_BODY));
.height(Length::Fill);

let tabs = get_pages_tabs(
[
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn notifications_page(sniffer: &Sniffer) -> Container<Message> {
}

Container::new(Column::new().push(tab_and_body))
.height(FillPortion(HEIGHT_BODY))
.height(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Expand Down
12 changes: 6 additions & 6 deletions src/gui/pages/overview_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::utility::get_formatted_strings::{
get_active_filters_string, get_active_filters_string_nobr, get_app_count_string,
get_connection_color, get_formatted_bytes_string, get_percentage_string, get_report_path,
};
use crate::utility::style_constants::{get_font, HEIGHT_BODY, ICONS, SARASA_MONO_SC_BOLD};
use crate::utility::style_constants::{get_font, ICONS, SARASA_MONO_SC_BOLD};
use crate::utility::translations::{
error_translation, filtered_application_translation, filtered_bytes_translation,
filtered_packets_translation, no_addresses_translation, no_favorites_translation,
Expand All @@ -37,11 +37,11 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {

let mut body = Column::new()
.width(Length::Fill)
.padding(5)
.spacing(5)
.padding(10)
.spacing(10)
.align_items(Alignment::Center);

let mut tab_and_body = Column::new().height(FillPortion(HEIGHT_BODY));
let mut tab_and_body = Column::new().height(Length::Fill);

if sniffer.pcap_error.is_none() {
// NO pcap error detected
Expand Down Expand Up @@ -309,7 +309,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
body = body
.push(
Row::new()
.spacing(5)
.spacing(10)
.height(FillPortion(3))
.push(col_chart)
.push(
Expand Down Expand Up @@ -380,7 +380,7 @@ pub fn overview_page(sniffer: &Sniffer) -> Container<Message> {
}

Container::new(Column::new().push(tab_and_body.push(body)))
.height(FillPortion(HEIGHT_BODY))
.height(Length::Fill)
.style(<StyleTuple as Into<iced::theme::Container>>::into(
StyleTuple(sniffer.style, ElementType::Standard),
))
Expand Down
8 changes: 3 additions & 5 deletions src/gui/styles/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ impl button::StyleSheet for StyleTuple {
let colors = get_colors(self.0);
button::Appearance {
background: Some(Background::Color(match self {
StyleTuple(
_,
ElementType::TabActive | ElementType::NotStarred | ElementType::BorderedRound,
) => colors.primary,
StyleTuple(_, ElementType::TabActive | ElementType::NotStarred) => colors.primary,
StyleTuple(_, ElementType::Starred) => STARRED,
StyleTuple(_, ElementType::Badge) => colors.secondary,
StyleTuple(_, ElementType::BorderedRound) => colors.round_containers,
_ => colors.buttons,
})),
border_radius: match self {
Expand All @@ -53,7 +51,7 @@ impl button::StyleSheet for StyleTuple {
},
border_color: match self {
StyleTuple(_, ElementType::Alert) => Color::new(1.0, 0.0, 0.0, 1.0),
StyleTuple(_, ElementType::BorderedRound) => Color::BLACK,
StyleTuple(_, ElementType::BorderedRound) => colors.round_borders,
_ => colors.secondary,
},
}
Expand Down
4 changes: 3 additions & 1 deletion src/gui/styles/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl iced::widget::container::StyleSheet for StyleTuple {
background: Some(Background::Color(match self {
StyleTuple(_, ElementType::Headers) => colors.secondary,
StyleTuple(_, ElementType::Tooltip) => colors.buttons,
StyleTuple(_, ElementType::BorderedRound) => colors.round_containers,
_ => colors.primary,
})),
border_radius: match self {
Expand All @@ -38,7 +39,8 @@ impl iced::widget::container::StyleSheet for StyleTuple {
},
border_width: match self {
StyleTuple(_, ElementType::Standard | ElementType::Headers) => 0.0,
StyleTuple(_, ElementType::Tooltip) => 1.0,
StyleTuple(_, ElementType::Tooltip) => BORDER_WIDTH / 2.0,
StyleTuple(_, ElementType::BorderedRound) => BORDER_WIDTH * 2.0,
_ => BORDER_WIDTH,
},
border_color: match self {
Expand Down
Loading