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

Tweak dhcp-discover subcommand #1562

Merged
merged 8 commits into from May 22, 2023
17 changes: 12 additions & 5 deletions deploy.sh
Expand Up @@ -42,11 +42,18 @@ for dir in "${path[@]}"; do
ls -1"
)"

# Only try to create the subdir if does not already exist
if [[ "${dir_content[*]}" =~ "${dir}" ]]; then
echo "Dir: ${old_path}/${dir} already exists"
else
echo "Creating dir: ${old_path}/${dir}"
# Loop over the dir content and check if this exact dir already exists
path_exists=0
for content in "${dir_content[@]}"; do
if [[ "${content}" == "${dir}" ]]; then
echo "Dir: ${old_path}/${dir} already exists"
path_exists=1
fi
done

# If the dir does not exist, create it
if [[ "${path_exists}" -eq 0 ]]; then
echo "Dir: ${old_path}/${dir} does not exist. Creating it."
sftp -b - "${USER}"@"${HOST}" <<< "cd ${old_path}
-mkdir ${dir}"
fi
Expand Down
3 changes: 2 additions & 1 deletion src/syscalls/sendto.c
Expand Up @@ -34,7 +34,8 @@ ssize_t FTLsendto(int sockfd, void *buf, size_t len, int flags, const struct soc

// Final error checking (may have failed for some other reason then an
// EINTR = interrupted system call), also ignore EPROTONOSUPPORT (ARP scanning)
if(ret < 0 && errno != EPROTONOSUPPORT)
// and EPERM + ENOKEY (DHCP probing)
if(ret < 0 && errno != EPROTONOSUPPORT && errno != EPERM && errno != ENOKEY)
logg("WARN: Could not sendto() in %s() (%s:%i): %s",
func, file, line, strerror(errno));

Expand Down
12 changes: 12 additions & 0 deletions src/tools/arp-scan.c
Expand Up @@ -632,6 +632,18 @@ int run_arp_scan(const bool scan_all, const bool extreme_mode)
// Create a thread for interfaces of type AF_INET
if(tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_INET)
{
// Skip interface scan if ...
// - interface is not up
// - ARP is not supported
// - interface is loopback net
if(!(tmp->ifa_flags & IFF_UP) ||
(tmp->ifa_flags & IFF_NOARP) ||
(tmp->ifa_flags & IFF_LOOPBACK))
{
tmp = tmp->ifa_next;
continue;
}

thread_data[tid].ifa = tmp;
strncpy(thread_data[tid].iface, tmp->ifa_name, sizeof(thread_data[tid].iface) - 1);

Expand Down