FlameSpyro / Cyber-Security-Survival-Kit

This is my official capstone repository discussing and including the proper information and downloads for The Cyber Security Survival Kit project.
0 stars 0 forks source link

Attempt scripting with software testing #19

Closed FlameSpyro closed 7 months ago

FlameSpyro commented 7 months ago

At this point the software I want for the project is currently written down and installed. I just want to play with the idea of automation through a PowerShell script of some sort. Ill be reporting this to my professor to see if this works or if I should just drop it. Im giving myself the first week in the sprint to do.

FlameSpyro commented 7 months ago

Update 1

After research online and experimentation I was able to get some automation for the installation of some software. I was able to get Malwarebytes installed and running through the use of a PowerShell script! In order to do this however I needed to use a package manager by the name of Chocolatey. This allows me to pull in packages for some of the software I would like to apply and use for my capstone!. The link to the website which contained all the instructions I needed can be found in the references section.

From here I am doing research for configuration of windows settings through the use of PowerShell so that any of the hard work is carried by the script and the user only has to navigate a basic menu option.

I also did find an interesting guide as to create a basic gui on PowerShell that can run the proper scripts you need simply by clicking them. I will also be linking the guide for future reference and test to see if its up and running

FlameSpyro commented 7 months ago

Update 2

The GUI test was a success, I was able to get a basic interface to pop up and the buttons will run a script that is located in the folder the script was being run in.

I want to have:

FlameSpyro commented 7 months ago

For security, the best measure to take would be to run a file check when the main GUI program is running. Once its run, the program will pull this GitHub files and run a comparison between the two. If the files match then the program works like normal, if it doesn't the user will receive warning the files have been altered and will force close the program. It will look something like this:

# Function to pull a file from my choice of URL
function Download-File {
    param(
        [string]$url,
        [string]$outputFile
    )
    $webClient = New-Object System.Net.WebClient
    $webClient.DownloadFile($url, $outputFile)
}

# Paths for the script in the provided folder, my github file moved into a temp file to be deleted
# Put into vars for organization sake
$localFilePath = "actions.ps1"
$githubFilePath = "https://raw.githubusercontent.com/FlameSpyro/Cyber-Security-Survival-Kit/main/Code/GUI/actions.ps1"
$tempFilePath = "compare_script.ps1"

# Download actions.ps1 from the GitHub
Download-File -url $githubFilePath -outputFile $tempFilePath

# Compare files
if ((Get-FileHash -Path $localFilePath).Hash -eq (Get-FileHash -Path $tempFilePath).Hash) {
    # If the files match perfectly, delete the temp version of the file
    Remove-Item $tempFilePath -Force
    # My finished GUI Code will go here OR will run on a separate script

}
else {
    # If they dont match then close the program
    Remove-Item $tempFilePath -Force
    [System.Windows.Forms.MessageBox]::Show("Uh oh! It looks like your version of the files do not line up. Either these have been altered or FS made a error. Please file an issue on the github page and ill fix it asap!")
    exit
}

Can also be found here

FlameSpyro commented 7 months ago

Update:

Upon testing the script does in fact work! The script I first commented downloads the original file from this github repository. This then compares the hash values between the two files moving to an if statement.

If the files match up exactly then the program will continue to run as normal, deleting the copy of the file to clean up and prevent clutter.

If the action.ps1 is altered in any way shape or form, the program will detect that and bring up a windows pop up stating the case and completely shutting down the program.

I will probably work on this file one more time to have the compare file REPLACE the original actions.ps1 file, but will still have the warning just to inform the user

FlameSpyro commented 7 months ago

Update 3

The final general GUI script has been created. The GUI looks generally better and is now my own design rather than working from the original package online. Now when all the buttons are pressed, actions.ps1 runs the proper command with the corresponding flag. I did have trouble adding my logo but that's ok.

Now the current function of the program is:

Launcher(Verifies all files) --> GUI.ps1 --> actions.ps1

I'm on the homestretch for wrapping up the prototype ready to go!

I may combing the verify files with the GUI but that should be easy.

FlameSpyro commented 7 months ago

UPDATE 4!!!!

The script is pretty much in a completed and functional state! I uploaded GUI_4.0 as the latest and greatest version that I have been creating over the course of this past week! Took a lot of time and testing but all the buttons are layed out in the best way and all features fully work!

The file check feature was included in there aswell. Originally this was going to be on its own script as a launcher but this feels too important to do that so I made it so that and the GUI runs when the file check passes and will be turned into an executable when submitted!.

The actions.ps1 file has all the commands and work done. The testing on my VM windows 10 machine all came back working perfectly! Im going to check off the scripting task as complete as there is little to no coding left besides changing the manual button to link to the actual manual!

From here on out its going to be polishing the code a bit, documentation, presentation/demo, and final paper!