Commits

Tim Tomes  committed ecc07e3

Edited online

  • Participants
  • Parent commits 8533f80

Comments (0)

Files changed (1)

 === Output Methods:
 Recon-ng enables the consistent display of output to the user in multiple styles using three different methods. The functions can be called anywhere within a module to present a consistent interface to the user.
 
-* Format and present errors:
+* Format and present errors.
 {{{
 #!python
 self.error('<string>')
 }}}
 
-* Format and present normal output:
+* Format and present normal output.
 {{{
 #!python
 self.output('<string>')
 }}}
 
-* Format and present emphasized output:
+* Format and present emphasized output.
 {{{
 #!python
 self.alert('<string>')
 self.add_host(host[, address=None])
 }}}
 
-* Add a contact to the database and return the affected row count. "fname" is the first name of the contact. "lname" is the last name of the contact. "title" is the job title of the contact. "email" is the optional email address of the contact.
+* Add a contact to the database and return the affected row count.
+** //fname// is the first name of the contact.
+** //lname// is the last name of the contact.
+** //title// is the job title of the contact.
+** //email// is the optional email address of the contact.
 {{{
 #!python
 self.add_contact(fname, lname, title[, email=None])
 }}}
 
-* Add a credential to the database and return the affected row count. "username" is the username portion of the credential. "password" is the optional password portion of the credential. "hash type" is the optional hash type of the password, if the password is in the form of a hash. "leak" is optional information about the leaked credential.
+* Add a credential to the database and return the affected row count.
+** //username// is the username portion of the credential.
+** //password// is the optional password portion of the credential.
+** //hash type// is the optional hash type of the password, if the password is in the form of a hash.
+** //leak// is optional information about the leaked credential.
 {{{
 #!python
 self.add_cred(username[, password=None][, hashtype=None][, leak=None])
 }}}
 
-
+* Queries the database and returns the results as a list.
 {{{
 #!python
 self.query('<SQL statement>')
 }}}
-> Queries the database and returns the results as a list.
 
-### API Key Management Methods:
+=== API Key Management Methods:
 Some Recon-ng modules may require an API key. To prevent having to continually input API keys, Recon-ng provides methods which assist in the key management process. When the user runs a module that requires an API key, the module should use the available methods to achieve the following flow:
 
-1 - Check the local key storage database for a matching key.
+# Check the local key storage database for a matching key.
 {{{
 #!python
 self.get_key_from_db(key_name)
 }}}
-> Retrieves an API key from the API key storage database. "key_name" is the unique name for the key when stored in the database.
+> Retrieves an API key from the API key storage database. //key_name// is the unique name for the key when stored in the database.
 
 2 - If a key does not exist, prompt the user for an API key.
 {{{
 #!python
 self.get_key_from_user([key_text='API Key'])
 }}}
-> Retrieves an API key from the user. "key_text" is optional text to be used to describe the key when prompting the user.
+> Retrieves an API key from the user. //key_text// is optional text to be used to describe the key when prompting the user.
 
 3 - Store the API key for use in all future requests.
 {{{
 #!python
 self.add_key_to_db(key_name, key_value)
 }}}
-> Adds an API key to the API key storage database. "key_name" is the unique name for the key when stored in the database. "key_value" is the key string to store in the database.
+> Adds an API key to the API key storage database. //key_name// is the unique name for the key when stored in the database. //key_value// is the key string to store in the database.
 
 ALL - Condensed flow.
 {{{
 #!python
 self.manage_key(key_name, key_text)
 }}}
-> Automates the API key retrieval and storage process by combining the above methods into the proper flow. "key_name" is the unique name for the key when stored in the database. "key_text" is text to be used to describe the key when prompting the user.
+> Automates the API key retrieval and storage process by combining the above methods into the proper flow. //key_name// is the unique name for the key when stored in the database. //key_text// is text to be used to describe the key when prompting the user.
 
 ### Web Requests Methods:
 The most important capability of a tool which specializes in web based reconnaissance is the ability to make web requests. Recon-ng relieves the burden of complicated request building logic by providing a custom method for handling web requests.
 #!python
 self.request(url[, method='GET'], payload={}, headers={}, cookies={}[, redirect=True])
 }}}
-> Makes a web request and returns a response object. "url" is the base URL of the request. "method" is the method of the request. Currently, only "GET" or "POST" are available. "payload" is a dictionary of name:value pairs to be encoded as request parameters. "payload" should be used for "GET" and "POST" methods as the request method will encode and build the request as needed per method. "headers" is a dictionary of name:value pairs to be added as request headers. "cookies" is a dictionary of name:value pairs to be used as request cookies. No cookie jar currently available.
+> Makes a web request and returns a response object. //url// is the base URL of the request. //method// is the method of the request. Currently, only "GET" or "POST" are available. //payload// is a dictionary of name:value pairs to be encoded as request parameters. //payload// should be used for "GET" and "POST" methods as the request method will encode and build the request as needed per method. //headers// is a dictionary of name:value pairs to be added as request headers. //cookies// is a dictionary of name:value pairs to be used as request cookies. No cookie jar currently available.
 
 The resulting response object after a successful request allows quick access to all of the information required for further action.