Tuesday, November 21, 2017

How to install Eric-- the Python editor



1. In the Ubuntu 16.04

 sudo apt-get update

 sudo apt-get install eric



>>>>replace it with the least Eric 6

sudo apt-get remove eric
 
 
yunhua@yunhua-PC:~/eric6-17.11.1$ python ./install.py
Checking dependencies
Python Version: 2.7.12
Found PyQt5
Found pyuic5
Sorry, please install QScintilla2 and
its PyQt5/PyQt4 wrapper.
Error: cannot import name Qsci


Then sudo apt-get install qt5-default


This package sets Qt 5 to be the default Qt version to be used when using development binaries like qmake. It provides a default configuration for qtchooser, but does not prevent alternative Qt installations from being used.
And

 su
python3 install.cy

Python -- part 1-- Installation

Python is a versatile programming language that can be used for many different programming projects. First published in 1991 with a name inspired by the British comedy group Monty Python, the development team wanted to make Python a language that was fun to use. Easy to set up, and written in a relatively straightforward style with immediate feedback on errors, Python is a great choice for beginners and experienced developers alike. Python 3 is the most current version of the language and is considered to be the future of Python.

This tutorial will guide you through installing Python 3 on your local Linux machine and setting up a programming environment via the command line. This tutorial will explicitly cover the installation procedures for Ubuntu 16.04, but the general principles apply to any other distribution of Debian Linux. 

Prerequisites


You will need a computer with Ubuntu 16.04 installed, as well as have administrative access to that machine and an internet connection.

Step 1 — Setting Up Python 3

On Ubuntu 16.04, you can find the Terminal application by clicking on the Ubuntu icon in the upper-left hand corner of your screen and typing “terminal” into the search bar. Click on the Terminal application icon to open it. Alternatively, you can hit the CTRL, ALT, and T keys on your keyboard at the same time to open the Terminal application automatically.
Ubuntu 16.04 ships with both Python 3 and Python 2 pre-installed. To make sure that our versions are up-to-date, let’s update and upgrade the system with apt-get:
  • sudo apt-get update
  • sudo apt-get -y upgrade
The -y flag will confirm that we are agreeing for all items to be installed, but depending on your version of Linux, you may need to confirm additional prompts as your system updates and upgrades.
Once the process is complete, we can check the version of Python 3 that is installed in the system by typing:
  • python3 -V
You will receive output in the terminal window that will let you know the version number. The version number may vary, but it will look similar to this:
Output
Python 3.5.2 
 
To manage software packages for Python, let’s install pip:
  • sudo apt-get install -y python3-pip
A tool for use with Python, pip installs and manages programming packages we may want to use in our development projects. You can install Python packages by typing:
  • pip3 install package_name
Here, package_name can refer to any Python package or library, such as Django for web development or NumPy for scientific computing. So if you would like to install NumPy, you can do so with the command pip3 install numpy.
There are a few more packages and development tools to install to ensure that we have a robust set-up for our programming environment:
  • sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Once Python is set up, and pip and other tools are installed, we can set up a virtual environment for our development projects.

Step 2 — Setting Up a Virtual Environment

Virtual environments enable you to have an isolated space on your computer for Python projects, ensuring that each of your projects can have its own set of dependencies that won’t disrupt any of your other projects.
We need to first install the venv module, part of the standard Python 3 library, so that we can create virtual environments. Let’s install venv by typing:
  • sudo apt-get install -y python3-venv
With this installed, we are ready to create environments. Let’s choose which directory we would like to put our Python programming environments in, or we can create a new directory with mkdir, as in:
  • mkdir environments
  • cd environments
Once you are in the directory where you would like the environments to live, you can create an environment by running the following command:
  • python3 -m venv my_env
Essentially, this sets up a new directory that contains a few items which we can view with the ls command:
  • ls my_env
Output
bin include lib lib64 pyvenv.cfg share 
 
To use this environment, you need to activate it, which you can do by typing the following command that calls the activate script:
  • source my_env/bin/activate
Your prompt will now be prefixed with the name of your environment, in this case it is called my_env. Your prefix may look somewhat different, but the name of your environment in parentheses should be the first thing you see on your line:
This prefix lets us know that the environment my_env is currently active, meaning that when we create programs here they will use only this particular environment’s settings and packages.

Step 3 — Creating a Simple Program

