#!/usr/bin/env python
import sys,datetime,random,urllib2
from pprint import pprint
sys.path.append('libs')
from looper import iterutil,SimpleHTTP

    
params = iterutil.chain(
    iterutil.dict_zip(
        method = iterutil.repeat('GET'),
        url = iterutil.concat(
            iterutil.repeat('http://'),
            iterutil.repeat('example.com'),
            ["/uri","/uri1"],
        ),
        headers = iterutil.dict_zip({
            'User-Agent': iterutil.repeat('SecurityInnovation/0.0.1/Looper'),
            'Accept': iterutil.repeat("application/json"),
            'Date': iterutil.repeat_f(lambda: datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")),
            'X-Request-Id': iterutil.repeat_f(lambda:"%032x" % random.getrandbits(128)),
            'Content-Type': iterutil.repeat('application/json'),
        }),
    ),
)

test = SimpleHTTP.TestCase(params)

#Install a proxy before running
proxy = urllib2.ProxyHandler({'http': '127.0.0.1:8080'})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
#!/usr/bin/env python
import sys,datetime,random,urllib2
from pprint import pprint
sys.path.append('libs')
from looper import iterutil,SimpleHTTP,BaseTestCase

    
params = iterutil.chain(
    iterutil.dict_zip(
        method = iterutil.repeat('GET'),
        url = iterutil.concat(
            iterutil.repeat('http://facebook.com/'),
            ['/login','/admin']
        ),
        headers = iterutil.dict_zip({
            'User-Agent': iterutil.repeat('SecurityInnovation/0.0.1/Looper'),
            'Accept': iterutil.repeat("application/json"),
            'Date': iterutil.repeat_f(lambda: datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")),
            'X-Request-Id': iterutil.repeat_f(lambda:"%032x" % random.getrandbits(128)),
            'Content-Type': iterutil.repeat('application/json'),
        }),
    ),
)

#LoggingHTTPTestCase must subclass object in order to use super()
class LoggingHTTPTestCase(SimpleHTTP.Test, SimpleHTTP.Check, BaseTestCase, object):
    def __init__(self,file_name,*args,**kwargs):
        self.fh = open(file_name,'w')
        #Continue with the next mixin
        super(LoggingHTTPTestCase, self).__init__(*args,**kwargs) 
Beispiel #3
0
#!/usr/bin/python
import datetime,random
import sys,os
sys.path.insert(0,os.path.join(os.path.dirname(__file__),'..','lib'))
from looper import iterutil,clients

params = iterutil.chain(
    iterutil.dict_zip(
        method = iterutil.repeat('GET'),
        url = iterutil.concat(
            iterutil.repeat('http://'),
            iterutil.repeat('127.0.0.1'),
            ["/uri","/uri1"],
        ),
        headers = iterutil.dict_zip({
            'User-Agent': iterutil.repeat('SecurityInnovation/0.0.1/Looper'),
            'Accept': iterutil.repeat("application/json"),
            'Date': iterutil.repeat_f(lambda: datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")),
            'X-Request-Id': iterutil.repeat_f(lambda:"%032x" % random.getrandbits(128)),
            'Content-Type': iterutil.repeat('application/json'),
        }),
    ),
)

class Check(object):
    '''
    A simple HTTP response check
    '''
    def check(self,request,response):
        print response
Beispiel #4
0
#!/usr/bin/env python
import datetime, random, urllib2
import sys, os

sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "lib"))
from looper import iterutil, clients

params = iterutil.chain(
    iterutil.dict_zip(
        method=iterutil.repeat("GET"),
        url=iterutil.concat(iterutil.repeat("http://"), iterutil.repeat("example.com"), ["/uri", "/uri1"]),
        headers=iterutil.dict_zip(
            {
                "User-Agent": iterutil.repeat("SecurityInnovation/0.0.1/Looper"),
                "Accept": iterutil.repeat("application/json"),
                "Date": iterutil.repeat_f(lambda: datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")),
                "X-Request-Id": iterutil.repeat_f(lambda: "%032x" % random.getrandbits(128)),
                "Content-Type": iterutil.repeat("application/json"),
            }
        ),
    )
)

test = clients.SimpleHTTP.TestCase(params)

# Install a proxy before running
proxy = urllib2.ProxyHandler({"http": "127.0.0.1:8080"})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
test.run()
Beispiel #5
0
#!/usr/bin/env python
import datetime,random
import sys,os
sys.path.insert(0,os.path.join(os.path.dirname(__file__),'..','lib'))
from looper import iterutil,clients
    
params = iterutil.chain(
    iterutil.dict_zip(
        method = iterutil.repeat('GET'),
        url = iterutil.concat(
            iterutil.repeat('http://'),
            iterutil.repeat('localhost'),
            ["/uri","/uri1"],
        ),
        headers = iterutil.dict_zip({
            'User-Agent': iterutil.repeat('SecurityInnovation/0.0.1/Looper'),
            'Accept': iterutil.repeat("application/json"),
            'Date': iterutil.repeat_f(lambda: datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")),
            'X-Request-Id': iterutil.repeat_f(lambda:"%032x" % random.getrandbits(128)),
            'Content-Type': iterutil.repeat('application/json'),
        }),
    ),
)

test = clients.SimpleHTTP.TestCase(params)
test.run()