mirror of
https://github.com/cheat/cheat.git
synced 2024-12-18 18:55:06 +01:00
Merge pull request #129 from ImmortalPC/master
Adding python (simple web server). Change netstat (deprecated).
This commit is contained in:
commit
19505f5d7f
4
cheatsheets/dd
Normal file
4
cheatsheets/dd
Normal 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
|
@ -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
|
||||||
|
@ -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"
|
||||||
|
@ -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
13
cheatsheets/python
Normal 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
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user