コード例 #1
0
def dotransform(request, response, config):

    if 'workspace' in request.fields:
        workspace = request.fields['workspace']
    else:
        workspace = request.value

    dbcon = db_connect(workspace)
    contact_list = get_contacts(dbcon)

    for fullname in contact_list:
        if fullname[0] is None or fullname[1] is None:
            pass
        else:
            e = Person(fullname[0] + ' ' + fullname[1])
            e += Field("workspace", workspace, displayname='Workspace')
            e += Field("fname", fullname[0], displayname='First Name')
            e += Field("lname", fullname[1], displayname='Last Name')
            e += Field("title", fullname[3], displayname='Title')
            e += Field("location",
                       str(fullname[4]) + ', ' + str(fullname[5]),
                       displayname='Location')
            e += Label("Title", fullname[3])
            e += Label("Location", str(fullname[4]) + ', ' + str(fullname[5]))
            response += e

    return response
コード例 #2
0
 def do_transform(self, request, response, config):
     user = request.entity
     _body = {
         'query': {
             'match': {
                 'user': user.value
             }
         },
         'size': request.limits.hard
     }
     res = es.search(index="twintgraph", body=_body)
     for hit in res['hits']['hits']:
         _user = hit['_source']
         r = Person()
         r.value = _user['follow']
         response += r
     return response
コード例 #3
0
ファイル: dev_diver.py プロジェクト: SneakersInc/Racoon
def dotransform(request, response, config):
  try:
    target = str(request.value).split('@')[0]
    client = connect()
    sid = client.init()
    client.use('recon/contacts-social/dev_diver', sid)
    client.set('username', target, sid)
    results = client.run(sid)
    for i in results:
      name = str(dict(i)['first_name']) + ' ' + str(dict(i)['last_name'])
      e = Person(name)
      e.firstnames = str(dict(i)['first_name'])
      e.lastname = str(dict(i)['last_name'])
      e += Field('title', str(dict(i)['title']), displayname='Source')
      response += e
    return response
  except Exception as e:
    return response + UIMessage(str(e))
コード例 #4
0
 def do_transform(self, request, response, config):
     tweet = request.entity
     _body = {
         'query': {
             'match': {
                 'id': tweet.id
             }
         },
         'size': request.limits.hard
     }
     res = es.search(index="twinttweets", body=_body)
     for hit in res['hits']['hits']:
         tweet = hit['_source']
         r = Person()
         r.name = tweet['name'].encode('ascii', 'ignore')
         r.value = tweet['username']
         r.url = 'https://twitter.com/' + tweet['username']
         response += r
     return response
コード例 #5
0
def dotransform(request, response):

    graph = login()

    try:
        r = graph.request(request.fields['uid'])

        if 'username' in r:
            response += Person(r['username'])
    except GraphAPIError, e:
        response += UIMessage(str(e))
コード例 #6
0
def dotransform(request, response):
    p = JSONDecoder().decode(
        pipljsonsearch(first_name=request.entity.firstnames or '',
                       last_name=request.entity.lastname or ''))

    if 'error' in p:
        response += UIMessage(p['error'])

    for r in p['results']['records']:
        if 'relationships' in r:
            for rel in r['relationships']:
                e = Person(rel['name']['display'])
                e += Label('Source',
                           '<a href="%s">%s</a>' %
                           (r['source']['url'], r['source']['@ds_name']),
                           type='text/html')
                response += e

    return response
コード例 #7
0
def dotransform(request, response, config):
    workspace = request.value
    contacts_gather(workspace)
    contacts_enum(workspace)
    msg = "Contact Mangle to Create Email addresses enter <fn>.<ln>, etc"
    title = "Mangle Contacts to Emails"
    fieldNames = ["Pattern"]
    fieldValues = []
    fieldValues = multenterbox(msg, title, fieldNames)

    while 1:
        if fieldValues is None:
            break
        errmsg = ""
        for i in range(len(fieldNames)):
            if fieldValues[i].strip() == "":
                errmsg += ('"%s" is a required field.\n\n' % fieldNames[i])
        if errmsg == "":
            break  # no problems found
        fieldValues = multenterbox(errmsg, title, fieldNames, fieldValues)

    contacts_mangle(workspace, fieldValues[0])

    dbcon = db_connect(workspace)
    contact_list = get_contacts(dbcon)

    for fullname in contact_list:
        if fullname[0] is None or fullname[1] is None:
            pass
        else:
            e = Person(fullname[0] + ' ' + fullname[1])
            e += Field("workspace", workspace, displayname='Workspace')
            e += Field("fname", fullname[0], displayname='First Name')
            e += Field("lname", fullname[1], displayname='Last Name')
            e += Field("title", fullname[3], displayname='Title')
            e += Field("location", str(fullname[4]) + ', ' + str(fullname[5]), displayname='Location')
            e += Label("Title", fullname[3])
            e += Label("Location", str(fullname[4]) + ', ' + str(fullname[5]))
            response += e

    return response
コード例 #8
0
ファイル: snmpcontact.py プロジェクト: wanghao233/sploitego
def dotransform(request, response):
    try:
        s = SNMPManager(*snmpargs(request))
        response += Person(s.contact)
    except SNMPError, s:
        response += UIMessage(str(s))