Mysql Dump restore Variable Set

image_pdfimage_print

Mysql Dump restore Variable Set

 

Php – SecLib – Encryption

image_pdfimage_print

 

 

 

Reference : http://phpseclib.sourceforge.net/

Encoding Codes

image_pdfimage_print
  • cp1250 (Central Europe)
  • cp1251 (Cyrillic)
  • cp1252 (Western Europe)
  • cp1253 (Greek)
  • cp1254 (Turkish)
  • cp1255 (Hebrew)
  • cp1257 (Baltic)
  • cp1258 (Vietnamese)
  • cp874 (Thai)
  • ISO-8859-1 (Western Europe)
  • ISO-8859-2 (Central Europe)
  • ISO-8859-4 (Baltic)
  • ISO-8859-5 (Cyrillic)
  • ISO-8859-7 (Greek)
  • ISO-8859-9 (Turkish)
  • ISO-8859-11 (Thai)
  • ISO-8859-15 (Western Europe)
  • ISO-8859-16 (Central Europe)
  • KOI8-R (Russian)
  • KOI8-U (Ukrainian)

Example PHP usage

 

How to: Mount a SFTP Folder (SSH + FTP) on Ubuntu Linux using SSHFS & Fuse

image_pdfimage_print

Purpose: to mount a remote directory on my local Ubuntu Linux Desktop system using SFTP (which is SSH in an FTP-like fashion).

The goal is to easily gain access to a remote system’s files through another folder on my desktop. Debina/Ubuntu allows you to easily mount SSH folders via the GUI, however, these mounts won’t show up in the terminal (and in some programs).

sshfs to accomplish this.

 Ubuntu’s SSHFS documentation here.

Sshfs and mount

 

  1. add your username to the fuse group.
    1. On Ubuntu, you would open a terminal window and perform the following:

 

  • SFTP server. I created a folder on my desktop called sftp.
  • Once the folder has been created, simply run sshfs using the appropriate login information (host username and IP), the host and local directories, and the SFTP connection is mounted on a folder on my desktop.

Ref: creating a bash alias

 

possible errors and workarounds

 

Create a bash alias to save time and typing


  •  

unmount

Hard drive speed test using Linux command line and hdparm

image_pdfimage_print
Note that all tests should be run multiple times and average time should be calculated to get more accurate result.

Bypassing hard drive’s buffer cache memory thus reading directly from the disk.

Read data from the second half of the disk that is if the hard drive size is 100GB.

To obtain cached reads run the following command:

Tcpdump Best Practices

image_pdfimage_print

List of interfaces on which tcpdump can listen:


Listen on interface eth0:

Listen on any available interface :

Be verbose while capturing packets:

More verbose while capturing packets:

Very verbose while capturing packets:

Verbose and print the data of each packet in both hex and ASCII, excluding the link level header:

Verbose and print the data of each packet in both hex and ASCII, also including the link level header:

Less verbose (than the default) while capturing packets:

Limit the capture to 100 packets:

Record the packet capture to a file called 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:

Display the packets of a file called capture.cap:

Display the packets using maximum detail of a file called capture.cap:

Display IP addresses and port numbers instead of domain and service names when capturing packets

Capture any packets where the destination host is 192.168.5.1. Display IP addresses and port numbers:

Capture any packets where the source host is 192.168.5.1. Display IP addresses and port numbers:

Capture any packets where the source or destination host is 192.168.5.1. Display IP addresses and port numbers:

Capture any packets where the destination network is 192.168.5.0/24. Display IP addresses and port numbers:

Capture any packets where the source network is 192.168.1.0/24. Display IP addresses and port numbers:

Capture any packets where the source or destination network is 192.168.5.0/24. Display IP addresses and port numbers:

Capture any packets where the destination port is 23. Display IP addresses and port numbers:

Capture any packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

Capture only TCP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

Capture only UDP packets where the destination port is is between 1 and 1023 inclusive. Display IP addresses and port numbers:

Capture any packets with destination IP 192.168.1.1 and destination port 23. Display IP addresses and port numbers:

Capture any packets with destination IP 192.168.5.1 and destination port 80 or 443. Display IP addresses and port numbers:

Capture any ICMP packets:

Capture any ARP packets:

Capture either ICMP or ARP packets:

Capture any packets that are broadcast or multicast:

Capture 500 bytes of data for each packet rather than the default of 68 bytes:

Capture all bytes of data within the packet: