Updated API Documentation (markdown)

Tib3rius 2021-08-30 00:01:20 -04:00
parent 79a25c0d45
commit e398f33462
1 changed files with 58 additions and 1 deletions

@ -65,4 +65,61 @@ If a regular expression is provided, it must contain 3 named groups: port, proto
`^(?P<port>\d+)\/(?P<protocol>(tcp|udp))(.*)open(\s*)(?P<service>[\w\-\/]+)(\s*)(.*)$`
This method returns either a list of Service objects (if the regular expression matched) or an empty list (if it did not).
This method returns either a list of Service objects (if the regular expression matched) or an empty list (if it did not).
## Service
Service objects are created by AutoRecon from the list of services reported by PortScan plugins. They are passed to ServiceScan plugins for scanning.
### Attributes
#### name
The `name` attribute returns a string representation of the name of the service (e.g. 'http').
#### port
The `port` attribute returns an integer representation of the port that the service is running on (e.g. 80).
#### protocol
The `protocol` attribute returns a string representation of the protocol that the service is using (e.g. 'tcp').
#### secure
The `secure` attribute returns a boolean representation of whether or not the service is running over SSL/TLS.
#### target
The `target` attribute returns the Target object to which this Service object belongs. From this object you can get to any of the Target object's attributes if needed.
### Methods
#### add_manual_commands(description, commands)
The `add_manual_commands` method can be used by ServiceScan plugins to add manual commands. A valid `description` must be used, and the `commands` argument can be a string or a list of strings.
#### add_manual_command(description, command)
The `add_manual_command` method is an alias for `add_manual_commands` and works the same way.
#### execute(cmd, blocking=True, outfile=None, errfile=None)
The `execute` method can be used by a ServiceScan plugin to execute a command in a /bin/bash shell. The `cmd` argument should be a string representation of the command you wish to execute. The following markers can be used within the string, and will get automatically converted to their correct values by AutoRecon:
* {address} - The address of the target (e.g. 127.0.0.1, ::1)
* {addressv6} - Despite its name, this still represents the address of the target if it is IPv4. The difference is the IPv6 address will be represented as [::1] which is a common format for several tools.
* {http_scheme} - A special marker which is either 'https' or 'http' depending on whether the service is secure or not.
* {name} - The name of the service (e.g. 'http')
* {nmap_extra} - Extra nmap options provided by the user at runtime. Defaults to: -vv --reason -Pn
* {port} - The port that the service is running on (e.g. 80)
* {protocol} - The protocol that the service is using (e.g. 'tcp')
* {scandir} - The full path to the target's scans directory (e.g. /home/kali/results/127.0.0.1/scans)
The optional `blocking` argument can be used to make the `execute` method return immediately, rather than waiting until the command has finished. This is useful if you want to process lines of output live. However, if you do this, you should always run the following command on the process object before returning:
```python
await process.wait()
```
The optional `outfile` and `errfile` arguments can be used to specify filenames to save stdout and stderr to respectively. Note that only the filename is required (e.g. "scan_output.txt", as the scandir path will be prepended.
This method returns a Process object, a CommandStreamReader object for stdout, and a CommandStreamReader object for stderr.
#### full_tag()
The `full_tag` method returns a string representation of the service protocol, port, name, and whether it is secure, separated by forward slashes (e.g. tcp/80/http/insecure)
#### tag()
The `tag` method returns a string representation of the service protocol, port, and name, separated by forward slashes (e.g. tcp/80/http)