Now that we have our virtual environment set up, let’s create a simple “Hello, World!” program. This will make sure that our environment is working and gives us the opportunity to become more familiar with Python if we aren’t already.
To do this, we’ll open up a command-line text editor such as nano and create a new file:
  • nano hello.py
Once the text file opens up in the terminal window we’ll type out our program:
print("Hello, World!")
Exit nano by typing the control and x keys, and when prompted to save the file press y.
Once you exit out of nano and return to your shell, let’s run the program:
  • python hello.py
The hello.py program that you just created should cause your terminal to produce the following output:
Output
Hello, World!
To leave the environment, simply type the command deactivate and you will return to your original directory.



 

 



 

 

Thursday, July 6, 2017

How to show without more

his Document describe about How to show the Complete Configuration without Breaks/Pauses on Cisco Router/Switches, ASA Firewall and WLC (Wireless LAN Controller)

On Cisco Router/Switches:

When you execute the show running-config (show run) command on Cisco router/Switches, the output will be paged through one screen at a time. This is useful as Cisco configuration can be very long and can have thousands of lines. It would be impractical to dump the whole configuration to screen and expect the admin to rely on their scroll buffer.

Default screen length is of 24 lines. It means only 24 lines can be show on screen .you can verify using “Show terminal” command as shown below.

Router#show terminal | in Length
Length: 24 lines, Width: 80 columns
Router#

However if u like to have freedom to choose, to execute show run without more you can use this method.

1. Type "terminal length 0" in privileged mode to set your terminal to display without any breaks.
2. Type "show run" or "show start" to show the applicable config. The config will display without any breaks or pauses.

To display the config without lengthy certificate data, use "show run brief ".

This is useful for capturing the complete config for documentation purposes, especially if you do not have access via TFTP or the like.

On a Cisco Wireless LAN Controller:


1. Type "config paging disable" in priviledged mode to set your terminal to display without any breaks.

2. Type "show run-config" to display the config.

On a Cisco ASA Firewall:


To change terminal line display there are two commands you can use:

1) pager : Sets the number of lines to display in a Telnet session before the "---more---" prompt. This command is saved to the configuration.

2) terminal pager:Sets the number of lines to display in a Telnet session before the "---more---" prompt. This command is not saved to the configuration.

The default is 24 lines; 0 means no page limit.

1. Type "pager 0" in priviledged mode to set your terminal to display without any breaks.

2. Type "show run-config" to display the config.

3. Type "pager 20" in priviledged mode to set your terminal to display with breaks every 20 lines.

Friday, June 23, 2017

How to install open vpn on Linux

Documentation

To connect to Access Server from a Linux client computer, you need to follow these steps:
  1. Install an OpenVPN client for Linux
  2. Login to the Access Server's Client Web Server and download the desired client config file (typically called "client.ovpn"
  3. Run the OpenVPN client with the downloaded client config file

Installing an OpenVPN client:

Usually, the easiest way to install an OpenVPN client is to use the package management system for your particular Linux distribution.  Run one of the following commands (as root):

Fedora/CentOS/RedHat:


yum install openvpn

*NOTE: OpenVPN Access Server is not compatible with any version below the 2.1 OpenVPN Community/Linux client!
Ubuntu/Debian:


apt-get install openvpn

Once the openvpn package is fetched from the Internet and installed, run the client with the --version argument to make sure that it is version 2.1:
openvpn --version
OpenVPN 2.1_rc15e x86_64-unknown-linux-gnu [...]
[...]

Running the OpenVPN client with the downloaded client config file:

Usually, the easiest way to install an OpenVPN client is to use the --config argument to specify the location of the downloaded client config file:

openvpn --config client.ovpn

Friday, June 2, 2017

F5 Automap and None mapping

snat automap uses the egress vlan interface ip. by establishing a snat pool, and attaching, you can control what IP this translates to.
For the Client->F5->Server, consider these scenarios:
  1. None, client source address goes to the server. Routes necessary back through BIG-IP on servers or servers gw

  2. Snat Automap, client source is managed on BIG-IP, source is translated to self IP on egress interface heading toward servers. For servers needing source IP for reporting or decision processes, must insert in an application header or possibly in tcp options.

  3. Snat Pool, client source is still managed on BIG-IP, but source is translated to an IP you configure and attach to the virtual server. I like this option because I can map external IP -> internal IP by application so I know what flows belong to what application on the inside of the organization/dmz as appropriate. If traffic isn't necessary to come back through the BIG-IP, can also snat to the original client's source IP.


    the most common option is "None" which do not change the source and Automap to change the Source to SB interface

Monday, May 29, 2017

Tcpdump usage examples

Tcpdump usage examples

October 1, 2014
In most cases you will need root permission to be able to capture packets on an interface. Using tcpdump (with root) to capture the packets and saving them to a file to analyze with Wireshark (using a regular account) is recommended over using Wireshark with a root account to capture packets on an "untrusted" interface. See the Wireshark security advisories for reasons why.
See the list of interfaces on which tcpdump can listen:
tcpdump -D
Listen on interface eth0:
tcpdump -i eth0
Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater):
tcpdump -i any
Be verbose while capturing packets:
tcpdump -v
Be more verbose while capturing packets:
tcpdump -vv
Be very verbose while capturing packets:
tcpdump -vvv
Be verbose and print the data of each packet in both hex and ASCII, excluding the link level header:
tcpdump -v -X
Be verbose and print the data of each packet in both hex and ASCII, also including the link level header:
tcpdump -v -XX
Be less verbose (than the default) while capturing packets:
tcpdump -q
Limit the capture to 100 packets:
tcpdump -c 100
Record the packet capture to a file called capture.cap:
tcpdump -w capture.cap
Record the packet capture to a file called capture.cap but display on-screen how many packets have been captured in real-time:
tcpdump -v -w capture.cap
Display the packets of a file called capture.cap:
tcpdump -r capture.cap
Display the packets using maximum detail of a file called capture.cap:
tcpdump -vvv -r capture.cap
Display IP addresses and port numbers instead of domain and service names when capturing packets (note: on some systems you need to specify -nn to display port numbers):
tcpdump -n
Capture any packets where the destination host is 192.168.1.1. Display IP addresses and port numbers:
tcpdump -n dst host 192.168.1.1
Capture any packets where the source host is 192.168.1.1. Display IP addresses and port numbers:
tcpdump -n src host 192.168.1.1
Capture any packets where the source or destination host is 192.168.1.1. Display IP addresses and port numbers:
tcpdump -n host 192.168.1.1
Capture any packets where the destination network is 192.168.1.0/24. Display IP addresses and port numbers:
tcpdump -n dst net 192.168.1.0/24
Capture any packets where the source network is 192.168.1.0/24. Display IP addresses and port numbers:
tcpdump -n src net 192.168.1.0/24
Capture any packets where the source or destination network is 192.168.1.0/24. Display IP addresses and port numbers:
tcpdump -n net 192.168.1.0/24
Capture any packets where the destination port is 23. Display IP addresses and port numbers:
tcpdump -n dst port 23
Capture any packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:
tcpdump -n dst portrange 1-1023
Capture only TCP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:
tcpdump -n tcp dst portrange 1-1023
Capture only UDP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:
tcpdump -n udp dst portrange 1-1023
Capture any packets with destination IP 192.168.1.1 and destination port 23. Display IP addresses and port numbers:
tcpdump -n "dst host 192.168.1.1 and dst port 23"
Capture any packets with destination IP 192.168.1.1 and destination port 80 or 443. Display IP addresses and port numbers:
tcpdump -n "dst host 192.168.1.1 and (dst port 80 or dst port 443)"
Capture any ICMP packets:
tcpdump -v icmp
Capture any ARP packets:
tcpdump -v arp
Capture either ICMP or ARP packets:
tcpdump -v "icmp or arp"
Capture any packets that are broadcast or multicast:
tcpdump -n "broadcast or multicast"
Capture 500 bytes of data for each packet rather than the default of 68 bytes:
tcpdump -s 500
Capture all bytes of data within the packet:
tcpdump -s 0

Article first published March 13, 2010. Last updated October 1, 2014.

Wednesday, April 26, 2017

Topology settings are grayed out in SmartDashboard for an interface of a VSX object

Symptoms
  • Topology settings are grayed out in SmartDashboard for an interface of a VSX Gateway / VSX Cluster / Virtual System / Virtual Router object (SmartDashboard - VSX object - 'Topology' pane - select an interface - click on 'Edit...' - go to 'Topology' tab - refer to 'Topology' settings)
Cause
The box "Calculate topology automatically based on routing information" is checked in the object of VSX Gateway / VSX Cluster / Virtual System / Virtual Router.