这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@alibkaba
Copy link

@alibkaba alibkaba commented Jan 7, 2018

I made quite a few changes to this script by merging it with my own version. I'm all hears for suggestions and my feelings won't get hurt if it gets rejected. I've learned a lot from the original script written by folks here. @5aru @linted

I don't need this to be merged in yesterday. Please, take your time to review it and test. I'll be doing the same while I prepare for my OSCP exam I have in 2 weeks.

Edit: I definitely want some feedback on how it's coded.

I made quiet a few changes to this script by merging it with my own version.  I'm all hears for suggestions and my feelings wont get hurt if it gets rejected.  I've learned a lot from the original script written folks here.
@Whurbin
Copy link
Collaborator

Whurbin commented Jan 8, 2018

Hey @alibkaba, I like what you've done. You definitely put in a bit of work.

I've downloaded the patch and have run it on a VM just to make sure that everything works fine. I've also stepped through the code to review the changes.

There is one change that I am a little concerned about and another that is mostly preference.

Concern
You've added a cleanUP function to try and clear logs on the system. This sounds nice, but the problem is that in any engagement, you want to try and maintain as much opsec as you can. By using this script and putting it on the system in the first place, you are already breaching opsec and have to make sure to clean this file off of the system. By automatically trying to delete these logs, you run the risk of alerting administrators, setting off IDS/IPS or FIMS and ruining lots of data that could be useful to you as well as the administrators.

On a note, if I noticed that logs were missing out of my own systems. I would immediately triage my system and start looking at the network to see if I could find out what happened.

Preference
I enjoy the colors that you've added and how you've modified some of the formatting. In "Related Shell Escape Sequences" though, it jumps a lot when working through the section(s). If that could be consolidated into one solid section for both organization and appearance, that'd be preferred.

When we originally ported this script over, we did it in such a way that we would keep the formatting of the old privilege escalation checking script that is so well known in the pentesting community, but I like what you've done with the appearance.

Let me know what you think.

@Whurbin Whurbin self-assigned this Jan 8, 2018

echo -e "\n[+] Installed Tools"
formatCommand "which awk perl python ruby gcc cc vi vim nmap find netcat nc wget tftp ftp 2>/dev/null"
systemNAME="Clearing /var/log/auth.log";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have to agree with @5aru. Simply wiping those files away is probably not the best way of cleaning up. If you can think up a good way to do a regex to filter out only the logs this script creates, that would be ideal. Otherwise we should leave log cleaning up to the person running the script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I totally agree with this. I added this function in the early stages of my pen testing experience (and off a book).

echo -ne "awk-->\tawk 'BEGIN {system(\"/bin/bash\")}'\n" | sed 's|^| |'
fi
systemNAME="Setting history max lines to 0";
cmdRESPONSE "export HISTFILESIZE=0";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably not the best Idea to clear the history. I know that personally if I logged into one of my boxes and there was no history, I would start to be suspicious of what could have happened. In my opinion you should remove everything in the cleanup except for lines 260 and 261 which should move to the beginning somewhere. Also the exports that you are doing here are probably useless unless people are sourcing this file. feel free to argue your point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also agree.

@alibkaba
Copy link
Author

alibkaba commented Jan 8, 2018

@5aru @linted Thanks for the feedback.
I've never made changes to a Pull Request, so bear with me while I figure it out and sorry ahead of time for creating duplicate PR.

I still need to work on line 212 and 222...228
@alibkaba
Copy link
Author

alibkaba commented Jan 8, 2018

I got a question @5aru @linted.
When you guys write your script, do you think about the compatibility between newer and older bash versions?

I'm worry that these might not work on older bash version and I tried to look for the manual but I only see the latest one.
line 72 ${PIPESTATUS[0]}, line 75 ${cmdRESULT:(-1)}, line 77/80 ${cmdRESULT%?}.
https://www.gnu.org/software/bash/manual/

Comments, suggestions would be appreciated.

@Whurbin
Copy link
Collaborator

Whurbin commented Jan 10, 2018

@alibkaba, I really haven't looked into that, but how about we put that into another pull request instead of this one. They are definitely different issues.

I'm going to approve this pull request...

Thanks for all the work.

@Whurbin Whurbin merged commit d8fd48f into linted:master Jan 10, 2018
@alibkaba
Copy link
Author

Okay @5aru . I just discovered what Travis does and learning it at work, so my code might get a little better.
Just to be safe, could we revert back to the old version so that I further test my code.
Thanks for the feedbacks and all.

@Whurbin
Copy link
Collaborator

Whurbin commented Jan 10, 2018

@alibkaba, I've reverted the old pull request per your request.

@alibkaba
Copy link
Author

Thanks @5aru , I just want to make sure I thoroughly test the my crappy code.
Thanks!

@alibkaba
Copy link
Author

alibkaba commented Jan 11, 2018

@5aru @linted I gotta say, I wish I knew Travis CI years ago...I've been doing everything manually and it has been time consuming.
Anyway, I'll update everyone once I'm done or need help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants