Merge pull request #129 from ImmortalPC/master

Adding python (simple web server). Change netstat (deprecated).
This commit is contained in:
Chris Lane 2013-12-01 09:57:35 -08:00
commit 19505f5d7f
6 changed files with 54 additions and 2 deletions

4
cheatsheets/dd Normal file
View File

@ -0,0 +1,4 @@
# Read from {/dev/urandom} 2*512 Bytes and put it into {/tmp/test.txt}
# Note: At the first iteration, we read 512 Bytes.
# Note: At the second iteration, we read 512 Bytes.
dd if=/dev/urandom of=/tmp/test.txt count=512 bs=2

View File

@ -6,3 +6,16 @@ gcc -o file file.c
# Debug symbols # Debug symbols
gcc -g gcc -g
# Debug with all symbols.
gcc -ggdb3
# Build for 64 bytes
gcc -m64
# Include the directory {/usr/include/myPersonnal/lib/} to the list of path for #include <....>
# With this option, no warning / error will be reported for the files in {/usr/include/myPersonnal/lib/}
gcc -isystem /usr/include/myPersonnal/lib/
# Build a GUI for windows (Mingw) (Will disable the term/console)
gcc -mwindows

View File

@ -9,3 +9,7 @@ grep -R pattern folder
# Getting pattern from file (one by line): # Getting pattern from file (one by line):
grep -f pattern_file file grep -f pattern_file file
# Find all files who contain {pattern} in the directory {directory}.
# This will show: "file:line my research"
grep -rnw 'directory' -e "pattern"

View File

@ -1,3 +1,5 @@
# WARNING ! netstat is deprecated. Look below.
# To view which users/processes are listening to which ports: # To view which users/processes are listening to which ports:
sudo netstat -lnptu sudo netstat -lnptu
@ -11,3 +13,16 @@ Example output: 1507/python
# Fast display of ipv4 tcp listening programs # Fast display of ipv4 tcp listening programs
sudo netstat -vtlnp --listening -4 sudo netstat -vtlnp --listening -4
# WARNING ! netstat is deprecated.
# Replace it by:
ss
# For netstat-r
ip route
# For netstat -i
ip -s link
# For netstat-g
ip maddr

13
cheatsheets/python Normal file
View File

@ -0,0 +1,13 @@
# Desc: Python is a high-level programming language.
# Basic example of server with python
# Will start a Web Server in the current directory on port 8000
# go to http://127.0.0.1:8000
# Python v2.7
python -m SimpleHTTPServer
# Python 3
python -m http.server 8000
# SMTP-Server for debugging, messages will be discarded, and printed on stdout.
python -m smtpd -n -c DebuggingServer localhost:1025

View File

@ -10,11 +10,14 @@ wget -c http://path.to.the/file
# To download multiples files with multiple URLs # To download multiples files with multiple URLs
wget URL1 URL2 wget URL1 URL2
# To parse a file that contains a list of URLs to fetch each one # To parse a file that contains a list of URLs to fetch each one
wget -i url_list.txt wget -i url_list.txt
# To download files according to a pattern # To download files according to a pattern
wget http://www.myserver.com/files-{1..15}.tar.bz2 wget http://www.myserver.com/files-{1..15}.tar.bz2
# To download all the files in a directory with a specific extension if directory indexing is enabled # To download all the files in a directory with a specific extension if directory indexing is enabled
wget -r -l1 -A.extension http://myserver.com/directory wget -r -l1 -A.extension http://myserver.com/directory
# Allows you to download just the headers of responses (-S --spider) and display them on Stdout (-O -).
wget -S --spider -O - http://google.com