A database of common, interesting or useful commands, in one handy referable form
A database of common, interesting or useful commands, in one handy referable form
RTFM is a great and useful book, BUT a bit pointless when you have to transcribe it, so this little program will aim to be the spiritual successor to it.
I would recommend picking up a copy of the book from Amazon, it is pretty handy to have!
Download, Update, Look for something!
$ chmod +x rtfm.py
$ ./rtfm.py -u
$ ./rtfm.py -e 'Something'
…Its pretty much a simple search program, nothing to fancy, examples include:
Searching the DB is handled through the following switches: e, t, c, R, r, a and, A. When you are just browsing for a command, you will want to use e as this looks at the command, comment, and referances all at the same time, useful if you know a bit about something such as x11:
…Any other time, one of t'other flags for other things;
-c is search for a command. Use this when you know what command you want to look for, but can't quite remember the syntax. For example, if you want to quickly look up the syntax for a common sqlmap command. Useful for jumping straight to collections of common flags or one liners:
…-t is search for a tag, tags are groups of similar commands, for example, XSS payloads. Use this when wanting a more generic search such as around flaws or around generic Windows commands:
…All the Tags known about can be shown through -Dt, Currently a few typos that will be fixed in version 0.9.9:
…The next one you will want is -R, this is for searching for a 'remark' (aka comment, didn't want two c flags), this is to search the comments field and is more along the lines of searching for techniques or generic terms such as 'X11' or 'exfil':
…These next two are aimed for when you wish to commit back, and wouldn't be normally used:
-a is to search by author, for example, show things you have added:
./rtfm.py -a innes
-A is 'Added on date', this can be one of yyyy-mm-dd, or now/today, most usefully for dumping out commands you have added to commit back to the git!
rtfm.py -A now
++++++++++++++++++++++++++++++
Command ID : 469
Command : b
Comment : b
Tags : b
Date Added : 2017-05-14
Added By : b
References
__________
b
++++++++++++++++++++++++++++++
rtfm.py -A 2017-05-14
++++++++++++++++++++++++++++++
Command ID : 469
Command : b
Comment : b
Tags : b
Date Added : 2017-05-14
Added By : b
References
__________
b
++++++++++++++++++++++++++++++
All of these search flags can be combinded to create a very specfic search should you wish, shown here with debugging on:
…RTFM implements a simple text file format to pull in updates to the database, these are shared VIA git, and implement a simple sha check to make sure they have not been corrupt during download. The updates called by the command are 'safe' in the form they won't write over your DB, should you git pull, it probably will overwrite your DB. If you are git cloning, you can move your database to '/etc/rtfm/snips.db' to protect your database file.
…The update process also now drags in errata for the local DB allowing me a centralised way of neatly fixing the typos which have filtered into the DB. These are set through https://raw.githubusercontent.com/leostat/rtfm/master/updates/errata.txt. This allows things to be 'fixed' without needing to remove anything from the database.
Like all good cheatsheets, it is possible to add your own content to the database. This is managed through the -i segment of the program. When adding commands you must add them with comments, references, and tags. Else at the moment, they will not be returned from the DB. Minor bug really. This is done by adding all commands, along with their tags and references at once through using -iE, Insert everything:
…After committing to your local database I would be extremely grateful if you would open a pull request so that I am able to continue to add to the database. This is really easy, and done through the use of an output format 'pd' (print dump). The easiest way is by searching for commands added by yourself on today, then opening a git pull request, for the above example:
19:43:root:rtfm: ./rtfm.py -a Innes -A now -pd
セ=ア[ミ=ウ],ハ=++ミ+ウ,ヘ=ホ[ミ+ハ],ア[ヘ+=ホ[ウ]+(ホ.ホ+ホ)[ウ]+ネ[ハ]+ヌ+セ+ア[ミ]+ヘ+ヌ+ホ[ウ]+セ][ヘ](ネ[ウ]+ネ[ミ]+ア[ハ]+セ+ヌ+"(ウ)")()
Script alert(1) using Katakana
Innes
EOC
web application
XSS
EOT
https://github.com/aemkei/katakana.js
EORThe above is the correct format for the updates, so you can add a file and I can either merge into one large update file, or keep it as a separate file!
There is also a number of output options, such as copy any paste, pretty, wiki and update:
…The update format is to make it easy to open pull requests for new commands!
rtfm.py -pd -c rtfm
rtfm.py -c [command] -t [tag],[tag] -C [comment] -p P
Helpception, search for a command with two tags and a comment
Innes
EOC
linux
EOT
https://github.com/leostat/rtfm
https://necurity.co.uk/osprog/2017-02-27-RTFM-Pythonized/index.html
EORShould you wish to add say lots of commands at once, then worry about tags and references later you could do call RTFM with '-i c', using an empty response to stop processing commands:
$ rtfm.py -i c
Enter your command : Your Command
Enter you comment : Your Comment
Enter Author : Your Name
Enter your command : Command Two
Enter you comment : Comment Two
Enter Author : Your Name
Enter your command :
Enter you comment :
Enter Author :
[OK]: Added Rows : 2
[OK]: New Top ID : 491 | Number of CMD's Added : 2Next, add the required tags into the inserted with either '-i t', which adds tags to a single command, or '-i ta' which adds tags to all commands missing tags:
$ rtfm.py -i t
What CMD are we adding tags too? : 491
Enter a tag (blank for none) : Test
Enter a tag (blank for none) : Second Tag
Enter a tag (blank for none) :
[OK]: Added tags
[OK]: Added a new tag and a tagmapSimilarly , you now have to add referances to the commands you have just added, '-i r',
$ rtfm.py -i r
What CmdID are we adding refs to? : 491
Enter a reference (blank for non) : http://bing.com
Enter a reference (blank for non) :
[OK]: Added a new Ref and a refmapThere is also a '-i ta' which adds tags to all commands which are missing them, this was used for the DB seeding more than anything!
…This is simple enough, 'tis just using:
rtfm.py --delete 1
Throughout the entire program, I have tried to add 'debug' calls '-d', these show you what the SQL is doing, what is being passed around.
The people that deserve the credits will be in the reference table of the DB. They are the ones doing the work!
Thanks in no particular order :) :
@VC : Fixing many a bug!
@Rezkon : Suggesting new features and making the layout more sane
@David : Being the beta tester and finding all the bugs!
@Matthew S : Berating me into making the DB so much better and putting up with the n00b db questions
@ECSC : Allowing me to publish! Go check them out : https://ecsc.co.uk
@Fabien : 'Just run FSCK in dry run mode' . . . ;DNo open issues yet, or sync has not completed.