数仓拉链表使用

This article was originally published on Christian’s blog and republished here with his permission. Check out the rest of his very interesting writing over there if you’d like to learn about IoT, cryptocurrencies, PHP, and more!

本文最初发布在Christian的博客上,并在他的允许下在此处重新发布。 如果您想了解有关物联网,加密货币,PHP等的更多信息,请查看他在那非常有趣的其他文章!



If you have ever hosted a website or even administrated a server, you’ll be very well aware of bad people trying bad things with your stuff.

如果您曾经托管过一个网站,甚至管理过一台服务器,您都会非常了解坏人会用您的东西尝试坏事。

When I first hosted my own little linux box with SSH access at age 13, I read through the logs daily and reported the IPs (mostly from China and Russia) who tried to connect to my sweet little box (which was actually an old ThinkPad T21 with a broken display running under my bed) to their ISPs.

当我在13岁时首次托管自己的带有SSH访问权限的小Linux盒时,我每天阅读日志并报告试图连接到我的小盒(实际上是旧的ThinkPad T21)的IP(主要来自中国和俄罗斯)并在ISP的下面显示损坏的显示器)。

Actually, if you have a linux server with SSH exposed you can see how many connection attempts are made every day:

实际上,如果您的Linux服务器公开了SSH,则可以看到每天进行了多少次连接尝试:

grep 'authentication failures' /var/log/auth.log

WordPress注定了我们所有人 (WordPress Has Doomed Us All)

OK, to be honest, web vulnerability scanners have existed before WordPress, but since WP is so widely deployed most web vulnerability scanners include scans for some misconfigured wp-admin folders or unpatched plugins.

好的,老实说,Web漏洞扫描程序早在WordPress之前就已存在,但是由于WP部署如此广泛,因此大多数Web漏洞扫描程序都包含对某些配置错误的wp-admin文件夹或未修补的插件的扫描。

So if a small, new hacking group wants to gain some hot cred they’ll download one of these scanner things and start testing against many websites in hopes of gaining access to a site and defacing it.

所以,如果一个小的,新的黑客集团希望获得一些热点CRED他们会下载一个的这些扫描仪的东西 ,并开始在获得一个网站,并希望能对许多网站的测试面目全非了。

This is why all server or website admins have to deal with gigabytes of logs full with scanning attempts. So I was wondering..

这就是为什么所有服务器或网站管理员都必须通过扫描尝试来处理千兆字节的日志。 所以我想知道..

有没有办法反击? (Is there a way to strike back?)

After going through some potential implementations with IDS or Fail2ban I remembered the ZIP bombs from the old days.

在使用IDS或Fail2ban进行了一些潜在的实现之后,我记得过去的ZIP炸弹 。

什么是ZIP炸弹? (WTH is a ZIP bomb?)

So it turns out ZIP compression is really good with repetitive data so if you have a really huge text file which consists of repetitive data like all zeroes, it will compress it really good. Like REALLY good.

因此,事实证明ZIP压缩对重复数据确实非常好,因此,如果您有一个非常大的文本文件,其中包含重复数据(如全零),则它将非常好。 真的很不错。

As 42.zip shows us, it can compress a 4.5 peta byte (4.500.000 giga bytes) file down to 42 bytes. When you try to actually look at the content (extract or decompress it) then you’ll most likely run out of disk space or RAM.

正如42.zip向我们展示的那样,它可以将4.5 PB字节(4.500.000千兆字节)的文件压缩为42字节。 当您尝试查看内容(提取或解压缩)时,很可能会用完磁盘空间或RAM。

如何用ZIP炸弹外阴扫描仪? (How can I ZIP bomb a vuln scanner?)

Sadly, web browsers don’t understand ZIP, but they do understand GZIP.

可悲的是,Web浏览器不了解ZIP,但他们了解GZIP。

So firstly we’ll have to create the 10 gigabyte GZIP file filled with zeroes. We could make multiple compressions but let’s keep it simple for now.

因此,首先我们必须创建10 GB的GZIP文件,其中填充了零。 我们可以进行多次压缩,但现在让我们保持简单。

