Vulnerability Assessment

Vulnerability Assessment
– Find vulnerabilities in a system or network
– Better than just a port scanner.
– Generally considered to be least intrusive.
– Penetration testing / port scanning is considered more intrusive.

– One may run a password cracker on a password file to check for weaknesses in user password. This would be considered as a Vulnerability Assessment.

Vulnerability Scanner:
– scan for open ports
– review known software vulnerabilities

Some example of Vulnerability Assessment Tools:
– Nessus (paid with a free trial period): Nessus is a proprietary vulnerability scanner developed by Tenable Network Security. It is free of charge for personal use in a non-enterprise environment. Download page:
– Microsoft Baseline Security Analyzer (Free)- The Microsoft Baseline Security Analyzer provides a streamlined method to identify missing security updates and common security misconfigurations. MBSA 2.3 release adds support for Windows 8.1, Windows 8, Windows Server 2012 R2, and Windows Server 2012. Windows 2000 will no longer be supported with this release. Windows 2000, Windows 7, Windows 8, Windows 8.1, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista, Windows XP. Download Page:
– Retina (Paid with free trial option) – this tool is fast and non-intrusive, and has the most comprehensive vulnerability database. This tool can also be used for web application scanning. Download page:
– Even ping scan can be considered as vulnerability assessment.
– You can also use port scanner – TCP SYN scan – Half open scan

Things to remember:
– Socket: IP address + port
– nmap is a very popular port scanner
OVAL – Open Vulnerability and Assessment Language (XML): As stated in the official homepage,  “OVALĀ® International in scope and free for public use, OVAL is an information security community effort to standardize how to assess and report upon the machine state of computer systems. OVAL includes a language to encode system details, and an assortment of content repositories held throughout the community.”

Set up a VM using Vagrant

# Install vagrant.

#create a directory to work on vagrant
mkdir learnPlaybooks
cd learnPlaybooks

# use vagrant to create a test virtual machine
vagrant init ubuntu/trysty64

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

# if the previous command ran successfully, then boot up the machine
vagrant up

Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Box ‘ubuntu/trusty64’ could not be found. Attempting to find and install…
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box ‘ubuntu/trusty64’
default: URL:
==> default: Adding box ‘ubuntu/trusty64’ (v20170619.0.0) for provider: virtualbox
default: Downloading:
default: Progress: 100% (Rate: 21.8M/s, Estimated time remaining: –:–:–)
==> default: Successfully added box ‘ubuntu/trusty64’ (v20170619.0.0) for ‘virtualbox’!
==> default: Importing base box ‘ubuntu/trusty64’…
==> default: Matching MAC address for NAT networking…
==> default: Checking if box ‘ubuntu/trusty64’ is up to date…
==> default: Setting the name of the VM: playbooks_default_1500666460505_44195
==> default: Clearing any previously set forwarded ports…
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
==> default: Forwarding ports…
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address:
default: SSH username: vagrant
default: SSH auth method: private key
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default: Inserting generated public key within guest…
default: Removing insecure key from the guest if it’s present…
default: Key inserted! Disconnecting and reconnecting using new SSH key…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default: Guest Additions Version: 4.3.36
default: VirtualBox Version: 5.1
==> default: Mounting shared folders…
default: /vagrant => C:/Users/abasu/learn/playbooks

# connect to the virtual machine controlled by vagrant using the
# following command
vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-125-generic x86_64)

* Documentation:

System information as of Fri Jul 21 19:48:10 UTC 2017

System load: 0.69 Processes: 81
Usage of /: 3.6% of 39.34GB Users logged in: 0
Memory usage: 25% IP address for eth0:
Swap usage: 0%

Graph this data and manage this system at:

Get cloud support with Ubuntu Advantage Cloud Guest:

0 packages can be updated.
0 updates are security updates.

New release ‘16.04.2 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

# Ansible needs regular SSH to connecting to nodes.
# to get SSH connection details to the machine, run:
vagrant ssh-config

Host default
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/abasu/learn/playbooks/.vagrant/machines/default/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL


# if you are on a windows machine, at this point, you can use a SSH client such as PUTTY to connect to the VM

Git Stash Commands

Most common commands that I use. Self-explanatory.

Save and List Stash

  • git stash save “Some message”
  • git stash list # stash is available to all branches.
  • git stash show stash@{0}
  • git stash show -p stash@{0} #detailed view

Apply stash

  • git stash pop stash@{0}
  • git stash apply stash@{0}

Delete Stash

  • git stash drop stash@{0}
  • git stash clear

.gitignore file

Ignoring files in git using .gitignore
create a .gitignore file and put it in the root of a git project.

Typically ignore:
-Compiled source code
-Packages and compressed files
-logs and databases that changes very often.
-OS system generated files.
-images, pdfs, videos

Example of a common .gitignore file from github.

# Compiled source #

# Packages #
# it’s better to unpack these files and commit the raw source
# git has its own built in compression methods

# Logs and databases #

# OS generated files #


Visit for great info.

Changes to Git – Amend

1. Undo changes in the working directory
git checkout — unmodifiedFileName # — implies that we are not checking out a branch. Stay on the current branch and check out the unmodified file.

2. Undo changes in the staging area
git reset HEAD –stagedFileName

3. Undoing commits
— git can edit only the last commit with the amend command.
git commit –amend -m “message”

git commit –amend -m “we can also just update the last commit message”

Bash Line Commands – Most used

Basic Bash commands
Crtl+A – move to the beginning of a line
Crtl+E – move to the end of a line
Crtl+F == right arrow
Crtl+B == back arrow
Crtl+D – delete a character
Crtl+U – delete from curser positon to the beginning of the line
Crtl+K – delete from the curser positon to the end of the line
Crtl+X then backspace == Crtl+U
Crtl+T transpose a character
Esc+T transpose WORDS
Esc+U change to uppercase – whole word
Esc+L change to lower case
history – show the command history
history -c : clear the history

Most Common Git Commands

git branch -b new_feature
git branch –no-merged # show the branches that are not merged yet.
git merge –no-ff new-feature -m “merge new-feature branch”
git branch -D new-feature # delete the working branch after merge is completed


Working with GitHub

create a GitHub repo hello-remote

git clone <URL for hello-remote>
git clone
git status

add a demo file in local clone, demo.txt

git add demo.txt
git commit -m “added a demo file”

git push -u origin master # now upload the file to the GitHub.

git fetch origin # use this to update the local clone of the remote repository. This let us know how many commits have been made since the last pull
git remote -v # shows the branch on the remote location.

git pull # use this command to update the local repo. (Behind the scenes, git pull is actually a git fetch followed by a git merge)

Coll flag for git diff:

git diff –color-words

Try this feature.
git branch –merged : shows all of the branches that are merged.

Take a look at the diff between branches:
git diff master..branch_name

Rename a branch in Git
git branch -m old_branch_name new_branch_name
git branch –move old_branch_name new_branch_name

Delete Branches
git branch -d branch_name
git branch –delete branch_name

if there are changes in the branch that is not merged yet, we must use D
git branch -D branch_name # forced delete

Viewing Git Logs

Some common git log comments that I use heavily.

# view git logs
git log

#limit number of logs to show
git log -n 1 # last commit
git log -n 5 # last 5 commits
git log –since=2017-06-01
git log –until=2017-06-01

git log –author=”Ankan Basu”

git log –grep=”init” # look for changes in the commit message
git log –grep=”bug” # log for commit messages with bug fixes.


git log –oneline

git log –format=oneline

git log –graph

git log –oneline –graph –all –decorate