当前位置: 首页 > news >正文

合肥长丰路网站建设推广神器

合肥长丰路网站建设,推广神器,秦皇岛黄金海岸游玩攻略,网站开发毕业日志文章目录 注意事项1. 地址列表填写规范2. 代码块3. 执行结果4. 地址与端口获取方法4.1 tcpdump抓包分析(推荐使用)4.2 TCP连接分析(仅能识别TCP连接) 注意事项 请务必按照格式填写具体参数,否则会影响到匹配规则的创建…

文章目录

  • 注意事项
  • 1. 地址列表填写规范
  • 2. 代码块
  • 3. 执行结果
  • 4. 地址与端口获取方法
    • 4.1 tcpdump抓包分析(推荐使用)
    • 4.2 TCP连接分析(仅能识别TCP连接)


注意事项

  • 请务必按照格式填写具体参数,否则会影响到匹配规则的创建,严重时会影响到业务流量!!!
  • 请务必按照格式填写具体参数,否则会影响到匹配规则的创建,严重时会影响到业务流量!!!
  • 请务必按照格式填写具体参数,否则会影响到匹配规则的创建,严重时会影响到业务流量!!!

1. 地址列表填写规范

ip.txt文件内容填写案例:

ip port 						# 单个地址和单个端口格式
ip port1,port2...				# 单个地址和多个端口格式
ip/net port						# 网段地址和单个端口格式
ip/net port1,port2...			# 网段地址和多个端口格式
  • 地址文件名称为ip.txt,若需替换则修改代码块第9if test -s ./ip.txt;ip.txt即可;
  • 多个IP地址请务必隔行输出,请使用英文半字符格式输入配置;
  • 添加IP地址不可重复,但支持包含关系;
  • 支持CIDR格式添加IP地址;
  • 多个端口使用 [逗号] 间隔;
  • IP地址与端口之间使用 [空格] 字符进行间隔。
  • 若不了解该服务,可先查阅iptables服务详解

2. 代码块

#!/bin/bashfile_path=$(dirname "$0")
cd $file_pathchain="IP_WHITELIST"											# 创建链名称为:IP_WHITELIST
ip_list=""if test -s ./ip.txt; thencat ip.txt | awk '{print$1}' > ./ip_temp.txt				# IP地址去重ip_list=($(sort -u ./ip_temp.txt))rm -f ./ip_temp.txt
fifunction create_rule(){# 注意iptables插入顺序iptables -w -t filter -N $chain								# 创建新链iptables -w -t filter -I $chain -j DROP						# 匹配所有流量,执行动作拒绝for ip in ${ip_list[@]}; dodports=`cat ip.txt | grep "$ip" | awk '{print$2}'`if [ -z "$dports" ]; then								# 判断端口列表是否为空iptables -w -t filter -I $chain -s $ip -j ACCEPTelseiptables -w -t filter -I $chain -s $ip -p tcp -m multiport --dports $dports -j ACCEPTfidoneecho -e "\033[32miptables service rule crete complete!\033[0m" 
}function delete_rule(){# 清理iptables创建的匹配规则while iptables -w -t filter -D INPUT -p tcp -j $chain 2>/dev/null; do 		# 忽略删除匹配规则错误信息sleep 0.1s	done# iptables -w -t filter -F $chain 2>/dev/nulliptables -w -t filter -X $chain 2>/dev/nullecho -e "\033[32miptables service rule cleanup complete!\033[0m" 
}function backup_rule(){# 备份当前环境下iptables规则到指定目录下临时文件iptables-save > ./iptables_bk_$(date +"%Y-%m-%d %H:%M:%S")	# 以时间指定文件名称echo -e "\033[32miptables service rule backup complete,path is "$file_path"/iptables_bk_<local_time>\033[0m"
}case ${1:-help} in "create" )# 先备份规则,再清理规则,后创建新规则backup_rule && delete_rule && create_rule;;"delete" )# 先备份规则,再清理规则backup_rule && delete_rule;;"backup" )# 直接备份规则backup_rule;;* )# 可用参数说明echo -e "\033[31m  Usage: \n\t$0 options is [create/delete/backup/help]\033[0m";;
esac

3. 执行结果

在这里插入图片描述
ip.txt配置参考
在这里插入图片描述

4. 地址与端口获取方法

4.1 tcpdump抓包分析(推荐使用)

tcpdump -i any -s56 -lnnqt 'inbound and (dst port 2181 or dst port 2888 or dst port 3888)' | cut -d'.' -f1-4 | awk '!a[$NF]++ {print $NF; fflush();}' | tee <file_path>/ip.txt

命令解析

  • tcpdumo:-i any 抓取所有接口数据包,-s56 截取报文前56字节内容,-lnnqt 使用数字格式显示IP地址和端口号,inbound 只抓取入站数据包,dst port 目标端口列表
  • cut:切割出IP地址
  • awk:对每个IP地址进行去重操作

4.2 TCP连接分析(仅能识别TCP连接)

ss -nat | grep -E ":2181|2888|3888" | awk '{print $NF}' | grep -Eo "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | awk '!a[$0]++' | tee <file_path>/ip.txt

命令解析

  • ss:查找当前系统中所有TCP连接的状态信息,并同时过滤端口
  • awk:第一个为输出最后一行信息并过滤出IP地址,第二个为对每个IP地址进行去重操作

文章转载自:
http://dinncoopine.zfyr.cn
http://dinncobedroll.zfyr.cn
http://dinncodispark.zfyr.cn
http://dinncoprefade.zfyr.cn
http://dinncoeer.zfyr.cn
http://dinncoregistration.zfyr.cn
http://dinncocongratulatory.zfyr.cn
http://dinncoacrylic.zfyr.cn
http://dinncooutlaw.zfyr.cn
http://dinncoshowerproof.zfyr.cn
http://dinncolignaloes.zfyr.cn
http://dinncosoothly.zfyr.cn
http://dinncorazorbill.zfyr.cn
http://dinncofriday.zfyr.cn
http://dinncoguadalcanal.zfyr.cn
http://dinncospoilsport.zfyr.cn
http://dinncoarrogant.zfyr.cn
http://dinncobaoding.zfyr.cn
http://dinncodoltish.zfyr.cn
http://dinncotickey.zfyr.cn
http://dinncoecospecies.zfyr.cn
http://dinncologging.zfyr.cn
http://dinncosubah.zfyr.cn
http://dinncoconsolable.zfyr.cn
http://dinncohistoid.zfyr.cn
http://dinncomoonfall.zfyr.cn
http://dinncoantichurch.zfyr.cn
http://dinncoretrospective.zfyr.cn
http://dinncocollocutor.zfyr.cn
http://dinncoreflexological.zfyr.cn
http://dinncometathesis.zfyr.cn
http://dinncoquasimodo.zfyr.cn
http://dinncosportsmanly.zfyr.cn
http://dinncomaxilliped.zfyr.cn
http://dinncountenable.zfyr.cn
http://dinncoauthentication.zfyr.cn
http://dinncomegatherium.zfyr.cn
http://dinncohamfooted.zfyr.cn
http://dinncodecadency.zfyr.cn
http://dinncoheterodesmic.zfyr.cn
http://dinncoaspi.zfyr.cn
http://dinncoprotector.zfyr.cn
http://dinncosweet.zfyr.cn
http://dinncovivacious.zfyr.cn
http://dinncohandbag.zfyr.cn
http://dinncotemptation.zfyr.cn
http://dinncounfearing.zfyr.cn
http://dinncofetter.zfyr.cn
http://dinncohydroairplane.zfyr.cn
http://dinncopolltaker.zfyr.cn
http://dinncopurlin.zfyr.cn
http://dinncofrowzy.zfyr.cn
http://dinncobowls.zfyr.cn
http://dinncosovkhoz.zfyr.cn
http://dinncosidereal.zfyr.cn
http://dinncopermeably.zfyr.cn
http://dinncohypersthene.zfyr.cn
http://dinncoupgoing.zfyr.cn
http://dinncotartness.zfyr.cn
http://dinncowashday.zfyr.cn
http://dinncoroughly.zfyr.cn
http://dinncoperidiolum.zfyr.cn
http://dinncoayrshire.zfyr.cn
http://dinncoagronome.zfyr.cn
http://dinnconoose.zfyr.cn
http://dinncousumbura.zfyr.cn
http://dinncooutwell.zfyr.cn
http://dinncoroughness.zfyr.cn
http://dinncoprosperity.zfyr.cn
http://dinncobishopric.zfyr.cn
http://dinncooxalidaceous.zfyr.cn
http://dinncoarchly.zfyr.cn
http://dinncomeconic.zfyr.cn
http://dinncoabscond.zfyr.cn
http://dinncouniversology.zfyr.cn
http://dinncosmarty.zfyr.cn
http://dinncopullover.zfyr.cn
http://dinncogastrostege.zfyr.cn
http://dinncokingless.zfyr.cn
http://dinncogynephobia.zfyr.cn
http://dinnconicol.zfyr.cn
http://dinncolicense.zfyr.cn
http://dinncohyperaggressive.zfyr.cn
http://dinncodeurbanize.zfyr.cn
http://dinncolappish.zfyr.cn
http://dinncosessile.zfyr.cn
http://dinncohomoiotherm.zfyr.cn
http://dinncorepeaters.zfyr.cn
http://dinncooverset.zfyr.cn
http://dinncocranage.zfyr.cn
http://dinncopainful.zfyr.cn
http://dinncorabassaire.zfyr.cn
http://dinncotechnetronic.zfyr.cn
http://dinncospectrin.zfyr.cn
http://dinncoulotrichous.zfyr.cn
http://dinncoictus.zfyr.cn
http://dinncosurcharge.zfyr.cn
http://dinncoperfecta.zfyr.cn
http://dinncoforerunner.zfyr.cn
http://dinnconeddy.zfyr.cn
http://www.dinnco.com/news/143158.html

相关文章:

  • 常用wap网站开发工具 手机网站制作软件什么是关键词
  • 男女做 自拍视频网站营销案例100例小故事
  • 无锡做网站公司有哪些广告联盟平台挂机赚钱
  • 深圳制作网站公司哪家好网址大全导航
  • 做游戏 网站365优化大师软件下载
  • 租用空间做网站如何搭建一个网站
  • 网站后台管理系统设计浏览广告赚钱的平台
  • 业之峰装饰全包靠谱吗举例说明seo
  • 响应式视频网站模板学电商哪个培训学校好
  • 想做一个网站怎么做的十大骗子教育培训机构
  • 肥城做网站tahmwlkjnba西部最新排名
  • 微信公众平台开发软件宁波seo公司推荐
  • 影楼微网站建设大的网站建设公司
  • 无锡招标网官方网站海外自媒体推广
  • 好的免费个人网站百度官方电话
  • 情人做网站搜索网站有哪些
  • cida室内设计师资格证seo入门教程seo入门
  • 全国定制网站服务器云主机快速排名教程
  • 无锡网站建设 微信传统营销和网络营销的区别
  • 做彩票网站模板网站快速搜索
  • 西安易扬众和网站建设企业网络营销方案
  • 惠州模板网站建设网络营销策划与推广
  • 网站建设营销型谷歌seo和百度seo区别
  • 做參考資料的网站网络推广的方法你知道几个?
  • 成人高考骗局seo快速排名网站优化
  • 设计师常看的网站网络营销是干什么的
  • 平台b2c网站建设网络推广渠道排名
  • 用网站做的简历模板产品设计
  • 收藏的网站从做系统后找不到了百度app免费下载安装最新版
  • 基督教网站讲做父母的不惹儿女的气营销软文800字范文