dd if=/dev/zero bs=1M count=10240 | gzip > 10G.gzip

As you can see, it’s 10 MB large. We could do better but good enough for now.

如您所见,它的大小为10 MB。 我们现在可以做得更好,但足够好。

Now that we have created this thing, let’s set up a PHP script that will deliver it to a client.

现在我们已经创建了这个东西,让我们设置一个PHP脚本将其交付给客户端。

<?php
//prepare the client to recieve GZIP data. This will not be suspicious
//since most web servers use GZIP by default
header('Content-Encoding: gzip');
header('Content-Length: '.filesize('10G.gzip'));
//Turn off output buffering
if (ob_get_level()) ob_end_clean();
//send the gzipped file to the client
readfile('10G.gzip');

That’s it!

而已!

We could use this as a simple defense like this:

我们可以将其用作像这样的简单防御:

<?php
$agent = lower($_SERVER['HTTP_USER_AGENT']);
//check for nikto, sql map or "bad" subfolders which only exist on wordpress
if (strpos($agent, 'nikto') !== false || strpos($agent, 'sqlmap') !== false || startswith($url,'wp-') || startswith($url,'wordpress') || startswith($url,'wp/'))
{
sendBomb();
exit();
}
function sendBomb(){
//prepare the client to recieve GZIP data. This will not be suspicious
//since most web servers use GZIP by default
header("Content-Encoding: gzip");
header("Content-Length: ".filesize('10G.gzip'));
//Turn off output buffering
if (ob_get_level()) ob_end_clean();
//send the gzipped file to the client
readfile('10G.gzip');
}
function startsWith($haystack,$needle){
return (substr($haystack,0,strlen($needle)) === $needle);
}

This script obviously is not – as we say in Austria – the yellow of the egg, but it can defend from script kiddies I mentioned earlier who have no idea that all these tools have parameters to change the user agent.

就像我们在奥地利所说的那样,该脚本显然不是“蛋黄色”,但是它可以抵御我之前提到的脚本小子,他们不知道所有这些工具都有更改用户代理的参数。

调用脚本时会发生什么? (What happens when the script is called?)

Client Result
IE 11 Memory rises, IE crashes
Chrome Memory rises, error shown
Edge Memory rises, then dripps and loads forever
Nikto Seems to scan fine but no output is reported
SQLmap High memory usage until crash
客户 结果
IE 11 内存增加,IE崩溃
Chrome 内存增加,显示错误
边缘 内存上升,然后滴落并永久负载
尼克托 似乎扫描正常,但未报告输出
SQL映射 高内存使用率直到崩溃

(if you have tested it with other devices/browsers/scripts, please let me know and I’ll add it here)

(如果您已使用其他设备/浏览器/脚本对其进行过测试,请告诉我 ,我将在此处添加它)

If you’re a risk taker: try it yourself

如果您是冒险家:请自己尝试

翻译自: https://www.sitepoint.com/how-to-defend-your-website-with-zip-bombs/

数仓拉链表使用

