English 中文(简体)
如何在python中可视化的IP地址,因为他们改变?
原标题:
  • 时间:2009-04-15 01:05:26
  •  标签:

我已经写了一个小脚本,收集外部IP地址我每次打开一个新的终端窗口,附加在当前时间,到一个文本文件。我寻找的想法在可视化的方法/多长时间我的IP地址的变化。我家庭和校园之间的反弹,可以分开使用的脚本,但是想象分开就好了。

我经常使用matplotlib。什么好主意吗?

最佳回答

绘制你的IP作为点< a href = " http://xkcd.com/195/ " rel = " nofollow noreferrer " > xkcd互联网地图< / >(或一些地图的放大子集,更好地展示不同但密切相邻IPs)。

情节每一点“堆叠”有IP与频率成正比,和颜色的IPs最近点亮,最近少点比例较暗。

问题回答

“当”一维时态数据,显示一个时间表。在更大的时间尺度,你d可能失去细节,但大多数任何阴谋的“当”这一缺陷。

“多久”,一个标准的2 d (bar)的时间和频率,分为桶每天/周/月,将是一个标准的路要走。移动平均线也可能信息。

你可以把时间轴&酒吧情节,与时间轴明显当你放大和缩小时频率显示。

酒吧情节如何随着时间的推移在横轴上每一栏的宽度在哪里你的电脑的时间举行特定的IP地址,每个酒吧的高度宽度成反比?这也给一块当vs多久阴谋。

你也可以解释数据作为< a href = " http://en.wikipedia.org/wiki/Pulse-density_modulation " rel = " nofollow noreferrer " >脉冲密度调制< / >信号,就像你得到的超音频CD。你可以画图,甚至听数据。作为一个IP的年代没有明显的时间长度变化的事件,一个脉冲的长度将是一个可调参数。类似的,你可以把数据作为一个方波(三角波,锯齿波和c),其中每个IP改变活动水平过渡。听起来像一个有趣的< a href = " http://puredata.info/ " rel = " nofollow noreferrer " > < / >纯数据项目。

有一段matplotlib用户指南中的关于绘图酒吧图表来表示范围。我从来没有做过但似乎适合你寻找什么。

Assuming you specified terminal, i ll assume you are on a UNIX variant system. Using the -f switch along with the command line utility tail can allow you to constantly monitor the end of a file. You could also use something like IBM s inotify, which can monitor file changes or dnotify (and place the file in it s own directory) which usually comes standard on most distributions (you can then call tail -n 1 to get the last line). Once the line changes, you can grab the current system time since epoch using Python s time.time() and subtract it from the time of the last change, then plot this difference using matplotlib. I assume you could categorize the times into ranges to make the graphing easier on yourself. 1 Bar for less than 1 hour change intervals, another for changes between 1 - 5 hours, and so on.

有一个Python实现的尾巴- f < a href = " http://code.activestate.com/recipes/157035/ " rel = " nofollow noreferrer " > < / >如果你不要想直接使用它。检测修改文件后,您可以执行上面的。





相关问题
热门标签