Example #1
0
 def do_request(self, postargs=''):
     getargs = ''
     command = ''
     querystart = self.path.find('?')
     path = self.path
     if (querystart != -1):
         getargs = self.path[querystart + 1:]
         path = self.path[:querystart]
     print path
     pathlist = path.split('/')
     if len(pathlist
            ) > 2 and pathlist[0] == '' and pathlist[1] == 'cgi-bin':
         command = pathlist[2]
         extension = command.find('.')
         if extension != -1:
             command = command[:extension]
     elif len(pathlist) == 1 or len(pathlist) == 2 and pathlist[1] == '':
         command = 'index'
     elif len(pathlist) == 2:
         indexname = pathlist[1]
         extension = indexname.find('.')
         print pathlist
         if extension != -1:
             indexname = indexname[:extension]
         if indexname == 'index':
             command = 'index'
     if not command in pages:
         if command == 'index':
             self.send_response(302, "Found")
             host = self.headers.get('Host', '')
             if host:
                 host = 'http://' + host
             self.send_header('Location', host + '/cgi-bin/register.py')
             self.end_headers()
         else:
             self.send_error(
                 404, "The requested file /cgi-bin/" + command +
                 " was not found.")
         return
     module = pages[command]
     mod = ''
     if module.post_form:
         postargs = db.urlDecode(postargs)
         mod = postargs.get('mod', '')
     if module.get_form:
         getargs = db.urlDecode(getargs)
         if not mod:
             mod = getargs.get('mod', '')
     if not mod and not module.get_form:
         mod = getargs
     if not mod in connections:
         self.send_error(402, "Payment Required")
         return
     self.oldstdout = sys.stdout
     sys.stdout = self.wfile
     self.send_response(200, "Script output follows")
     module.execute(connections[mod], getargs, postargs)
     sys.stdout = self.oldstdout
Example #2
0
 def do_request(self, postargs=''):
     getargs=''
     command=''
     querystart = self.path.find('?')
     path = self.path
     if (querystart!=-1):
         getargs = self.path[querystart+1:]
         path = self.path[:querystart]
     print(path)
     pathlist = path.split('/')
     if len(pathlist)>2 and pathlist[0]=='' and pathlist[1]=='cgi-bin':
         command = pathlist[2]
         extension = command.find('.')
         if extension!=-1:
             command=command[:extension]
     elif len(pathlist)==1 or len(pathlist)==2 and pathlist[1]=='':
         command='index'
     elif len(pathlist)==2:
         indexname = pathlist[1]
         extension = indexname.find('.')
         print(pathlist)
         if extension!=-1:
             indexname=indexname[:extension]
         if indexname=='index':
             command='index'
     if not command in pages:
         if command=='index':
             self.send_response(302, "Found")
             host = self.headers.get('Host', '')
             if host:
                 host = 'http://'+host
             self.send_header('Location', host+'/cgi-bin/register.py')
             self.end_headers()
         else:
             self.send_error(404, "The requested file /cgi-bin/"+command+" was not found.")
         return
     module = pages[command]
     mod=''
     if module.post_form:
         postargs = db.urlDecode(postargs)
         mod = postargs.get('mod','')
     if module.get_form:
         getargs = db.urlDecode(getargs)
         if not mod:
             mod = getargs.get('mod','')
     if not mod and not module.get_form:
         mod = getargs
     if not mod in connections:
         self.send_error(402, "Payment Required")
         return
     self.oldstdout = sys.stdout
     sys.stdout = self.wfile
     self.send_response(200, "Script output follows")
     module.execute(connections[mod], getargs, postargs)
     sys.stdout = self.oldstdout
