Skip to main content

Posts

My Fail2Ban crash course

Fail2Ban protects servers from brute force attacks. Install: sudo apt install fail2ban Check status: sudo systemctl status fail2ban Default configuration is usually sufficient for SSH. To view banned IPs: sudo fail2ban-client status sshd Configuration files are in: /etc/fail2ban/ Fail2Ban adds a layer of automated protection to your server. Security should be proactive. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and ...

My Tcpdump crash course

Tcpdump captures network packets. Install tcpdump: sudo apt install tcpdump Capture packets on interface: sudo tcpdump -i eth0 Capture specific port: sudo tcpdump -i eth0 port 80 Save capture to file: sudo tcpdump -i eth0 -w capture.pcap Read saved file: tcpdump -r capture.pcap Tcpdump helps diagnose network issues quickly. Use with caution on production systems. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear cred...

My Makefile crash course

Make automates build processes. Create a file named Makefile: all: gcc main.c -o app To run: make To clean build artifacts: clean: rm -f app Run: make clean Make uses tabs before commands. Spaces will not work. Make is useful even for small projects. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.

My Curl crash course

Curl is a command line tool for transferring data. To fetch a webpage: curl https://example.com To save output to file: curl -o index.html https://example.com To make a POST request: curl -X POST -d "name=John" https://example.com/api To add header: curl -H "Authorization: Bearer token" https://example.com/api To see headers: curl -I https://example.com Curl is simple and powerful for testing APIs. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts an...

My Python virtual environment crash course

Python virtual environments isolate dependencies per project. Install venv module if needed: sudo apt install python3-venv Create environment: python3 -m venv myenv Activate it: source myenv/bin/activate Your prompt changes indicating environment is active. Install packages: pip install requests List installed packages: pip list Deactivate: deactivate Virtual environments prevent dependency conflicts between projects. Use them always. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictl...

My VirtualBox crash course

VirtualBox lets you run virtual machines on your desktop. Download and install VirtualBox from the official website. Click New to create a VM. Choose name, type, and version. Assign memory size. Allocate disk size. Attach ISO image of your desired OS under Storage settings. Click Start. The VM will boot from ISO and you can install the operating system just like on real hardware. To take a snapshot: Machine -> Take Snapshot To power off: Machine -> Close -> Power Off VirtualBox is great for testing operating systems without touching your main system. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unau...

My Redis crash course

Redis is an in memory data store often used as cache. Install Redis: sudo apt install redis-server Check status: sudo systemctl status redis Launch Redis CLI: redis-cli Set a key: SET mykey "hello" Get a key: GET mykey Set with expiration: SET tempkey "bye" EX 60 Check keys: KEYS * Redis is extremely fast because it stores data in memory. It is perfect for caching sessions or frequently accessed data. Keep in mind memory usage grows with data size. Disclaimer: If you follow the information here, there is no warranty , I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk . My views and opinions are my own and not necessarily represent the views of my employer. © Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this s...