m-wintersteen / cs476-code

Source code for CSCI 476 @ MSU (Computer Security) - adapted from

Home Page:https://www.handsonsecurity.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code & Examples Computer Security @ MSU

Includes code examples from class.

Many of our examples are adapted from SEED Labs [1, 2].

Tips & Tricks

Updating the Shell

On the SEED VM, /bin/sh is actually an alias for /bin/dash.

# sh is actually an alias
$ which sh
/bin/sh
$ ls -l /bin/sh
lrwxrwxrwx 1 root root 8 Jan 23 03:32 /bin/sh -> /bin/dash

/bin/dash has countermeasures against some of our exercises. So, at times we may need to use another shell, such as /bin/zsh. Here are examples of how to set/reset the shell symlinks:

$ sudo ln -sf /bin/zsh /bin/sh   # make sh symlink to zsh
$ sudo ln -sf /bin/dash /bin/sh  # sh is symlink to dash (default)

Updating the Hostname

Sometimes for clarity it is nice to change the hostname. For example, I will often set the hostname to a descriptive name (e.g., attacker, user, server) in demos to clarify the role of a particular VM. Here is a simple way to achieve this:

sudo hostnamectl set-hostname NEW_NAME_YOU_WANT

Configure gdb to use Intel / AT&T syntax for Dissasembled Code

$ show disassembly-flavor

I think the Intel syntax is cleaner, but use whichever syntax is best for you:

# make sure default assembly syntax is att syntax. ONLY NEED TO RUN THIS ONCE!
$ echo 'set disassembly-flavor intel' >> ~/.gdbinit
# or
$ echo 'set disassembly-flavor att' >> ~/.gdbinit

Ref: https://visualgdb.com/gdbreference/commands/set_disassembly-flavor

About

Source code for CSCI 476 @ MSU (Computer Security) - adapted from

https://www.handsonsecurity.net


Languages

Language:C 83.1%Language:Python 12.0%Language:Makefile 1.2%Language:JavaScript 1.1%Language:HTML 1.1%Language:PHP 0.8%Language:Shell 0.6%Language:Standard ML 0.0%