Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, April 5, 2022

Starting HTB: Hack the Box

Trying to get back into learning mode since I have been away from engineering with the new job for about a year now. My world revolves around schedules and costs, fun but it does leave you a little rusty. I was building kits, now I am responsible for deploying said kits all over. To keep sharp, and have a better understanding when my engineers are explaining things I decided to try out Hack the Box. Next post will be home setup for HacktheBox using Kali Linux.

Wednesday, October 9, 2019

Learning Basic Bash scripting

So I have been working on a new project which requires a lot of repetitive inputs, and me being let's say lazy have been working towards scripting the commands out.   Currently, I have been working mostly with Bash scripting since I can't add any new complexities to the environment.  Basically, work with what's available. 

For one I think that automating or scripting is better overall in creating a standard load.  It might be wrong, but at least all systems will be wrong right?  This way you are taking away the human element which doesn't get me wrong they are trying to follow the directions, but sometimes the instructions are not written to their level and take assumptions into play. 

With the use of scripts, you can have almost anyone run it, as long as you have outputs defining what is occurring and the proper error detection/collection, which is where I am currently at in my hell.

The scripts are basic in add users, copy some updated files over system files, install a few packages, install signatures, etc.  For the most part, the scripts run, now its time to go back and provide comments per the sections, validate a log file is being created with everything, and proper error detection (This is where I am getting some assistance).

Another great tool is to have code review by somewhere else, as they will see it in a different light and provide possible other ways to get the job done, and/or see issues with the script. 

Till a few days ago I didn't even know what 2>&1 was used for, I mean I had seen it a few times, but hey let's throw that in the script just to see what it does.   But I started using it to redirect output from the script to the screen and to the log file (as I saw in another script).  Reading more it redirects stderr to stdout.

The next was the use of variables in the bash script.  I have used it in programming languages like Java, C++, but I guess I didn't realize that you could use them in something as simple as a Bash script.

Last was the use of the If/Then clause, another concept I am used to in Java/C++, just didn't think it was useable in Bash scripts, well here's to learning what other cool things I can do with Bash.