Skip to content

Instantly share code, notes, and snippets.

View ericfourrier's full-sized avatar
🦉
Building neat tools to secure cloud and source code

Eric Fourrier ericfourrier

🦉
Building neat tools to secure cloud and source code
View GitHub Profile
#!/bin/sh
cd /tmp
wget http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20160210_all.deb
apt-get install libnewt0.52 whiptail parted triggerhappy lua5.1 alsa_utils
dpkg -i raspi-config_20160210_all.deb
  • nmap 192.168.1.0/24: This scans the entire class C range
  • nmap -p <port ranges>: This scans specific ports
  • nmap -sP 192.168.1.0/24: This scans the network/find servers and devices that are running
  • sudo nmap -sP 192.168.1.0/24 : Using sudo can be necessary on mac to get the MAC Adress
  • nmap -O 192.168.1.1-42 : Scan from port 1 to 42
  • nmap -O 192.168.1.150 :# Os detection with target ip
  • nmap –iflist: This shows host interfaces and routes
  • nmap –sV 192.168.1.1: This detects remote services' version numbers
  • nmap –sS 192.168.1.1: This performs a stealthy TCP SYN scan
  • nmap –sO 192.168.1.1: This scans for the IP protocol
# You need a server acessible from the client and server (aws instance for example accessible on port ssh 22 )
# install autossh ( apt-get install autossh)
# on the local machine (raspberry pi )
autossh -M 10001 -f -N -R 10000:localhost:22 user@serverip
# -n Redirects stdin from /dev/null (actually, prevents reading from stdin). This must be used when ssh is run in the background
# -N Do not execute a remote command. This is useful for just forwarding ports
# -T Do not allocate a pseudo-tty on the remote system
# -R Set up the tunnel as a reverse tunnel.
#!/bin/bash
if [ -z "$SUDO_USER" ]; then
echo "$0 must be called from sudo. Try: 'sudo ${0}'"
exit 1
fi
SCRIPT_LOCATION="/etc/network/if-up.d/reverse_ssh_tunnel"
echo "Creating file in $SCRIPT_LOCATION"
echo "Installing openssh-server and autossh"
import logging
# logging.getLogger(type(self).__name__) if you have a lot of class
log = logging.getLogger() # 'root' Logger
console = logging.StreamHandler() # logging to console
csv_handler = logging.FileHandler('logs.csv')
template_log = '%(asctime)s,%(levelname)s,%(processName)s,%(filename)s,%(lineno)s,%(message)s' #csv
console.setFormatter(logging.Formatter(template_log))
log.addHandler(console) # prints to console.
log.addHandler(csv_handler) # save to csv gile
# To include in notebook for inline ggplot with bigger size
%matplotlib inline
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = (12, 8) # bigger figsize
plt.style.use('ggplot') # ggplot2 style for matplotlib
sudo mount -o uid=pi,gid=pi /dev/sda1 /mnt/ # mount with pi permission
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sudo apt-get install powerline # install powerline fonts for ubuntu > 14.04 useful of oh-my-zsh themes
# Installing solorized theme for terminator
git clone https://github.com/ghuntley/terminator-solarized.git
cd terminator-solarized
mkdir -p ~/.config/terminator/
touch ~/.config/terminator/config
# if you want to replace current config:
cp config ~/.config/terminator