Enterprise Face question 1:
The following string is known to be passed random number variable After intercepting the results, please crack these strings corresponding to the md5sum ago corresponding numbers?
21029299
00205d1c
a3da1677
1f6d12dd
890684b
Problem-solving ideas: the way to pass a parameter each time, to achieve sequential cracking
The range of $RANDOM is 0-32767
#!/bin/bash # author: liuwei #Site: www.51liuzw.com for n in {0..32767} do md5= ' echo $n | md5sum | cut -c 1-8 ' if [ "$MD 5" == "$" ];then echo "$n is." exit else echo "$n no." fi done
Note: You can also use the method of defining an array to compare all at once
#!/bin/bash #Author: liuwei #Site: Www.51liuzw.com array= ( 00205d1c 21029299 a3da1677 1f6d12dd 890684b ) for n in {0..32767} do md5= ' echo $n | Md5sum | cut -c 1-8 ' for i in ${array[@]};d o if [ "$MD 5" == "$i" ];then echo "$n and $i" >> c.log break else echo "$n no." fi done done
# Cat C.log
1346 and 00205d1c
7041 and 1F6D12DD
25345 and a3da1677
25667 and 21029299
Enterprise Face question 2: Batch Check multiple Web site addresses are normal
Requirements: Shell array method Implementation, detection strategy as far as possible to simulate user access ideas
Http://www.baidu.com
Http://www.taobao.com
Http://www.51liuzw.com
http://192.168.50.199
#!/bin/bash#author: liuwei#site: www.51liuzw.comarray= (HTTP// www.baidu.comhttp://www.taobao.comhttp://www.51liuzw.comhttp://192.168.50.199) for n in ${array[ *]};d o url= ' curl -i -m 2 $n 2> /dev/null | egrep "200|302" | wc -l ' if [ "$URL" -eq 1 ];then echo "$n is ok" else echo "$n is not ok" fidone
Results:
#sh test.sh
http://www.baidu.com is OK
Http://www.taobao.com is OK
Http://www.51liuzw.com is not OK
http://192.168.50.199 is not OK
Enterprise Face question 3: : Use Shell to process the following content
1 , sorted by the frequency of word occurrence in descending order!
2 , in descending order by the frequency of letters!
The Squid project provides a number of resources toassist users design,implement and support squid installations. Browsethe documentation and support sections for more infomation
1. Sort by the frequency of word occurrences in descending order!
Workaround: Change the spaces to line breaks and sort the statistics
#sed ' s# #\n#g ' c.txt | Sort | Uniq-c
2. descending order by the frequency of letters!
Solution: Use Grep-o "\w" to take apart the words and remove the symbols of the species.
#cat C.txt | Grep-o "\w" | Sort | Uniq-c
This article is from the "burning Years of Passion" blog, please be sure to keep this source http://liuzhengwei521.blog.51cto.com/4855442/1773814
Several shell face questions and answers