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][].
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
============
If you would like to contribute additional cheatsheets for basic \*nix
commands, please modify the `.cheat` file and send me a pull request.
If you would like to contribute cheetsheets or program functionality, please
fork this repository, make your chanages, and send me a pull request.
Related Projects
================
[dotfiles]: http://dotfiles.github.io/
- [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/
[jahendrie]: https://github.com/jahendrie
[1]: https://github.com/lucaswerkmeister/cheats
[2]: https://github.com/jahendrie/cheat

31
cheat
View File

@ -18,27 +18,42 @@ user_cheat_dir = os.path.join(os.path.expanduser('~'), '.cheat')
if os.path.isdir(user_cheat_dir):
cheatsheets += [(f, user_cheat_dir) for f in os.listdir(user_cheat_dir)
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()
# assemble a keyphrase out of all params passed to the script
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
if keyphrase in ['', 'help', '--help', '-h']:
if keyphrase.lower() in ['', 'cheat', 'help', '-h', '-help', '--help']:
print "Usage: cheat [keyphrase]\n"
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()
sheet_found = False
# print the cheatsheet if it exists
for sheet in cheatsheets:
if keyphrase == sheet[0]:
cheatsheet_filename = os.path.join(sheet[1], keyphrase)
with open(cheatsheet_filename, 'r') as cheatsheet:
print cheatsheet.read()
sheet_found = True
cheatsheet_filename = os.path.join(sheet[1], keyphrase)
with open(cheatsheet_filename, 'r') as cheatsheet:
print cheatsheet.read()
sheet_found = True
# if it does not, say so
if not sheet_found:
print 'No cheatsheet found.'
else:
print 'No cheatsheet found for %s.' % keyphrase