Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “The same approach can be extended to other firewall vendors by modifying rule_command.”
A block of code is set as follows:
import paramiko
def create_firewall_rule(host, username, password, rule_command):
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password)
stdin, stdout, stderr = ssh.exec_command(rule_command)
print(stdout.read().decode())
ssh.close()
# Example rule command for Cisco ASA firewall
rule_command = "access-list outside_in extended permit tcp any host 192.168.1.100 eq 80"
create_firewall_rule("firewall_ip_address", "admin", "password", rule_command) Any command-line input or output is written as follows:
npm install -g newman
Tips or important notes
Appear like this.