Skip to content

Commit

Permalink
Fix bug when using the -u and -f options at same time.
Browse files Browse the repository at this point in the history
A bad logic condition was causing that Findomain generates a new file for every domain in the list and not just appending they.
  • Loading branch information
Edu4rdSHL committed Oct 2, 2019
1 parent 10e2a5d commit bde877c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/lib.rs
Expand Up @@ -156,6 +156,7 @@ pub fn get_subdomains(
file_name: &str,
unique_output_flag: &str,
monitoring_flag: &str,
from_file_flag: &str,
postgres_connection: &str,
) -> Result<()> {
let discord_webhook = get_vars::get_webhook("discord");
Expand Down Expand Up @@ -263,7 +264,7 @@ pub fn get_subdomains(
&target
);
} else {
if unique_output_flag == "y" && !target.is_empty() && monitoring_flag.is_empty() {
if unique_output_flag == "y" && from_file_flag.is_empty() && monitoring_flag.is_empty() {
check_output_file_exists(file_name)?;
manage_subdomains_data(
subdomains,
Expand All @@ -272,7 +273,10 @@ pub fn get_subdomains(
&with_output,
&file_name,
)?;
} else if unique_output_flag == "y" && target.is_empty() && monitoring_flag.is_empty() {
} else if unique_output_flag == "y"
&& !from_file_flag.is_empty()
&& monitoring_flag.is_empty()
{
manage_subdomains_data(
subdomains,
&target,
Expand Down Expand Up @@ -540,6 +544,7 @@ pub fn read_from_file(
file_name: &str,
unique_output_flag: &str,
monitoring_flag: &str,
from_file_flag: &str,
postgres_connection: &str,
) -> Result<()> {
if unique_output_flag == "y" {
Expand All @@ -561,6 +566,7 @@ pub fn read_from_file(
&file_name,
&unique_output_flag,
&monitoring_flag,
&from_file_flag,
&postgres_connection,
)?;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main.rs
Expand Up @@ -40,7 +40,7 @@ fn run() -> Result<()> {
} else {
""
};

let from_file_flag = if matches.is_present("file") { "y" } else { "" };
let postgres_user =
value_t!(matches, "postgres-user", String).unwrap_or_else(|_| "postgres".to_string());

Expand Down Expand Up @@ -72,6 +72,7 @@ fn run() -> Result<()> {
&file_name,
&unique_output_flag,
&monitoring_flag,
&from_file_flag,
&postgres_connection,
)
} else if matches.is_present("file") {
Expand All @@ -83,6 +84,7 @@ fn run() -> Result<()> {
&file_name,
&unique_output_flag,
&monitoring_flag,
&from_file_flag,
&postgres_connection,
)
} else {
Expand Down

0 comments on commit bde877c

Please sign in to comment.