Conflicts:
	README.md
	cheat
	install
This commit is contained in:
Louis Taylor 2013-08-17 02:38:31 +01:00
commit 73d9f0c83d
3 changed files with 89 additions and 11 deletions

33
.cheat/nmap Normal file
View File

@ -0,0 +1,33 @@
Single target scan:
nmap [target]
Scan from a list of targets:
nmap -iL [list.txt]
iPv6:
nmap -6 [target]
OS detection:
nmap -O [target]
Save output to text file:
nmap -oN [output.txt] [target]
Save output to xml file:
nmap -oX [output.xml] [target]
Scan a specific port:
nmap -source-port [port] [target]
Do an aggressive scan:
nmap -A [target]
Traceroute:
nmap -traceroute [target]
Ping scan only: -sP
Don't ping: -PN
TCP SYN ping: -PS
TCP ACK ping: -PA
UDP ping: -PU
ARP ping: -PR

View File

@ -83,10 +83,40 @@ After you've customized your cheatsheets, I urge you to track `~/.cheat/` along
with your [dotfiles][]. with your [dotfiles][].
Setting a CHEATPATH
----------------------
By default, all cheatsheets are installed to `~/.cheat/`, but you can instruct
`cheat` to look for cheatsheets in other directories by exporting a `CHEATPATH`
environment variable:
```bash
export CHEATPATH=/path/to/my/cheats
```
You may, of course, append multiple directories to your `CHEATPATH`:
```bash
export CHEATPATH=$CHEATPATH:/path/to/more/cheats
```
Contributing Contributing
============ ============
If you would like to contribute additional cheatsheets for basic \*nix If you would like to contribute cheetsheets or program functionality, please
commands, please modify the `.cheat` file and send me a pull request. fork this repository, make your chanages, and send me a pull request.
Related Projects
================
- [lucaswerkmeister/cheats][1]: An implementation of this concept in pure bash
that also allows not only for numerical indexing of subcomands but also
supports running commands interactively.
- [jahendrie/cheat][2]: A bash-only implmentation that additionally allows for
cheatsheets to be created and `grep` searched from the command-line.
([jahendrie][] contributed key ideas to this project as well.)
[dotfiles]: http://dotfiles.github.io/ [dotfiles]: http://dotfiles.github.io/
[jahendrie]: https://github.com/jahendrie
[1]: https://github.com/lucaswerkmeister/cheats
[2]: https://github.com/jahendrie/cheat

23
cheat
View File

@ -18,16 +18,31 @@ user_cheat_dir = os.path.join(os.path.expanduser('~'), '.cheat')
if os.path.isdir(user_cheat_dir): if os.path.isdir(user_cheat_dir):
cheatsheets += [(f, user_cheat_dir) for f in os.listdir(user_cheat_dir) cheatsheets += [(f, user_cheat_dir) for f in os.listdir(user_cheat_dir)
if '.' not in f] if '.' not in f]
# add the cheat files from the directory specified in $CHEATPATH
if 'CHEATPATH' in os.environ and os.environ['CHEATPATH']:
path = os.environ['CHEATPATH'].split(os.pathsep)
if os.path.isdir(path):
cheatsheets += [(f, path) for f in os.listdir(path) if '.' not in f]
cheatsheets.sort() cheatsheets.sort()
# assemble a keyphrase out of all params passed to the script # assemble a keyphrase out of all params passed to the script
keyphrase = ' '.join(sys.argv[1:]) keyphrase = ' '.join(sys.argv[1:])
# verify that we have at least one cheat directory
if not cheatsheets:
print >> sys.stderr, 'The ~/.cheat directory does not exist or the CHEATPATH variable is not set.'
exit()
# assemble a keyphrase out of all params passed to the script
keyphrase = ' '.join(sys.argv[1:])
# print help if requested # print help if requested
if keyphrase in ['', 'help', '--help', '-h']: if keyphrase.lower() in ['', 'cheat', 'help', '-h', '-help', '--help']:
print "Usage: cheat [keyphrase]\n" print "Usage: cheat [keyphrase]\n"
print "Available keyphrases:" print "Available keyphrases:"
print "\n".join([name[0] for name in cheatsheets]) max_command = max([len(sheet[0]) for sheet in cheatsheets]) + 3
print '\n'.join(sorted([ '%s [%s]' % (sheet[0].ljust(max_command), sheet[1]) for sheet in cheatsheets]))
exit() exit()
sheet_found = False sheet_found = False
@ -40,5 +55,5 @@ for sheet in cheatsheets:
sheet_found = True sheet_found = True
# if it does not, say so # if it does not, say so
if not sheet_found: else:
print 'No cheatsheet found.' print 'No cheatsheet found for %s.' % keyphrase