Example #3
0
	f.close()
	
	s = comment(s, '<bind key="y" modifier="none" command="SwitchCombatMode" />')
	#s = comment(s, '<bind key="a" modifier="none" command="ToggleWarpDrive" />');
	
	s=myreplace (s,"callsign",username);
	s=myreplace (s,"password",password);
	s=myreplace (s,"realname",username);
	s=myreplace (s,"force_client_connect","true")
	s=myreplace (s,"default_mission","net.mission")
	
	# Make browser treat this as an XML file:
	print "Content-Type: text/xml"
	if (not (form.has_key("action") and form["action"]=="view")):
		print "Content-Disposition: attachment; filename=vegastrike.config"
	print ""
	
	print s

if __name__=='__main__':
	form = db.urlDecode(os.environ.get('QUERY_STRING',''))
	if form.has_key("mod"):
		mod = form["mod"]
	else:
		mod = ''
	
	filedb = db.DBBase(mod)
	
	execute(filedb, form, '')

Example #4
0
    s=f.read()
    f.close()

    s = comment(s, '<bind key="y" modifier="none" command="SwitchCombatMode" />')
    #s = comment(s, '<bind key="a" modifier="none" command="ToggleWarpDrive" />');

    s=myreplace (s,"callsign",username);
    s=myreplace (s,"password",password);
    s=myreplace (s,"realname",username);
    s=myreplace (s,"force_client_connect","true")
    s=myreplace (s,"default_mission","net.mission")

    # Make browser treat this as an XML file:
    print("Content-Type: text/xml")
    if (not ("action" in form and form["action"]=="view")):
        print("Content-Disposition: attachment; filename=vegastrike.config")
    print("")

    print(s)

if __name__=='__main__':
    form = db.urlDecode(os.environ.get('QUERY_STRING',''))
    if "mod" in form:
        mod = form["mod"]
    else:
        mod = ''

    filedb = db.DBBase(mod)

    execute(filedb, form, '')
Example #5
0
        success = False
        failed_error = sys.exc_info()[1]

    print(header)
    print('<br>')
    if success:
        url = 'vsconfig.py?username='******'&password='******'&mod='+mod
        print("To play, start up the game, click on 'Multiplayer', type in your login and password, and then click 'Join Game'")
        #print 'Download a functional'
        #print '<a href="'+url+'" title="Download config file">vegastrike.config</a>'
        #print 'to put in your vegastrike folder that has your appropriate login and password<br>'
        #print 'Or, <a href="'+url+'&action=view">view the config file</a> in your browser.<br>'
    else:
        print('<b>Registration Error</b>: ' + str(failed_error))
        print(errorvar)

    print(footer)

if __name__=='__main__':
    post_args = {}
    if os.environ.get('REQUEST_METHOD','GET') == 'POST':
        leng = os.environ['CONTENT_LENGTH']
        post_args = db.urlDecode(sys.stdin.read(int(leng)))
    if "mod" in post_args:
        mod = post_args["mod"]
    else:
        mod = os.environ.get('QUERY_STRING','')
    conn = db.connect(settings.dbconfig, mod)
    if post_args:
        execute(conn, mod, post_args)
        failed_error = sys.exc_value

    print header
    print '<br>'
    if success:
        url = 'vsconfig.py?username='******'&password='******'&mod=' + mod
        print "To play, start up the game, click on 'Multiplayer', type in your login and password, and then click 'Join Game'"
        #print 'Download a functional'
        #print '<a href="'+url+'" title="Download config file">vegastrike.config</a>'
        #print 'to put in your vegastrike folder that has your appropriate login and password<br>'
        #print 'Or, <a href="'+url+'&action=view">view the config file</a> in your browser.<br>'
    else:
        print '<b>Registration Error</b>: ' + str(failed_error)
        print errorvar

    print footer


if __name__ == '__main__':
    post_args = {}
    if os.environ.get('REQUEST_METHOD', 'GET') == 'POST':
        leng = os.environ['CONTENT_LENGTH']
        post_args = db.urlDecode(sys.stdin.read(int(leng)))
    if post_args.has_key("mod"):
        mod = post_args["mod"]
    else:
        mod = os.environ.get('QUERY_STRING', '')
    conn = db.connect(settings.dbconfig, mod)
    if post_args:
        execute(conn, mod, post_args)