-
Notifications
You must be signed in to change notification settings - Fork 800
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
Features and recommendation suggestions #47
Comments
The first two suggestions are optional flags inspired by AutoRecon -ct and -cs, btw |
I guess all are good ideas. To allow simultaneous scans we will need to make some big changes, so it's better to delay this until all other features are well implemented. Not sure how easy it would be to implement profiles, but also an interesting feature to consider once the script grows more. |
Yes, of course. Until the current pull requests are merged and also the ones I plan to do afterwards (but slower) for refactoring the code a bit more, I won't start developing any of the other suggestions 🙂 |
I added a license and contributing guidelines files. |
One of the recommendations I also wanted to made (but forgot), is to ask the user at the beginning of the script if they want to run it as root (warning if some of the selected flags require it, and speed limitation of Connect Scan vs SYN Stealth):
|
yeah i've implemented something like this in another script, but since in this case the only place where we need sudo is with UDP, i didn't want to run the entire script as root, as this is always a risk. I want to keep it limited to that UDP place, as in some scans users may not have root access 'i.e. lateral movement'. perhaps the best option is to ask whether they need to run UDP as sudo, and skip if they don't, so that it doesn't hang the scan. |
100% agree, that's why I suggested to ask the user at the beginning as I had in mind something more elaborate like dropping privileges for scans where definitively running as |
yeah that makes sense. we should give the option to run nmap as root if possible. for lateral movement users may not be able to use sudo at all, so probably if the user chooses to run as root, add |
This should do it: if [ $EUID -ne 0 ]; then
echo -e "${RED}For faster nmap scans, we recommend running nmap commands with sudo..${NC}"
echo -e "${Yellow}Run with sudo? yes/no${NC}"
read -t 10 runSudo
if [ "$runSudo" == "yes" ]; then
nmapType="sudo ${nmapType}"
fi
fi |
i'll make it POSIX and add this |
This is POSIX compatible: if [ "$(id -u)" -ne 0 ]; then
printf "\n${Yellow}For faster nmap scans, we recommend running nmap commands with sudo..${NC}\n"
printf "${Yellow}Run with sudo? yes/no${NC}\n"
runSudo="$(sh -c '{ { sleep 1; kill -sINT $$; } & }; exec head -n 1')"
if [ "${runSudo}" = "yes" ]; then
nmapType="sudo ${nmapType}"
fi
fi It can be added to the end of the But it is not timed, so it needs to be wrapped in a while loop. |
If the file already exists (ie: it was |
Yeah I guess that's a simpler solution. I'll add it and test that it doesn't cause any issues. |
I've been thinking about trying to substitute |
Yeah you are right. Even a minimal Ubuntu image doesn't have sudo. Perhaps But we need to ensure it doesn't ask for passwords every time, or it will hang the script. Perhaps switch user then exit before recon, but that doesn't seem very practical. |
For lateral movement what I meant with the
To prevent making the logic of the code complex or repeating the same, a simple variable will do the trick: ...
[ -n "${nonRootUser}" ] && userRun="sudo -u ${nonRootUser}"
...
${userRun} ffuf .. # Maybe this needs to wrapped in an `eval` to work
... |
I'll research about how to do it cleanly 🙂 |
Yeah that logic makes sense. We should ensure that all output files are owned by the user and not root. Excellent, thanks :) |
Anyways, replacing
|
Wow that's an amazing list of features :) i'll start working on adding a network scanning mode, enabling specifying nmapDirectory, and then replacing port/host scan with POSIX commands when nmap is not available. Perhaps after that even look to replace some recon commands with POSIX when not available. No rush for anything though, you can work at your own pace :) |
I'll try to do the first 2 tomorrow, as sometimes I have broken shells that don't like colors 😉 |
Btw, it would be nice to have some sort of small guide in the README (2, 3 lines) showing the commands to run for creating a static build of |
yeah.. i think if the no color flag is set, changing the colors at the beginning to "" should stop nmapAutomator colors. |
oh yeah i'll definitely add that once the script accepts --nmap-dir.. |
Yes, this is the idea.
POSIX Regarding the output of other tools, I don't think we can do anything about it, if the user doesn't like it (and they don't have any flags for changing the color output) they can always use the (future) |
Didn't know about it! Thanks for the tip 🎉 |
Excellent! I agree regarding the colors. I just pushed the network hosts scan, and the static nmap flag. |
Is there any way for providing the scripts separately and use a flag to tell |
If it is possible to use custom scripts it should be possible. Perhaps later I'll look into it and check which scripts are being used, so nmapAutomator can put them in an archive to be transferred to the remote machine on the same nmappath, and if it finds the archive it'll extract the scripts and use them. Currently the vulbs scan when used with a static binary simply outputs nothing, so the fix is not urgent. |
I don't think you can expect to find the scripts in the same path in every system (and I'm not sure there's a portable way of finding them without using find in the root folder), so the easiest thing to do is to maybe leave that to the user (the packaging and sending of the script folder), and make |
Yeah I guess that's probably better. I was mainly thinking to utilize the dirs nmap looks in. |
Well, if |
initial implementation of Remote Mode pushed as well.. |
Perfect, I'll start refactoring later in the day 🙂 |
I remembered why I didn't use --open initially.. it was because I was grepping for 'open' in the nmap output file, and as this is in the command it would be grpped as well. Anyway, now it only affects one place 'recon', and it doesn't cause any issues. |
Glad to know I didn't break anything 😅 Btw, I'm going to be quite busy with a personal matter for around a month and I don't think I'll be able to contribute until then, unfortunately 🙁 The most urgent things to fix (that are breaking the POSIX compatibility) are:
Other compatibility issues come from:
And I think that's it to regain the POSIX and compatibility for all systems 🏆 Note that the changes I mentioned above shall be done in more than one place (other than the linked ones) 🙂 |
Thanks for the notes and for the contributions. I'll work on fixing these and adding other features. Wish you all the best |
Btw, this is not goodbye, I seriously want to finish what I promised above when I am truly able to return, after all I use this tool in my assessments (and have a list of things to refactor, improve, and add), just wait a bit (as the people's-problems I am currently facing take longer to solve than software's) and keep me updated (here or in other issue) if you face some difficulties/dilemmas when adding more features 🙂 Keep up the good work! 🥇 |
Yeah sure.. thanks for all the efforts, and I'll try to keep pushing features and fixes 😄 |
I've been checking AutoRecon, and there are some neat features (and other recommendations that occurred to me) that could be added to
nmapAutomator
:nmap
instance (simultaneously) for every target (using the shell's background task functionality&
), though the logic of the code will need to change in order to prevent mixing the output of all the nmap instances-q/--quiet
flag (and maybe another one only showing the progress-bar with the current scan, maybe-q
shows the progress and-qq
or-Q
nothing), in case the user only wants to check the final file or folder with all the results-oG
, greppable format is useful and may be parsed by different scripts)--color
,--no-color
)README
that this script does not perform automatic exploitation, it is just an efficient wrapper of some enumeration tools, so that it can be used in the OSCP exam (and others with similar restrictions)The text was updated successfully, but these errors were encountered: