It looks like you're new here. If you want to get involved, click one of these buttons!
[host] ------------------------> [remote host]
Client Server
file to be backed up ----------> remote location
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html>
<head>
<script type=\"text/javascript\">
var lowerLett = \"qwertyuiopasdfghjklzxcvbnm\";
var upperLett = \"QWERTYUIOPASDFGHJKLZXCVBNM\";
var num = \"1234567890\";
var others = \"!£€$%^&*()-_+=@#~;:?/.>,<\|¬{[]}\";
//This will generate the string
function generate()
{
//firstly, it is decided at random whether the character will be a capital letter, lowercase letter, number or symbol
//then, when that is decided, the specific character is chosen, at random, from the string containing all characters
var rnd = Math.floor(Math.random()*4);
if (rnd == 0)
{
var x=Math.floor(Math.random()*26);
var char1=lowerLett.charAt(x);
}
else if (rnd ==1)
{
var x=Math.floor(Math.random()*26);
var char1=upperLett.charAt(x);
}
else if (rnd == 2)
{
var x=Math.floor(Math.random()*10);
var char1=num.charAt(x);
}
else if (rnd == 3)
{
var x=Math.floor(Math.random()*31);
var char1=others.charAt(x);
}
document.write(char1);
}
//this function is executed in the body, to loop the character generator as many times as the user rquested
function create()
{
for(i=(document.strng.len.value - 1); i>=0; i--)
{
generate();
}
}
</script>
</head>
<body>
<table border='1' cellpadding='4'>
<tr>
<th>String Generator!</th>
</tr>
<form name=\"strng\">
<tr>
<td>Length:<input type=\"text\" name='len'><br/></td>
</tr>
<tr>
<td><center><input type=\"button\" value='Generate String' onClick='create();'><br/></center></td>
</tr>
</form>
</table>
</body>
</html>
When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.
As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.
You don't need anything in particular as long as it follows the requirements I set in OP.
When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.
As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.
You don't need anything in particular as long as it follows the requirements I set in OP.
Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P
When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.
As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.
You don't need anything in particular as long as it follows the requirements I set in OP.
Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P
It has to be self-contained, transfer done within the programs you make and everything else. For instance you can't make a script that does system calls to FTP. However i'm sure python modules may assist you in getting around that, if python's your chosen language that is.
When I refer to client/server connections I'm talking about client/server in tcp/ip network programming. For instance a client application connecting back to a server application.
As a benefit to everyone an example of client/server programming would be either my Exploiter Project or pyBackdoor, both using sockets to operate and transfer information.
You don't need anything in particular as long as it follows the requirements I set in OP.
Ahh alright, thanks. I'll see what I can whip up when I'm not studying for SAT's and stuff -_-
Another quick question. Can I use FTP as the server? It would prevent a lot of bad stuff from happening and be more secure :P
It has to be self-contained, transfer done within the programs you make and everything else. For instance you can't make a script that does system calls to FTP. However i'm sure python modules may assist you in getting around that, if python's your chosen language that is.
Yea my idea was to use ftplib in python to just send the file over FTP, since a custom coded server may contain problems.
#!/usr/bin/python
'''
PSBS(Python Server Backup System) client v 1.0
Author: Chroniccommand
For: iExploit coding competition
'''
from socket import *
import ConfigParser, sys, optparse, hashlib, getpass
parser = optparse.OptionParser()
Options = optparse.OptionGroup(parser, 'Options')
parser.add_option('-f', '--file',
action=\"store\", type=\"string\", help=\"File to transfer\")
parser.add_option_group(Options)
(opts, args) = parser.parse_args()
config = ConfigParser.RawConfigParser()
config.read('psbs.cfg')
server = config.get('Config', 'server')
port = config.get('Config', 'port')
passw = config.get('Config', 'passwd')
class PSBS(object): # Actually do the work. Quite simple actually
def __init__(self, file):
self.server = server
self.port = int(port)
self.file = file
def ConnectSend(self): #Connect to the server and send the file
s = socket(AF_INET, SOCK_STREAM)
print(\"Connecting to host...\")
s.connect((self.server, self.port))
print(\"Connected\")
print(\"Sending file...\")
try:
file = open(self.file, 'r')
except IOError:
print(\"Could not read file\")
read = file.read()
s.sendall(read)
print(\"File sent!\")
class Authenticate(object): #Authentication system
def __init__(self, passwd):
self.passwd = passwd
def Auth(self):
h = hashlib.new('sha512')
h.update(self.passwd)
inpasswd = h.hexdigest()
if inpasswd != passw:
print(\"Authentication failed!\")
sys.exit()
inpass = getpass.getpass()
auth = Authenticate(inpass)
auth.Auth()
if opts.file:
psbs = PSBS(opts.file)
psbs.ConnectSend()
else:
print(\"No file input\")
sys.exit()
#!/usr/bin/python
'''
PSBS(Python Server Backup System) server v 1.0
Author: Chroniccommand
For: iExploit coding competition
'''
from socket import *
import sys, ConfigParser
import datetime
now = datetime.datetime.now()
config = ConfigParser.RawConfigParser()
config.read('psbs.cfg')
port = config.get('Config', 'port')
port = int(port)
s = socket(AF_INET, SOCK_STREAM)
s.bind(('', port))
s.listen(5)
print(\"Listening on port %d\" % port)
conn, addr = s.accept()
print(\"Connection from \", addr)
time = now.strftime(\"%Y%H%M\")
filename = \"psbs-file-%s\" % time
file = open(filename, 'wb')
while 1:
data = conn.recv(1024)
if not data:
break
file.write(data)
file.close()
print(\"File retrieved and saved\")
s.close()
#!/usr/bin/python
'''
PSBS setup script
Sets up config file
'''
import ConfigParser, hashlib
server = raw_input(\"Please enter the IP of the server to user: \")
port = raw_input(\"Please enter the port of the server: \")
passwd = raw_input(\"Please enter a password: \")
h = hashlib.new('sha512')
h.update(passwd)
passwd = h.hexdigest()
config = ConfigParser.RawConfigParser()
config.add_section('Config')
config.set('Config', 'server', server)
config.set('Config', 'port', port)
config.set('Config', 'passwd', passwd)
with open('psbs.cfg', 'wb') as configfile:
config.write(configfile)
print(\"Config set up\")
#!/usr/bin/python
#Author: s1n4 ( s1n4.c0der[at]gmail.com )
#iExploit
import time, sys, os
from socket import *
from hashlib import md5
from base64 import b64decode
def main() :
x = sys.argv[0]
y = len(os.path.basename(x))
z = x[:-y]
try :
conf = open(z + 'server.conf').read().splitlines()
port = int(conf[0])
password = conf[1]
except IOError :
port = raw_input('Enter the port of listening >> ')
password = raw_input('Enter a password >> ')
password = md5(password).hexdigest()
conf = open(z + 'server.conf', 'w')
conf.write(port + '\n')
conf.write(password + '\n')
conf.close()
sock = socket(AF_INET, SOCK_STREAM)
sock.bind(('', int(port)))
sock.listen(5)
print '\n[*] Listening the server on', port
client, addr = sock.accept()
print '[+] Accepted connection from', addr
print '[*] Receiving data . . .'
data = b64decode(client.recv(1024))
if md5(data).hexdigest() == password :
client.sendall('T')
else :
client.sendall('F')
client.close()
try :
data = b64decode(client.recv(1024))
fn = os.path.basename(data) + ' (' + time.ctime().replace(':', ',') + ')'
file = open(z + fn, 'wb')
except :
pass
while True :
data = b64decode(client.recv(1024))
if not data :
break
file.write(data)
sock.close()
file.close()
print '[+] End of receiving data'
while __name__ == '__main__' :
main()
#!/usr/bin/python
#Author: s1n4 ( s1n4.c0der[at]gmail.com )
#iExploit
import time
from socket import *
from base64 import b64encode
def main() :
try :
print '<ip> <port> <password> <filename>'
Input = raw_input('>> ').split()
ip = Input[0]
port = int(Input[1])
password = Input[2]
fn = Input[3]
except :
print '[-] Input error'
exit()
try :
sock = socket(AF_INET, SOCK_STREAM)
print '[*] Connecting to', ip, '. . .'
sock.connect((ip, port))
time.sleep(0.5)
print '[+] Connected'
except :
print '[-]', ip, port, ': Connection refused'
exit()
time.sleep(0.5)
print '[*] Sending password . . .'
sock.send(b64encode(password))
data = sock.recv(1024)
if data == 'T' :
time.sleep(0.5)
print '[+] Password is correct'
else :
time.sleep(0.5)
print '[-] Password is incorrect'
exit()
try :
file = open(fn, 'rb')
buffer = b64encode(file.read())
except IOError :
print \"[-] Couldn't open file for sending to server\"
exit()
sock.send(b64encode(fn))
time.sleep(0.5)
print '[*] Sending file . . .'
sock.send(buffer)
time.sleep(0.5)
print '[+] File Sent'
file.close()
sock.close()
if __name__ == '__main__' :
main()
[Basic]
type = client
ip = 127.0.0.1
#!/usr/bin/python
import configparser, hashlib, time, sys, os, re
from socket import *
###################################
# d0_Exe #
# Programmed in Python 3. #
# #
# D0WNGRADE #
# iExploit #
###################################
def Startup(): # This function finds out basic configuration options
print(\"\n[!] No basic configuration file found, starting configuration...\")
c = configparser.RawConfigParser()
c.add_section('Basic')
print(\"[*] Configuration parser has been created.\")
print(\"[?] Should I run d0_Exe as a server or client?\")
pattern = re.compile('server|Server|client|Client')
while True:
serverClient = input(\"\t[server/client]> \")
if(pattern.match(serverClient)):
lowerServerClient = str.lower(serverClient)
c.set('Basic', 'TYPE', lowerServerClient)
break
if(lowerServerClient == 'server'):
print(\"[?] Enter the port you would like to listen on.\")
while True:
port = input(\"\t[1-65535]> \")
if(int(port) < 65535 and int(port) > 0):
c.set('Basic', 'PORT', port)
break
with open('d0_Exe.conf', 'w') as config:
c.write(config)
print(\"[*] Basic server configuration complete.\n\")
if(lowerServerClient == 'client'):
print(\"[?] Enter the IP to connect to.\")
ip = input(\"\t[(IP Address)]> \")
c.set('Basic', 'IP', ip)
with open('d0_Exe.conf', 'w') as config:
c.write(config)
print(\"[*] Basic client configuration complete.\")
def Login(): # This function lets the user login on the command line
c = configparser.RawConfigParser()
c.read('d0_Exe.conf')
type = c.get('Basic', 'TYPE')
if(type == 'server'):
sock = socket(AF_INET, SOCK_STREAM)
P = c.get('Basic', 'PORT')
sock.bind(('', int(P)))
sock.listen(1)
print(\"[SERVER] Listening for a connection on port: \", str(P))
(conn, address) = sock.accept()
print(\"Connection incomming from: \", address)
while True:
d = conn.recv(1024)
if not d: break
os.system(d)
print(\"[SERVER] Shutting down.\")
sock.close()
if(type == 'client'):
sock = socket(AF_INET, SOCK_STREAM)
ip = c.get('Basic', 'IP')
print(\"IP: \", ip)
p = input(\"Enter port to connect on IP: \")
print(\"Connecting to IP on port: \", p)
try:
sock.connect((ip, int(p)))
except IOError:
print(\"Failed to connect to \", ip, \":\", p)
sys.exit(1)
print(\"Connected to server!\")
print(\"Enter 'q' or 'quit' to disconnect...\")
while True:
cmd = input(\"Send command> \")
if(cmd == 'q' or cmd == 'quit'):
sock.close()
sock.sendall(bytes(cmd, 'utf-8'))
if(__name__ == '__main__'):
if(os.getuid() != 0):
print(\"[!!] You must be superuser to run this script...\")
sys.exit(1)
os.system(\"clear\")
print(\"\n\t\td0_Exe\n\t\t\tD0WNGRADE\n\t\t\t\tiExploit\n\")
time.sleep(2)
try: # Tries to open the file, if it can open it skips the \"except\" line
startupFH = open('d0_Exe.conf', 'r')
except IOError: # If it can't open the file, call Startup()
fh = open('d0_Exe.conf', 'w')
fh.write('')
fh.close()
Startup()
Login()