Skip to content

Commit

Permalink
-EA or --enhanced-auth to insert SN and DevID1 in GET request + store…
Browse files Browse the repository at this point in the history
… it if valid.

More to come with DevID2 and random seed. #16
  • Loading branch information
dougy147 committed Sep 29, 2023
1 parent 01c0c88 commit a768de2
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
31 changes: 26 additions & 5 deletions bin/mcbash
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ check_dependencies() {
exit 1
fi
done
opt_dep=("md5sum" "sha256sum") # optional dependencies
opt_dep=("md5sum" "sha256sum" "od") # optional dependencies
for o in ${opt_dep[@]}; do
if ! [[ $(which $o 2>/dev/null) ]]; then
echo -e "${_YELLOW}${_BOLD}WARNING: mcbash could need optional dependency ${_RED}${o}${_YELLOW}. \nConsider installing it on your machine.${_RESET}"
Expand Down Expand Up @@ -434,9 +434,9 @@ generate_mac() {

valid_mac_found() {
if [[ $valid_macs_number == 0 ]]; then
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
write_date_before_mac
fi
echo "$mac [$expiration_date]" >> $destination/valid_macs_$name
write_valid_mac
if [[ -n ${only_outputs_mac} ]]; then
echo $mac
else
Expand All @@ -445,6 +445,26 @@ valid_mac_found() {
valid_macs_number=$(( $valid_macs_number + 1 ))
}

write_date_before_mac() {
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
}

write_valid_mac() {
echo "$mac [$expiration_date]" >> $destination/valid_macs_$name
if [[ -n "${enhanced_auth}" ]]; then
echo -e "\t-> SN: ${sn}" >> $destination/valid_macs_$name
echo -e "\t-> Device_ID1: ${device_id}" >> $destination/valid_macs_$name
fi
}

write_expired_mac() {
echo "$mac [expired]" >> $destination/valid_macs_$name
if [[ -n "${enhanced_auth}" ]]; then
echo -e "\t-> SN: ${sn}" >> $destination/valid_macs_$name
echo -e "\t-> DevID1: ${device_id}" >> $destination/valid_macs_$name
fi
}

check_parameters() {
if [ "$avoid_parameters" = true ]; then
populate_necessary_values
Expand Down Expand Up @@ -920,9 +940,9 @@ get_exp_date() {
echo -ne "\r${_YELLOW}[$item]${_RESET} ${_BOLD}${_RED}$mac [expired] ${_RESET}\n"
fi
if [[ $valid_macs_number == 0 ]]; then
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
write_date_before_mac
fi
echo "$mac [expired]" >> $destination/valid_macs_$name
write_expired_mac
return 1
fi
}
Expand Down Expand Up @@ -989,6 +1009,7 @@ done
# - echo : core/utils
# - md5sum : core/utils
# - sha256sum : core/utils
# - od : core/utils


#
Expand Down
24 changes: 22 additions & 2 deletions func/08_mac
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,33 @@ generate_mac() {

valid_mac_found() {
if [[ $valid_macs_number == 0 ]]; then
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
write_date_before_mac
fi
echo "$mac [$expiration_date]" >> $destination/valid_macs_$name
write_valid_mac
if [[ -n ${only_outputs_mac} ]]; then
echo $mac
else
echo -ne "\r${_BOLD}${_GREEN}[$item] $mac ${_RESET}${_RED}[$expiration_date] ${_RESET}\n"
fi
valid_macs_number=$(( $valid_macs_number + 1 ))
}

write_date_before_mac() {
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
}

write_valid_mac() {
echo "$mac [$expiration_date]" >> $destination/valid_macs_$name
if [[ -n "${enhanced_auth}" ]]; then
echo -e "\t-> SN: ${sn}" >> $destination/valid_macs_$name
echo -e "\t-> Device_ID1: ${device_id}" >> $destination/valid_macs_$name
fi
}

write_expired_mac() {
echo "$mac [expired]" >> $destination/valid_macs_$name
if [[ -n "${enhanced_auth}" ]]; then
echo -e "\t-> SN: ${sn}" >> $destination/valid_macs_$name
echo -e "\t-> DevID1: ${device_id}" >> $destination/valid_macs_$name
fi
}
4 changes: 2 additions & 2 deletions func/11_scan
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ get_exp_date() {
echo -ne "\r${_YELLOW}[$item]${_RESET} ${_BOLD}${_RED}$mac [expired] ${_RESET}\n"
fi
if [[ $valid_macs_number == 0 ]]; then
echo -e "\n$dns ($(date))\n" >> $destination/valid_macs_$name
write_date_before_mac
fi
echo "$mac [expired]" >> $destination/valid_macs_$name
write_expired_mac
return 1
fi
}
Expand Down

0 comments on commit a768de2

Please sign in to comment.