note of SHELL (四)

#--------------------------------------------------------------
#
#
#!/bin/sh
line_length=20
line_count=$1
char="*"
 
function usage
{
  name=$(basename $0)
  echo -e "usage:$name line_count_number/n"
  exit 1
}

argc=$#
[[ ! $argc -eq 1 ]] && usage

length=0
count=0
>"test.txt"
file="test.txt"

  while [[ $count -le $line_count ]]  ;do
while [[ $length -le $line_length ]]  ;do
    echo -e "${char}/c">>$file
    ((length = length+1))
    done
    echo >>$file
    ((count = count+1))
    done

 

#----------------------------------------------
#name:random2.sh
#note:generate a limited random number
#!/bin/sh
function check
{
  argc=$#
  if [[ $argc -lt 1 ]] ;then
    echo -e "ERROR! usage: $0 limit_number/n"
    exit
    fi
}

function random
{
  echo -e "the random number is :$RANDOM/n"
}

function limit_random
{
  result=$(($RANDOM%$NUMBER+1))
  echo -e "the limit number is :$result/n"
}

NUMBER=$1
#check

if [[ -z $1 ]] ;then
  random
  else
  limit_random
  fi

 

#----------------------------------
#name:read2.sh
#note:read 2 variables from a file
#!/bin/sh
while   read a  b   ;do
  if [ "$a" = "ok" ] || [ "$b" = "ok" ] ;then
    echo -e " you are passed/n"
  fi
done<test

 

 

#---------------------------------------------------------
#
#
#!/bin/sh
i=0
while (read data) ;do
${a[$i]}=$data
((i=i+1))
done<"test.txt"

echo -e "${ a[0]}/n"

 

  

#--------------------------------------------------
#name:recursive.sh
#note:calculate  a recursive  number
#!/bin/sh
if [ -z $1 ] ;then
echo -e "usage:$0 recursive_number/n"
exit 1
fi
  
recursive ()
{
     local  number=$1
  if [ $number -eq 0  ] ;then
   result=1
  else
  let "decnum=$number-1"
  recursive $decnum
  let "result=$number*$?"
  fi
  return $result
}
recursive $1
echo -e  "the recusive of $1 is $result/n"

 

#---------------------------------------------------------
#name:search.sh
#note:return the result of searching
#!/bin/sh
PATTERN=$1
FILENAME=$2
grep "$PATTERN" $FILENAME>/dev/null
if [[ $? -eq 0 ]] ;then
  echo -e "$PATTERN is found in this file/n"
  else
  echo -e "$PATTERN is not here/n"
  fi

 

##########################################################
#!/bin/sh
#scriptname:select.sh
#purpose:select.....do......done
function choose
{
echo -e "choose one person/n"
select choice in peter YangTT ;do
case $choice in
peter)
echo -e "He will success/n"
break ;;
YangTT)
echo -e "I love this girl so much/n"
break ;;
*)
echo -e "please choose again/n";;
esac
done
}
choose

 

#####################################
#
#
#!/bin/sh
set `date`
while [[ $# -gt 0 ]]
do
  echo  "$1"
  shift
done

 

######################################
#################testfile#############
#apple
#pear
#peach
#banana
#
#scriptname:speller.sh
#purpose:read a line from a file,and update the content
#!/bin/sh
exec <testfile
while read fruit ;do
  echo -e "Do you like $fruit(y/n)/n"
  read answer</dev/tty
  case $answer in
  n|N)
  echo -e "OK,Type what you like/n"
  read new</dev/tty
  sed -e s/$fruit/$new/ testfile>tmp
  mv tmp testfile
  echo -e "updata success/n";;
  *)
  echo -e "skiping /n";;
  esac
done
  

 

###############################################
#scriptname:square.sh
#purpose:calculate number's square
#!/bin/sh
function square
{
  ((result=$1*$1))
  echo -e "the result of square $1 is $result/n"
}

echo -e "input a number/n"
read data
square $data

 

 

#------------------------------------------------
#
#
#!/bin/sh
string=$1
argc=$#
if [[ ! $argc -eq 1 ]] ;then
  echo -e "usage:$0 test_string/n"
fi

case $gtring in
+([0-9]))
echo -e "it is number/n"
;;
+([a-zA-Z]))
echo -e "it is character/n"
;;
*)
echo -e  "unknown/n"
;;
esac
  

 

 

##############################################################
#scriptname:trap2.sh
#purpose:using trap function
#!/bin/sh
trap 'echo -e "ctrl+c will not terminate this programme/n"' 2
echo -e "type /"stop/" to exit/n"
while true
do
  echo -n "switch->"
  read data
  if [ $data = "stop" ] ;then
    break
  fi
done

 

 

 

#------------------------------------------
#name:trap.sh
#note:ctrl+c  signal 2,when hit ctrl+c ,execute function hi and exit
#!/bin/sh
function hi
{
  echo -e "hi,all!!/n"
}

trap 'hi ;exit 1'  2


read hi
echo $hi

 

 

 

#-------------------------------------------
#name:update.sh
#note:creating a specified file
#!/bin/sh
clear
echo -e "/nDo you want to create a file?(Y|N)/n"
read answer
case $answer in
Y|y)  ;;
*)  echo -e "/n all right ,operation is cancle!/n";;
esac

cat /dev/null >test

for input in wuhan danian shanghai beijing ;do
    echo $input >>test
done
  

 

 

 

#--------------------------------------------------
#name:print_pic
#note:print a figure
#!/bin/sh
a=0
while true ;do
  a=$(expr $a + 1) ;
  case $a in
  1) echo -e "+/c" ;;
  2) echo -e "*/c" ;;
  3) echo -e "*/c" ;;
  4) echo -e "*/c" ;;
  5) echo -e "*/c" ;;
  6) echo -e "*/c" ;;
  7) echo -e "*/c" ;;
  8) echo -e "*/c" ;;
  9) echo -e "*/c" ;;
  10) echo -e "+/n" ;;
  *)  echo "finish!"
   exit 0 ;;
  esac
  sleep 1
  done

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
As an AI language model, I do not have the capability to run SQLmap shell. However, I can provide you with information on SQLmap and how to use it. SQLmap is a tool used for automated SQL injection and database takeover. It can detect and exploit various vulnerabilities in a website or web application. With its powerful features, SQLmap can extract sensitive data, dump database tables, and even gain administrative access to the target system. To use SQLmap, you need to have a basic understanding of SQL injection and how it works. You also need to have Python installed on your system, as SQLmap is written in Python. Here are the basic steps to use SQLmap: 1. Download SQLmap from its official website or GitHub repository. 2. Open a terminal window and navigate to the location where SQLmap is installed. 3. Use the following command to start SQLmap: ``` python sqlmap.py ``` 4. Next, you need to provide the target URL or IP address of the website or web application you want to test. Use the following command: ``` python sqlmap.py -u <target_url> ``` 5. SQLmap will start scanning the target for SQL injection vulnerabilities. Once it finds a vulnerability, it will prompt you to confirm whether you want to exploit it. 6. If you choose to exploit the vulnerability, SQLmap will start extracting data from the target database. You can use various options and commands to customize the data extraction process. 7. Once SQLmap has extracted the data, you can save it to a file or view it in the terminal. Note that SQLmap is a powerful tool that can cause damage if used improperly. It is important to use it ethically and with permission from the target website or web application owner.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值