Linux shell scripts random related applications and batch modification build exercises

Source: Internet
Author: User
Tags openssl

I. Three ways to take random numbers and encrypt them


1.random of Fetch and encryption

The method of taking the number:

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/14/dba3bd986bd100e199cecf8a1067e559.png "title=" Screenshot from 2017-11-14 21-25-09.png "alt=" Dba3bd986bd100e199cecf8a1067e559.png "/>


To take the random number method:

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/14/588d71e5632163855c0686d5f4a8e26b.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-27-46.png "alt=" 588d71e5632163855c0686d5f4a8e26b.png "/>


To take a random number and encrypt the method:

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/14/5687a202b63ccf88603fde8bfeaa0f38.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-29-08.png "alt=" 5687a202b63ccf88603fde8bfeaa0f38.png "/>


To intercept a different number of bits after encryption:

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/14/2517e25d72af8db15f289e883277f7cf.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-29-15.png "alt=" 2517e25d72af8db15f289e883277f7cf.png "/>


2.data time take random number and Encrypt

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/14/1b30300fc123ff111ead3515636aed4c.png "title=" Screenshot from 2017-11-14 21-33-12.png "alt=" 1b30300fc123ff111ead3515636aed4c.png "/>


3.openssl take random numbers and encrypt

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/14/64f3ee8bc18a22b2a54d75ef03a7aa62.png "title=" Screenshot from 2017-11-14 21-54-31.png "alt=" 64f3ee8bc18a22b2a54d75ef03a7aa62.png "/>


Two. Application of random numbers

1. Batch Create a file that starts with a random number

Topic 1: Create a 10-beginning random number with 10 lowercase letters in the/westos directory, ending with a _westos.html file

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/14/d1e555a42618871aa7f1fc8ac0a889c5.png "title=" Screenshot from 2017-11-14 21-42-27.png "alt=" D1e555a42618871aa7f1fc8ac0a889c5.png "/>


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/14/a7250c9e6a4a30046abe8e48c96402d5.png "title=" Screenshot from 2017-11-14 21-37-06.png "alt=" A7250c9e6a4a30046abe8e48c96402d5.png "/>


Topic 2: Converting HTML into HTML in bulk

The first method for

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/14/af33b7060c668f4f4883c595a5d4d204.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-50-15.png "alt=" Af33b7060c668f4f4883c595a5d4d204.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/14/65ea81c29be36529d9b59f9f8d6056bb.png "title=" Screenshot from 2017-11-14 21-50-26.png "alt=" 65ea81c29be36529d9b59f9f8d6056bb.png "/>


The second method AWK

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/14/e73fab9812a5d73dce81579b62605926.png "title=" Screenshot from 2017-11-14 22-00-34.png "alt=" E73fab9812a5d73dce81579b62605926.png "/>



Topic 3: Create 10 random numbers starting with 10 lowercase letters in the/westos directory, ending with _westos followed by a two-bit ordinal. html file


Note: The following script uses two methods for generating random encryption numbers: random and OpenSSL


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/14/ba0b33f6bfe7da62ac32789c495e2415.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-41-45.png "alt=" Ba0b33f6bfe7da62ac32789c495e2415.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/14/922df878520b943ee77963a29d0f0238.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-41-55.png "alt=" 922df878520b943ee77963a29d0f0238.png "/>



2. Batch create the user with serial number, and the password is random number, and output to the file

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/14/43b1707e68326a78167e081f0b5e95b8.png "title=" Screenshot from 2017-11-14 21-43-16.png "alt=" 43b1707e68326a78167e081f0b5e95b8.png "/>


Operation Result:

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/14/242e470b5304ead0a8b554c2ff3161cb.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-45-04.png "alt=" 242e470b5304ead0a8b554c2ff3161cb.png "/>


To view the output file:

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/14/6e57c958a7b958127f3922d5b13ec52e.png "style=" float: none; "Title=" screenshot from 2017-11-14 21-45-34.png "alt=" 6e57c958a7b958127f3922d5b13ec52e.png "/>


To delete a user created in bulk:

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/14/9ca6a5cd006579d82d676a8d6d8f5d4f.png "title=" Screenshot from 2017-11-14 21-46-56.png "alt=" 9ca6a5cd006579d82d676a8d6d8f5d4f.png "/>



3. Convert the encrypted key to a number before encryption (crack encryption)

Defines an array of encrypted text that needs to be cracked

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/14/db3ad13743dd264478f1b99981cb5f75.png "style=" float: none; "Title=" screenshot from 2017-11-14 22-09-00.png "alt=" Db3ad13743dd264478f1b99981cb5f75.png "/>


FUNGETMD5 to generate all random encryption, a total of 32,767

FUNFINDMD5 is compared with the encryption in the array.

Adjust the cut's number of digits if not


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/14/b50a3ab1443fd8141b74e4e1b22d1768.png "style=" float: none; "Title=" screenshot from 2017-11-14 22-09-07.png "alt=" B50a3ab1443fd8141b74e4e1b22d1768.png "/>







Linux shell scripts random related applications and batch modification build exercises

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.