题目: 获得访问前10位的ip地址 答案: awk '{print $1}' access.log | sort | uniq -c | sort access.log 172.16.8.11 - - [19/Sep/2018:12:35:21 +0800] "GET /console/stat/o ...
分类:
系统相关 时间:
2020-02-09 13:11:54
阅读次数:
113
for ((i=1;i<=10;i++)); do list_num = $(sed -n $i'p' /tmp/ip.txt |awk '{print $1}') list_ip = $(sed -n $i'p' /tmp/ip.txt |awk '{print $2}') if [ $list_ ...
分类:
系统相关 时间:
2020-02-08 13:43:21
阅读次数:
86
python中可以用来格式化日期的模块可以是time或者datetime,如果要进行时间偏移的话,可以使用datetime模块。 time模块: time.strptime(str, format)将字符串转为struct_time对象。 time.strftime(format, t),将stru ...
分类:
编程语言 时间:
2020-02-07 20:27:06
阅读次数:
68
python时间戳 将时间戳转为日期 #!/usr/bin/python # -*- coding: UTF-8 -*- # 引入time模块 import time #时间戳 timeStamp = 1581004800 timeArray = time.localtime(timeStamp) ...
分类:
编程语言 时间:
2020-02-07 16:45:36
阅读次数:
54
题目: 查看当前连接SYN的IP数 答案: netstat -an | grep SYN | awk '{print $5}' | awk -F: '{print $1}' | uniq -c | sort -nr | more 运行结果: ...
分类:
系统相关 时间:
2020-02-07 12:57:58
阅读次数:
61
题目: 根据端口号列出进程号 答案: sudo netstat -ntlp | grep 22 | awk '{print $7}' | cut -d/ -f1 运行结果: linux cut 命令: cut 命令从文件的每一行剪切字节、字符和字段并将这些字节、字符和字段写至标准输出。 如果不指定 ...
分类:
系统相关 时间:
2020-02-07 12:27:36
阅读次数:
100
题目: 用tcpdump嗅探80端口的访问 答案: sudo tcpdump -i ens33 -tnn dst port 80 -c 1000 | awk -F"." '{print $1"."$2"."$3"."$4}' | sort | uniq -c | sort -nr | head -n ...
分类:
系统相关 时间:
2020-02-06 12:51:35
阅读次数:
83
题目: 获取前10个time_wait连接最多的IP地址 答案: netstat -n | grep TIME_WAIT | awk '{print $5}' | uniq -c | sort -nr | head -n10 ...
分类:
系统相关 时间:
2020-02-06 12:31:36
阅读次数:
69
1、函数的定义 面向过程,面向对象,函数式编程。这是编程的方法论。 面向对象的独门秘技是类,class。面向过程的独门秘技是过程,def。函数式编程的独门秘技是函数,def。 过程就是没有返回值的函数。但是在python中,过程会返回none. 1 def func1(): 2 #testing1 ...
分类:
其他好文 时间:
2020-02-06 01:03:23
阅读次数:
67
Linux编程获取本机IP地址的几种方法 参考:https://blog.csdn.net/zhongmushu/article/details/89944990 在进行Linux网络编程时,经常会需要获取本机IP地址,除了常规的读取配置文件外,本文罗列几种个人所知的编程常用方法,仅供参考,如有错误 ...
分类:
系统相关 时间:
2020-02-05 16:17:08
阅读次数:
110