数仓拉链表使用_如何用拉链炸弹捍卫您的网站相关推荐

  1. 数仓潮汐猎人 | 数据仓库企业数仓拉链表制作​

    拉链表 拉链表是针对数据仓库设计中表存储数据的方式而定义的,顾名思义,所谓拉链,就是记录历史.记录一个事物从开始,一直到当前状态的所有变化的信息. 下面就是一张拉链表,存储的是用户的最基本信息以及每条 ...

  2. 数仓--拉链表实战⭐⭐⭐⭐⭐

    拉链表实战⭐⭐⭐⭐⭐ 需求: 环境准备 在mysql中创建表和加载数据 在Hive中创建数据库和表: 全量导入数据到拉链表 将ODS层数据同步到DW层 增量导入数据到拉链表 在MySQL中添加增加数据 ...

  3. Hive数仓拉链表详解

    文章目录 1. 初始化数据 1.1 建表 1.2 加载数据 1.3 验证同步数据 2. 新增2020-06-21分区数据 3. 加载数据到拉链表 4. 新增2020-06-22分区数据 5. 再次加载 ...

  4. 数仓--拉链表(原理、设计以及在Hive中的实现)

    拉链表 什么是拉链表? 谈到拉链表就不得不谈SCD(缓慢变化维问题) 缓慢变化维怎么解决?(粗看有五种) 保留初始值(不让改) 改写属性值 ==增加维度新行== 增加维度新列 使用历史表 举一个具体的 ...

  5. 数仓建设生命周期_最最最全数据仓库建设指南,速速收藏 | 数澜科技

    开讲之前,我们先来回顾一下数据仓库的定义. 数据仓库(Data Warehouse)是一个面向主题的.集成的.相对稳定的.反映历史变化的数据集合,用于支持管理决策.这个概念最早由数据仓库之父比尔·恩门 ...

  6. 数仓dw怎么建_网易严选如何打造数仓规范和评价体系

    数据为王的时代,数据量从最初的几十 G,慢慢沉淀到几十 T,甚至几十 PB 的量.数据工程师,也从最初的 ETL 工程师慢慢成长为数据全栈工程师:采集.同步.模型.离线.实时.规范.平台.工具.产品. ...

  7. 数仓dw怎么建_从0建设离线数据仓库

    话聊 建设数仓 ETL 工具 面临的问题 分层 分层的出发点 分层设计 模型建设 为什么要建设模型 怎么建设模型 理清工作思路 实施步骤 建模方法及实施 规范建设 临时表管理 代码规范 流程规范 话聊 ...

  8. 上拉加载_如何用Vue + Mint UI实现上拉加载更多

    引言: 上拉加载更多在移动端不论是在 app 里面还是在页面中都是必不可少的,以下是 mint-ui 中上拉加载更多的总结. 一.在项目中使用 mint-ui 需要先安装 查看官网 (1)安装:npm ...

  9. 数仓dw怎么建_搭建数据仓库的流程简介

    如何搭建一个数据仓库? 下面大体说明了搭建的流程. 数据仓库的结构 用一幅图来表示: 数据仓库的好处 数据仓库是一套体系.可以建在Oracle上,MySQL上,Hive上,MaxCompute上,具体 ...

最新文章

  1. 环形熔断器设计与gobreaker源码分析
  2. 笔记本电脑连接服务器的显示器不亮,电脑显示器不亮怎么回事 电脑显示器不亮解决办法【图文】...
  3. C语言长精度除法,高精度除法小数点位数
  4. python能谢什么_python可以写什么啊
  5. printf, sprintf - 转换成指定格式的输出结果.
  6. [SOJ] DAG?
  7. Android自定义Lint实践
  8. 95-140-104-源码-transform-算子flatMap
  9. 虚拟网站禁用php,虚拟主机php程序fsockopen函数被禁用
  10. Vue.js 介绍及其脚手架工具搭建
  11. MYSQL 远程访问被限制
  12. 有锚点的链接页面刷新的问题
  13. java jtree 异步_[Java]JTree实现文件管理器的bug,请高手帮助 - 代码贴 - BCCN
  14. 流媒体网络性能指标——抖动
  15. 优雅高效的多边形对称性判定算法
  16. c语言彩票随机数7位数,随机生成7个不重复的彩票号码 (33选7)
  17. mysql集群搭建及性能调优之一(集群搭建)
  18. win10系统打不开计算机管理,win10计算机管理打不开如何办
  19. qt android usb开发,QT5检测USB设备
  20. JavaScript之JS事件机制

热门文章

  1. 常用音频编码格式简介(PCM、G726、ADPCM、LPCM、G711、AAC)
  2. 如何在网络上传输中文
  3. WordPress如何调用其他网站的最新文章
  4. 全志A40i及全志T3开发板 对CAN的支持补充
  5. openSUSE桌面环境日常软件推荐
  6. 浅谈NB_LOT和LTE CAT M1
  7. 彻底卸载 Visual Studio 2019【完整版】
  8. 面对海量IoT设备,如何打造高性能物联网平台接入层?
  9. 文件的上传和下载(一)
  10. VR数字展厅,实体经济转型新方式