HoneyPy是一个Python写的低交互式蜜罐,可以通过自定义Plugins的方式来配置不同的场景。这里是一个模拟Nginx空白页面的代码:

# Auth xiaoxiaoleo
# http://www.cnblogs.com/xiaoxiaoleo/
# from twisted.internet import protocol, reactor, endpoints
from twisted.python import log
import uuid
import datetime
### START CUSTOM IMPORTS ### ############################ class Web(protocol.Protocol): ### Set custom protocol class name
localhost = None
remote_host = None
session = None ### START CUSTOM VARIABLES ############################################################### ########################################################################################## # handle events
def connectionMade(self):
self.connect() ### START CUSTOM CODE #################################################################### ########################################################################################## def dataReceived(self, data):
self.rx(data) ### START CUSTOM CODE ####################################################################
time_str = datetime.datetime.now().strftime('%d %b %Y %H:%M:%S')
response = 'HTTP/1.1 200 OK\r\nServer: nginx/1.10.0 (CentOS)\r\nDate: ' + time_str +' GMT\r\nContent-Type: text/html\r\nLast-Modified: ' + time_str + ' GMT\r\nConnection: close\r\nETag: W/"583bbb00-264"\r\nContent-Length: 612\r\n'+"""
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>
"""
self.tx(response) ########################################################################################## ### START CUSTOM FUNCTIONS ################################################################### ############################################################################################## def connect(self):
self.local_host = self.transport.getHost()
self.remote_host = self.transport.getPeer()
self.session = uuid.uuid1()
log.msg('%s %s CONNECT %s %s %s %s %s' % (self.session, self.remote_host.type, self.local_host.host, self.local_host.port, self.factory.name, self.remote_host.host, self.remote_host.port)) def tx(self, data):
log.msg('%s %s TX %s %s %s %s %s %s' % (self.session, self.remote_host.type, self.local_host.host, self.local_host.port, self.factory.name, self.remote_host.host, self.remote_host.port, data.encode("hex")))
self.transport.write(data) def rx(self, data):
log.msg('%s %s RX %s %s %s %s %s %s' % (self.session, self.remote_host.type, self.local_host.host, self.local_host.port, self.factory.name, self.remote_host.host, self.remote_host.port, data.encode("hex"))) class pluginFactory(protocol.Factory):
protocol = Web ### Set protocol to custom protocol class name def __init__(self, name=None):
self.name = name or 'HoneyPy'

  

 

效果:

HTTP header:

HTML:

脚本写得不够完美,对Etag和Last-Modified分析一下,蜜罐就露出马脚~

HoneyPy 模拟Nginx服务器脚本的更多相关文章

  1. nginx服务器是怎么执行php脚本的?

    简单的说: fastCGI是nginx和php之间的一个通信接口,该接口实际处理过程通过启动php-fpm进程来解 析php脚本,即php-fpm相 当于一个动态应用服务器,从而实现nginx动态解析 ...

  2. 利用系统函数模拟实现nginx 系统脚本启动的特殊颜色专业效果

    利用系统函数模拟实现nginx 系统脚本启动的特殊颜色专业效果/etc/init.d/nginxd {start/stop/restart/reload}利用if语句实现: ============= ...

  3. 06_Linux基础-NGINX和浏览器、网页的关系-云服务器ssh登陆-安装NGINX-上传网页-压缩命令-xz-gzip-bzip2-zip-tar-配置NGINX服务器支持下载功能-备份脚本

    06_Linux基础-NGINX和浏览器.网页的关系-云服务器ssh登陆-安装NGINX-上传网页-压缩命令-xz-gzip-bzip2-zip-tar-配置NGINX服务器支持下载功能-备份脚本 一 ...

  4. linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本

    红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...

  5. Docker 使用入门,创建一个Nginx服务器

    运行环境: MAC Docker 版本: Docker version 17.12.0-ce, build c97c6d6 一.启动Nginx 服务器 启动Nginx 服务器,并进入模拟终端 dock ...

  6. Nginx服务器性能优化与安全配置实践指南

    转载自:https://www.bilibili.com/read/cv16151784?spm_id_from=333.999.0.0 1.引言 1.1 目的 为了更好的指导部署与测试艺术升系统ng ...

  7. nginx入门篇----nginx服务器基础配置

    1.nginx.conf文件结构...                         #全局块  events{  ...  }  http                      #http块{ ...

  8. Nginx+Keepalived(带Nginx监控脚本)

    转载于:http://www.itxuexiwang.com/a/liunxjishu/2016/0220/151.html?1456381460 Keepalived+ nginx的安装部署 主机: ...

  9. nginx服务器绑定域名和设置根目录的方法

    nginx服务器绑定域名以及设置根目录非常方便,首先进入nginx安装目录,然后执行 vim conf/nginx.conf 打开nginx的配置文件,找到 server { ..... ..... ...

随机推荐

  1. js数字格式化千分位格式

    带小数点的 var a = 8462948.2453; console.log(a.toLocaleString()) //8,462,948.245 不带小数点的 num.toString().re ...

  2. 「题目代码」P1007~P1012(Java)

    1007 C基础-计负均正 import java.util.*; import java.io.*; public class Main { public static void main(Stri ...

  3. spring与mybatis整合(基于配置文件)

    本文主要介绍了如何将mybatis和spring整合在一起使用,本人使用的是mybatis3.05 + spring3.1.0M2 ,使用dbcp作为数据库连接池. 1.编写数据访问接口(UserDa ...

  4. Week2 Teamework from Z.XML 软件分析与用户需求调查(三)必应助手体验评测

    评测人:毛宇 肖俊鹏 说明:言辞激烈,请勿介意 我花了2天的时间来试用这个软件<必应缤纷桌面手机助手>,有了很多体会,这里,我来谈一下这款软件在体验部分的表现情况. 体验部分主要分为三个部 ...

  5. ssh问题_1

    昨天配置了虚拟机的ssh,可以相互连接,但是今天早上就不行了,遇到如下错误 [slave1@hadoop ~]$ scp .ssh/id_rsa.pub master@hadoop.master:~/ ...

  6. lintcode-62-搜索旋转排序数组

    62-搜索旋转排序数组 假设有一个排序的按未知的旋转轴旋转的数组(比如,0 1 2 4 5 6 7 可能成为4 5 6 7 0 1 2).给定一个目标值进行搜索,如果在数组中找到目标值返回数组中的索引 ...

  7. Linux 监测系统资源

    Top;1; Linux监控磁盘性能 yum install sysstat iostat -x 1 %util:磁盘使用io所占百分比

  8. vue中表单的动态绑定

    有一个表单: <el-form :model="configForm"> </el-form> 如果configForm初始化为{},此对象是动态变化的,如 ...

  9. vsCode怎么为一个前端项目配置ts的运行环境

    vsCode为一个前端项目配置ts的运行环境,ts文件保存的时候自动编译成js文件: 假设此前端项目名称为Web:文件结构如图 1. 在根目录中新建一个“.vscode”文件夹,里面建一个“tasks ...

  10. Angular 2018 All in One

    Angular 2018 https://cli.angular.io/ v7.0.6 https://angular.io/ https://angular.cn/ v7.0.4 $ npm i - ...