mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 08:58:28 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2acf73476c
12 changed files with 150 additions and 1 deletions
|
@ -3,3 +3,10 @@ apt-cache search "whatever"
|
||||||
|
|
||||||
# To display package records for the named package(s):
|
# To display package records for the named package(s):
|
||||||
apt-cache show pkg(s)
|
apt-cache show pkg(s)
|
||||||
|
|
||||||
|
# To display reverse dependencies of a package
|
||||||
|
apt-cache rdepends package_name
|
||||||
|
|
||||||
|
# To display package versions, reverse dependencies and forward dependencies
|
||||||
|
# of a package
|
||||||
|
apt-cache showpkg package_name
|
||||||
|
|
|
@ -11,3 +11,6 @@ apt-get dist-upgrade
|
||||||
|
|
||||||
# Full command:
|
# Full command:
|
||||||
apt-get update && apt-get dist-upgrade
|
apt-get update && apt-get dist-upgrade
|
||||||
|
|
||||||
|
# To install a new package(s)
|
||||||
|
apt-get install package(s)
|
||||||
|
|
|
@ -5,3 +5,6 @@ sudo dhclient -r
|
||||||
sudo dhclient
|
sudo dhclient
|
||||||
|
|
||||||
# Running the above in sequence is a common way of refreshing an IP.
|
# Running the above in sequence is a common way of refreshing an IP.
|
||||||
|
|
||||||
|
# To obtain a new IP address for a specific interface:
|
||||||
|
sudo dhclient eth0
|
||||||
|
|
|
@ -26,6 +26,9 @@ git push git@github.com:username/project.git
|
||||||
# To delete the branch "branch_name"
|
# To delete the branch "branch_name"
|
||||||
git branch -D branch_name
|
git branch -D branch_name
|
||||||
|
|
||||||
|
# To see who commited which line in a file
|
||||||
|
git blame filename
|
||||||
|
|
||||||
# To sync a fork with the master repo:
|
# To sync a fork with the master repo:
|
||||||
git remote add upstream git@github.com:name/repo.git # Set a new repo
|
git remote add upstream git@github.com:name/repo.git # Set a new repo
|
||||||
git remote -v # Confirm new remote repo
|
git remote -v # Confirm new remote repo
|
||||||
|
|
|
@ -10,6 +10,13 @@ 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 lines NOT containing pattern
|
||||||
|
grep -v pattern file
|
||||||
|
|
||||||
|
# You can grep with regular expressions
|
||||||
|
grep "^00" file #Match lines starting with 00
|
||||||
|
grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add
|
||||||
|
|
||||||
# Find all files who contain {pattern} in the directory {directory}.
|
# Find all files who contain {pattern} in the directory {directory}.
|
||||||
# This will show: "file:line my research"
|
# This will show: "file:line my research"
|
||||||
grep -rnw 'directory' -e "pattern"
|
grep -rnw 'directory' -e "pattern"
|
||||||
|
|
|
@ -5,9 +5,10 @@ ifconfig wlan0
|
||||||
ifconfig -a
|
ifconfig -a
|
||||||
|
|
||||||
# Take down / up the wireless adapter
|
# Take down / up the wireless adapter
|
||||||
ifconfig {up|down} wlan0
|
ifconfig wlan0 {up|down}
|
||||||
|
|
||||||
# Set a static IP and netmask
|
# Set a static IP and netmask
|
||||||
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
|
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
|
||||||
|
|
||||||
# You may also need to add a gateway IP
|
# You may also need to add a gateway IP
|
||||||
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
|
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
|
||||||
|
|
41
cheatsheets/markdown
Normal file
41
cheatsheets/markdown
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# headers
|
||||||
|
h1 header
|
||||||
|
=========
|
||||||
|
h2 header
|
||||||
|
---------
|
||||||
|
|
||||||
|
# blockquotes
|
||||||
|
> first level and paragraph
|
||||||
|
>> second level and first paragraph
|
||||||
|
>
|
||||||
|
> first level and second paragraph
|
||||||
|
|
||||||
|
# lists
|
||||||
|
## unordered - use *, +, or -
|
||||||
|
* Red
|
||||||
|
* Green
|
||||||
|
* Blue
|
||||||
|
|
||||||
|
## ordered
|
||||||
|
1. First
|
||||||
|
2. Second
|
||||||
|
3. Third
|
||||||
|
|
||||||
|
# code - use 4 spaces/1 tab
|
||||||
|
regular text
|
||||||
|
code code code
|
||||||
|
or:
|
||||||
|
Use the `printf()` function
|
||||||
|
|
||||||
|
# hr's - three or more of the following
|
||||||
|
***
|
||||||
|
---
|
||||||
|
___
|
||||||
|
|
||||||
|
# links
|
||||||
|
This is [an example](http://example.com "Title") inline link.
|
||||||
|
|
||||||
|
# emphasis
|
||||||
|
*em* _em_
|
||||||
|
|
||||||
|
**strong** __strong__
|
|
@ -3,3 +3,6 @@ mount -o remount,rw /
|
||||||
|
|
||||||
# To mount Usb disk as user writable:
|
# To mount Usb disk as user writable:
|
||||||
mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx
|
mount -o uid=username,gid=usergroup /dev/sdx /mnt/xxx
|
||||||
|
|
||||||
|
# To mount a remote NFS directory
|
||||||
|
mount -t nfs example.com:/remote/example/dir /local/example/dir
|
||||||
|
|
30
cheatsheets/ncat
Normal file
30
cheatsheets/ncat
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
# Connect mode (ncat is client) | default port is 31337
|
||||||
|
ncat <host> [<port>]
|
||||||
|
|
||||||
|
# Listen mode (ncat is server) | default port is 31337
|
||||||
|
ncat -l [<host>] [<port>]
|
||||||
|
|
||||||
|
# Transfer file (closes after one transfer)
|
||||||
|
ncat -l [<host>] [<port>] < file
|
||||||
|
|
||||||
|
# Transfer file (stays open for multiple transfers)
|
||||||
|
ncat -l --keep-open [<host>] [<port>] < file
|
||||||
|
|
||||||
|
# Receive file
|
||||||
|
ncat [<host>] [<port>] > file
|
||||||
|
|
||||||
|
# Brokering | allows for multiple clients to connect
|
||||||
|
ncat -l --broker [<host>] [<port>]
|
||||||
|
|
||||||
|
# Listen with SSL | many options, use ncat --help for full list
|
||||||
|
ncat -l --ssl [<host>] [<port>]
|
||||||
|
|
||||||
|
# Access control
|
||||||
|
ncat -l --allow <ip>
|
||||||
|
ncat -l --deny <ip>
|
||||||
|
|
||||||
|
# Proxying
|
||||||
|
ncat --proxy <proxyhost>[:<proxyport>] --proxy-type {http | socks4} <host>[<port>]
|
||||||
|
|
||||||
|
# Chat server | can use brokering for multi-user chat
|
||||||
|
ncat -l --chat [<host>] [<port>]
|
|
@ -11,3 +11,6 @@ python -m http.server 8000
|
||||||
|
|
||||||
# SMTP-Server for debugging, messages will be discarded, and printed on stdout.
|
# SMTP-Server for debugging, messages will be discarded, and printed on stdout.
|
||||||
python -m smtpd -n -c DebuggingServer localhost:1025
|
python -m smtpd -n -c DebuggingServer localhost:1025
|
||||||
|
|
||||||
|
# Pretty print a json
|
||||||
|
python -mjson.tool
|
||||||
|
|
45
cheatsheets/sqlmap
Normal file
45
cheatsheets/sqlmap
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Test URL and POST data and return database banner (if possible)
|
||||||
|
./sqlmap.py --url="<url>" --data="<post-data>" --banner
|
||||||
|
|
||||||
|
# Parse request data and test | request data can be obtained with burp
|
||||||
|
./sqlmap.py -r <request-file> <options>
|
||||||
|
|
||||||
|
# Fingerprint | much more information than banner
|
||||||
|
./sqlmap.py -r <request-file> --fingerprint
|
||||||
|
|
||||||
|
# Get database username, name, and hostname
|
||||||
|
./sqlmap.py -r <request-file> --current-user --current-db --hostname
|
||||||
|
|
||||||
|
# Check if user is a database admin
|
||||||
|
./sqlmap.py -r <request-file> --is-dba
|
||||||
|
|
||||||
|
# Get database users and password hashes
|
||||||
|
./sqlmap.py -r <request-file> --users --passwords
|
||||||
|
|
||||||
|
# Enumerate databases
|
||||||
|
./sqlmap.py -r <request-file> --dbs
|
||||||
|
|
||||||
|
# List tables for one database
|
||||||
|
./sqlmap.py -r <request-file> -D <db-name> --tables
|
||||||
|
|
||||||
|
# Other database commands
|
||||||
|
./sqlmap.py -r <request-file> -D <db-name> --columns
|
||||||
|
--schema
|
||||||
|
--count
|
||||||
|
# Enumeration flags
|
||||||
|
./sqlmap.py -r <request-file> -D <db-name>
|
||||||
|
-T <tbl-name>
|
||||||
|
-C <col-name>
|
||||||
|
-U <user-name>
|
||||||
|
|
||||||
|
# Extract data
|
||||||
|
./sqlmap.py -r <request-file> -D <db-name> -T <tbl-name> -C <col-name> --dump
|
||||||
|
|
||||||
|
# Execute SQL Query
|
||||||
|
./sqlmap.py -r <request-file> --sql-query="<sql-query>"
|
||||||
|
|
||||||
|
# Append/Prepend SQL Queries
|
||||||
|
./sqlmap.py -r <request-file> --prefix="<sql-query>" --suffix="<sql-query>"
|
||||||
|
|
||||||
|
# Get backdoor access to sql server | can give shell access
|
||||||
|
./sqlmap.py -r <request-file> --os-shell
|
|
@ -13,5 +13,8 @@ ssh -X user@example.com
|
||||||
# To launch a specific x application over SSH:
|
# To launch a specific x application over SSH:
|
||||||
ssh -X -t user@example.com 'chromium-browser'
|
ssh -X -t user@example.com 'chromium-browser'
|
||||||
|
|
||||||
|
# To create a SOCKS proxy on localhost and port 9999
|
||||||
|
ssh -D 9999 user@example.com
|
||||||
|
|
||||||
# For more information, see:
|
# For more information, see:
|
||||||
# http://unix.stackexchange.com/q/12755/44856
|
# http://unix.stackexchange.com/q/12755/44856
|
||||||
|
|
Loading…
Reference in a new issue