Recent Posts

Pages: 1 2 [3] 4 5 ... 10
Darwinbots3 / Re: Bot testbed
« Last post by Numsgil on November 07, 2017, 08:55:56 AM »
I'm taking a break at the moment, but if you're interested I can post my most recent build.  It fixes a number of issues.
Darwinbots3 / Re: Bot testbed
« Last post by Shadowgod2 on November 02, 2017, 11:31:13 PM »
wow nice little warning message while posting

so how's everything going? i'm thinking about getting into it a little again, try to see if i can get a turning code in
Off Topic / Re: My SSD drive broke down. What do you recommend?
« Last post by neanderbe on September 07, 2017, 08:19:05 AM »
By the way the program I use to restore the files is Recuva, which i downloaded from this site. It seems to be working well so I can recommend that if this happens to you. There are two versions; a desktop and a portable. The portable is useless, so I had to install Windows first and then run the dektop version.

Same thing happened to me once when I formatted a wrong drive. Recuva is a good tool and it's free but I found Active Undelete to be much more thorough in recovering my files. I use the Pro version.
Off Topic / Table of Slightly Wrong Equations and Identities
« Last post by theblaze on August 14, 2017, 10:23:10 AM »
Bugs and fixes / Re: poison and venom not working
« Last post by LawrenceFlores on August 07, 2017, 12:10:35 PM »
Looks like it is fixpos for Hulk. Kinda reminds me of the crazy bulk site our little completely broken vegy system.

It seems to be working fine now for me anyway.

Yep, works perfectly for a long time now.
For the server code, can you explain which abuses you're trying to protect against?

Someone flooding the sim with one of their bots, or grabbing all the bots available in the pool. It tries to keep a balance between bots in / out for each client
Darwinbots Program Source Code / Re: Use http get and set requests instead of ftp
« Last post by Numsgil on July 30, 2017, 09:56:04 AM »
@Numsgil will you be able to support using HTTP GET and PUT in the darwinbots client directly, or will it still use an external program with an incoming and outgoing directory?

Although Visual Basic 6 is supposed to support http libraries, in practice we've had better success with external programs that read and write the files, with the DB2 app just reading and writing files.


For the server code, can you explain which abuses you're trying to protect against?
Code: [Select]
from pprint import pprint
import threading
import uuid
import os
from collections import defaultdict
import re
import random
import time

from flask import request
from flask import Flask
app = Flask(__name__, static_url_path='')

botPath = 'bots/'

ipBotCounts = defaultdict(int)

# We allow adjustments back to zero slowly per IP, but not fast enough to cause abuse
def background_decay_ipCount():
    global ipBotCounts
    while True:
        for ip in ipBotCounts:
            if ipBotCounts[ip] > 0:
                print("removing 1 from " + ip)
                ipBotCounts[ip] -= 1

            if ipBotCounts[ip] < 0:
                print("adding 1 to " + ip)
                ipBotCounts[ip] += 1

decay_ip_thread = threading.Thread(target=background_decay_ipCount)

@app.route('/<world>', methods=['GET', 'PUT', 'POST'])
def handleRequest(world):
    path = request.path.split('/')[1]
    remoteIp = request.headers.get('X-Forwarded-For', request.remote_addr)

    if not re.match(r"[a-zA-Z0-9_]", path): #Someone is doing something dodgy
        return '', 400

    if not os.path.isdir(botPath + path):
        os.mkdir(botPath + path)

    if request.method == 'PUT':
        if ipBotCounts[remoteIp] >= 10:
            # Sent too many bots
            return '', 429

        ipBotCounts[remoteIp] += 1
        with open(botPath + path + '/' + str(uuid.uuid4()),'wb') as f:
        return ''

    if request.method == 'GET':
        if not len(os.listdir(botPath + path)) > 200: #not enough bots to give one out
            return '', 404

        if ipBotCounts[remoteIp] <= -10:
            # Sent too little bots to us
            return '', 429

        ipBotCounts[remoteIp] -= 1

        fileToSend = random.choice(os.listdir(botPath + path))
        fileToSend = botPath + path + '/' + fileToSend
        filedata = open(fileToSend, 'rb').read(100000)

        return filedata'', port=80, threaded=True)

Current server side code
Alright, not the best solution, but this should be temporary. You're gonna need with python3 and python3 requests, then go to the /cygdrive/c/.../Darwinbots/IM/outgoing in cygwin terminal, and

Code: [Select]
while :; do for bot in $(ls *dbo | shuf | head -n1); do curl -T$bot && rm $bot; done; rm *stats; sleep 1; done
Then save the following as
Code: [Select]
import requests
import time
import random
while True:
print("getting bot")
r = requests.get('')
botData = r.content
if r.ok:
with open(str(random.randrange(0,1000)) + '.dbo', 'wb') as f:
print("failed to get bot")

Then cd to /cygdrive/c/Users/.../IM/incoming and
Code: [Select]
python3 /cygdrive/c/path/to/
You can replace the anything goes with whichever world you want to connect to, so you can easily create your own. Note that per IP you need to stay within a range of -10 to +10 bots uploaded, so you'd be up to 10 quite quickly, then you get 1 point closer to 0 each minute. There needs to be a pool of 200 bots in the world before you can retrieve any, so it requires 200-10 minutes before you can receive anything back from the world.

@Numsgil will you be able to support using HTTP GET and PUT in the darwinbots client directly, or will it still use an external program with an incoming and outgoing directory?
Alright. Yeah, certbot is mainly for the simple configurations. I use to automatically get certs and renew them
Pages: 1 2 [3] 4 5 ... 10