Bash check IP and port
来源:互联网 发布:淘宝客服旺旺号是多少 编辑:程序博客网 时间:2024/05/18 02:25
33 #check arguments
34
35 #check ip
36 pattern_ip="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))$"
37 #pattern_ip="^((1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}(1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$"
38
39 if [[ !(($1 =~ $pattern_ip) && ($3 =~ $pattern_ip)) ]] ; then
40 echo "from_ip or to_ip has errors!"
41 exit 0
42 fi
43
44 #check port
45 pattern_port="^([0-9]{1,4}|[1-5][0-9]{4}|6[0-5]{2}[0-3][0-5])$"
46 if [[ !($2 =~ $pattern_port) ]]; then
47 echo "port has erros!"
48 exit 0;
49 fi
34
35 #check ip
36 pattern_ip="^(([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))$"
37 #pattern_ip="^((1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))\.){3}(1?[0-9]?[0-9]|2([0-4][0-9]|5[0-5]))$"
38
39 if [[ !(($1 =~ $pattern_ip) && ($3 =~ $pattern_ip)) ]] ; then
40 echo "from_ip or to_ip has errors!"
41 exit 0
42 fi
43
44 #check port
45 pattern_port="^([0-9]{1,4}|[1-5][0-9]{4}|6[0-5]{2}[0-3][0-5])$"
46 if [[ !($2 =~ $pattern_port) ]]; then
47 echo "port has erros!"
48 exit 0;
49 fi
0
上一篇:Use clonezilla to clone and restore disk
下一篇:Linux 内核中的 GCC 特性(转)
相关热门文章
- linux 常见服务端口
- 什么是shell
- linux socket的bug??
- linux的线程是否受到了保护?...
- 一个适用于windows和linux的抓...
- shell将变量当命令执行问题【...
- 深入理解Linux网络技术内幕-设...
- 高性能网络I/O框架-netmap源码...
- 深入理解Linux网络技术内幕-...
- Linux下bin文件的安装
给主人留下些什么吧!~~
评论热议
- Bash check IP and port
- linux check process and port relation
- how to check port number and kill process with the port number
- check server port
- check-ip
- check localhost port in use
- Connection to localhost:5432 refused. Check that the hostname and port are correct and that the post
- Failed to connect to Xilinx hw_server. Check if the hw_server is running and correct TCP port is used.
- Failed to connect to Xilinx hw_server. Check if the hw_server is running and correct TCP port is used.
- telnet ip port
- linux port ip
- 获取Ip、Port
- tcp-ip Port Numbers
- nginx tomcat ip port
- check file exist bash script
- Check internet access using bash
- metaploit安装错误is the server running locally and accepting TCP IP on port 7337
- Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?
- Some interesting C problems
- 利用ftrace调试内核
- vim multifile edit
- vim diff two files
- Use clonezilla to clone and restore disk
- Bash check IP and port
- Linux 内核中的 GCC 特性(转)
- php快速学习之php的控制语句(有其他语言基础适用)
- android 休眠唤醒机制分析(三) — suspend
- Java 理论与实践: 并发集合类
- 百分百解决解决JSP中文乱码问题
- java 从1到1亿随机 找出未出现的数字
- android启动加速
- android从raw里面读取txt文件
原创粉丝点击
热门IT博客
热门问题
老师的惩罚
人脸识别
我在镇武司摸鱼那些年
重生之率土为王
我在大康的咸鱼生活
盘龙之生命进化
天生仙种
凡人之先天五行
春回大明朝
姑娘不必设防,我是瞎子
绿字笔顺
绿字的笔顺
绿多音字组词
绿字开头成语
什么黄什么绿四字词语
绿字组词
绿字成语
什么柳绿四字词语成语
绿字拼音怎么打
绿字几画
形容绿的四字词语
绿什么红什么四字成语
表示绿的词语四字词语
表示绿的意思的四字词语
绿字的笔顺正确的写法
带绿字的成语
关于绿的四字成语大全
绿字开头的成语接龙
表示绿的四字成语大全
绿的四字词语有哪些
绿字的拼音在键盘上怎么拼
绿的多音字组词和拼音
表示绿的字
描写绿的词语四字词语
带绿的四字词语大全集
带有绿的四字词语
绿山墙的安妮读后感300字
形容绿的四字词语有哪些
绿山墙的安妮主要内容20字
关于绿的四字词语
绿的多音字组词
表示绿的四字词语有哪些
绿的多音字
绿组词三个字
绿是多音字吗
绿字
绿宝
绿能宝
挂绿
绿颊锥尾鹦鹉
绿狐尾藻