Example #1
0
def get_runinfo(random):
    "Return the RunInfo entry with the provided random key"
    res = RunInfo.objects.filter(random=random.lower())
    return res and res[0] or None
Example #2
0
import sys
import random
name=sys.argv[1]
feeling=raw_input("How are you today, %s?: " %name)
feelings=['good', 'happy', 'sad', 'cheerful']
random=random.choice(feelings)
if feeling.lower() == random.lower():
	print("I am also feeling %s right now." %random)
else:
	print("Oh. I am feeling %s right now." %random)
Example #3
0
def get_runinfo(random):
    "Return the RunInfo entry with the provided random key"
    res = RunInfo.objects.filter(random=random.lower())
    return res and res[0] or None
Example #4
0
 elif s[x] == "threads":
     if s[x+1].isdigit():
         threads = int(s[x+1])
         if threads > 100:
             threads = 100
         elif threads < 1:
             threads = 1
 elif s[x] == "wait":
     wait = s[x+1]
     if wait.lower() == "true":
         wait = True
     else:
         wait = False
 elif s[x] == "random":
     random = s[x+1]
     if random.lower() == "true":
         random = True
     else:
         random = None
 elif s[x] == "speed":
     if s[x+1].isdigit():
         speed = int(s[x+1])
         if speed > 20:
             speed = 20
         elif speed < 1:
             speed = 1
 elif s[x] == "srchost":
     srchost = s[x+1]
 elif s[x] == "srcport":
     if s[x+1].isdigit():
         srcport = int(s[x+1])
Example #5
0
def lazerParseHook(event):
    global status, flooder, targetip, targethost, timeout, subsite, message, port, method, threads, wait, random, speed, srchost, srcport
    print event.arg

    s = []
    for x in event.arg:
        t = x.split("=")
        if len(t) > 1:
            for y in t:
                s.append(y)
        else:
            if t[0] == "start":
                status = START
            elif t[0] == "default":  # needs to be fleshed out more
                timeout = 9001
                subsite = "/"
                port = 80
                message = "U dun goofed"
                method.append(TCP_METHOD)
                speed = 0
                random = False
                srchost = "192.168.0.1"
                srcport = 4321

    print "Splitting finished, status:", status

    for x in range(0, len(s), 2):
        if s[x] == "targetip":
            targetip = s[x + 1]
        elif s[x] == "targethost":
            targethost = s[x + 1]
        elif s[x] == "timeout":
            if s[x + 1].isdigit():
                timeout = int(s[x + 1])
                if timeout < -1:
                    timeout = None
        elif s[x] == "subsite":
            subsite = s[x + 1]
        elif s[x] == "message":
            message = s[x + 1]
        elif s[x] == "port":
            if s[x + 1].isdigit():
                port = int(s[x + 1])
                if port > 65535:
                    port = None
                elif port < 1:
                    port = None
        elif s[x] == "method":
            methodTemp = s[x + 1].split(",")
            method = []
            for x in methodTemp:
                if x.upper() == "UDP":
                    method.append(UDP_METHOD)
                elif x.upper() == "HTTP":
                    method.append(HTTP_METHOD)
                elif x.upper() == "SYN":
                    method.append(SYN_METHOD)
                else:
                    method.append(TCP_METHOD)
        elif s[x] == "threads":
            if s[x + 1].isdigit():
                threads = int(s[x + 1])
                if threads > 100:
                    threads = 100
                elif threads < 1:
                    threads = 1
        elif s[x] == "wait":
            wait = s[x + 1]
            if wait.lower() == "true":
                wait = True
            else:
                wait = False
        elif s[x] == "random":
            random = s[x + 1]
            if random.lower() == "true":
                random = True
            else:
                random = None
        elif s[x] == "speed":
            if s[x + 1].isdigit():
                speed = int(s[x + 1])
                if speed > 20:
                    speed = 20
                elif speed < 1:
                    speed = 1
        elif s[x] == "srchost":
            srchost = s[x + 1]
        elif s[x] == "srcport":
            if s[x + 1].isdigit():
                srcport = int(s[x + 1])
                if srcport < -1:
                    srcport = None

    print "parsing finished"

    if status == START:
        event = Event(START_LAZER, None)
        getEventManager().signalEvent(event)
    else:
        status = WAITING
 def my_random_string(self,string_length=10):
   """Returns a random string of length string_length."""
   random = str(uuid.uuid4()) # Convert uuid format to python string.
   random = random.lower() # Make all characters uppercase.
   random = random.replace("-","") # Remove the uuid '-'.
   return random[0:string_length] # Return the random string.
Example #7
0
import sys
import random
name = sys.argv[1]
feeling = raw_input("How are you today, %s?: " % name)
feelings = ['good', 'happy', 'sad', 'cheerful']
random = random.choice(feelings)
if feeling.lower() == random.lower():
    print("I am also feeling %s right now." % random)
else:
    print("Oh. I am feeling %s right now." % random)
Example #8
0
 def my_random_string(self, string_length=10):
     """Returns a random string of length string_length."""
     random = str(uuid.uuid4())  # Convert uuid format to python string.
     random = random.lower()  # Make all characters uppercase.
     random = random.replace("-", "")  # Remove the uuid '-'.
     return random[0:string_length]  # Return the random string.